Pretty prints the traceback for one instruction
(obj: FrameList)
| 305 | |
| 306 | |
| 307 | def pretty_print_stacktraces(obj: FrameList) -> str: |
| 308 | """ |
| 309 | Pretty prints the traceback for one instruction |
| 310 | """ |
| 311 | pretty = "Traceback (most recent call last): \n" |
| 312 | for frame in obj.items: |
| 313 | pretty += f' File "{frame.filename}", ' |
| 314 | pretty += f"line {str(frame.lineno)}, in {frame.name}\n" |
| 315 | pretty += f"{frame.context} \n" |
| 316 | pretty += "\n" |
| 317 | return pretty |
| 318 | |
| 319 | |
| 320 | def add_cursor_to_graph(graph: torch.fx.Graph, finding_node: torch.fx.Node) -> str: |