def forward(self, x):
linear = self.linear(x); x = None
relu = oneflow._oneflow_internal._C.relu(linear); linear = None
return relu
"""`
报错:
Traceback (most recent call last):
File "/home/wrq/oneflow/oneflow_fx.py", line 23, in
traced_without_activation = onefx.symbolic_trace(without_activation)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 1236, in symbolic_trace
graph = tracer.trace(root, concrete_args)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 811, in trace
(self.create_arg(fn(*args)),),
File "/home/wrq/oneflow/oneflow_fx.py", line 14, in forward
y = oneflow.ones([2, 3])
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/oneflow/nn/modules/constant.py", line 237, in ones_op
return Ones(size, dtype, device, placement, sbp, requires_grad)()
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 780, in module_call_wrapper
return self.call_module(mod, forward, args, kwargs)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 495, in call_module
module_qualified_name = self.path_of_module(m)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 450, in path_of_module
raise NameError("module is not installed as a submodule")
NameError: module is not installed as a submodule
`import oneflow import onefx
import onefx as fx
class MyModule(oneflow.nn.Module): def init(self, do_activation : bool = False): super().init() self.do_activation = do_activation self.linear = oneflow.nn.Linear(512, 512)
without_activation = MyModule(do_activation=False) with_activation = MyModule(do_activation=True)
traced_without_activation = onefx.symbolic_trace(without_activation) print(traced_without_activation.code) """ def forward(self, x): linear = self.linear(x); x = None return linear """
traced_with_activation = onefx.symbolic_trace(with_activation) print(traced_with_activation.code) """ wrap("oneflow._oneflow_internal._C.relu")
def forward(self, x): linear = self.linear(x); x = None relu = oneflow._oneflow_internal._C.relu(linear); linear = None return relu """` 报错: Traceback (most recent call last): File "/home/wrq/oneflow/oneflow_fx.py", line 23, in
traced_without_activation = onefx.symbolic_trace(without_activation)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 1236, in symbolic_trace
graph = tracer.trace(root, concrete_args)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 811, in trace
(self.create_arg(fn(*args)),),
File "/home/wrq/oneflow/oneflow_fx.py", line 14, in forward
y = oneflow.ones([2, 3])
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/oneflow/nn/modules/constant.py", line 237, in ones_op
return Ones(size, dtype, device, placement, sbp, requires_grad)()
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 780, in module_call_wrapper
return self.call_module(mod, forward, args, kwargs)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 495, in call_module
module_qualified_name = self.path_of_module(m)
File "/home/wrq/anaconda3/envs/quant/lib/python3.9/site-packages/onefx/_symbolic_trace.py", line 450, in path_of_module
raise NameError("module is not installed as a submodule")
NameError: module is not installed as a submodule
环境: oneflow 0.9.0 onefx 0.0.3 torch 2.0.1