-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hello, I want to know whether magpy support side effect function like print. Dynamo will break the graph when meeting print. I write a simple demo to test magpy, but it seems that magpy do not support print.
The test demo is:
import torch
from frontend.compile import compile
def builtin_function(x):
x = x * 2
print(x)
x = x / 2
return x
x = torch.randn(1024)
compiled = compile(builtin_function)
y = compiled(x)
print(y)And the output is:
(<built-in function print>, [tensor([-1.2829, 2.9794, -3.1826, ..., 0.3809, 0.3648, -0.0356])], {}) <class 'NotImplementedError'>
Traceback (most recent call last):
File "/root/shw/graph_capture/MAGPY/MagPy/examples/magpy_test_builtin_functions.py", line 14, in <module>
y = compiled(x)
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/compile.py", line 77, in _fn
raise e
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/compile.py", line 74, in _fn
return fn(*args, **kwargs)
File "/root/shw/graph_capture/MAGPY/MagPy/examples/magpy_test_builtin_functions.py", line 7, in builtin_function
print(x)
File "/root/shw/graph_capture/MAGPY/MagPy/examples/magpy_test_builtin_functions.py", line 7, in builtin_function
print(x)
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/tracer.py", line 58, in trace_func
raise e
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/tracer.py", line 34, in trace_func
record(frame, frame_id)
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/guard_tracker.py", line 2827, in record
trackers[-1].record(frame, frame_id)
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/guard_tracker.py", line 979, in record
raise e
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/guard_tracker.py", line 974, in record
getattr(self, inst.opname)(inst)
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/guard_tracker.py", line 2318, in CALL_FUNCTION
self.call_function(func, args, kwargs)
File "/root/shw/graph_capture/MAGPY/MagPy/frontend/guard_tracker.py", line 1996, in call_function
raise NotImplementedError(func, args, kwargs)
NotImplementedError: (<built-in function print>, [tensor([-1.2829, 2.9794, -3.1826, ..., 0.3809, 0.3648, -0.0356])], {})
There's no graph and guard function output.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels