program_slice
get_program_slice(graph, sinks, keep_lineapy_save=False)
Find the necessary and sufficient code for computing the sink nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph |
Graph
|
The computation graph. |
required |
sinks |
List[LineaID]
|
Artifacts to get the code slice for. |
required |
keep_lineapy_save |
bool
|
Whether to retain |
False
|
Returns:
Type | Description |
---|---|
CodeSlice
|
String containing the necessary and sufficient code for computing sinks |
Source code in lineapy/graph_reader/program_slice.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
get_slice_graph(graph, sinks, keep_lineapy_save=False)
Takes a full graph from the session and produces the subset responsible for the "sinks".
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph |
Graph
|
A full graph objection from a session. |
required |
sinks |
List[LineaID]
|
A list of node IDs desired for slicing. |
required |
keep_lineapy_save |
bool
|
Whether to retain |
False
|
Returns:
Type | Description |
---|---|
Graph
|
A subgraph extracted (i.e., sliced) for the desired node IDs. |
Source code in lineapy/graph_reader/program_slice.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
get_source_code_from_graph(slice_nodes, session_graph, include_non_slice_as_comment=False)
Returns the code from some subgraph, by including all lines that are included in the graphs source.
Source code in lineapy/graph_reader/program_slice.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
get_subgraph_nodelist(graph, sinks, keep_lineapy_save)
Computes a preliminary slice first evaluates what all nodes serve as sinks, and then for each of the sinks from what all nodes in the graph, can the sinks be reached (all ancestors of all sinks) Note that this function is not the final slice as it is possible that some relevant nodes are not included through the ancestor relation. For more details see _include_dependencies_for_indirectly_included_nodes_in_slice
Source code in lineapy/graph_reader/program_slice.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|