@flow.unittest.skip_unless_1n1d()
@autotest(check_graph=True)
def test_mul_inplace_tensor(test_case):
device = random_device()
rand_tensor = random_pytorch_tensor(low=-2, high=2, ndim=4, dim0=constant(16), dim1=constant(9), dim2=constant(4), dim3=constant(7)).to(device)
y = rand_tensor + 1
x = random_pytorch_tensor(low=-2, high=2, ndim=4, dim0=constant(16), dim1=constant(9), dim2=constant(4), dim3=constant(7)).to(device)
y.mul_(
x
)
return y
Tensor([16, 9, 4, 7]).to(cuda)
Tensor([16, 9, 4, 7]).__add__(1)
Tensor([16, 9, 4, 7]).to(cuda)
Tensor([16, 9, 4, 7]).mul_(Tensor([16, 9, 4, 7]))
-----------------------------------------------------------
This program has 0 input tensor:
E..............................s..................s..............sss....
======================================================================
ERROR: test_mul_inplace_tensor (__main__.TestTensor)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/zzk/oneflow/python/oneflow/test_utils/automated_test_util/torch_flow_dual_object.py", line 384, in dual_method
test_g_res = test_g()
File "/home/zzk/oneflow/python/oneflow/nn/graph/graph.py", line 258, in __call__
self._compile(*args)
File "/home/zzk/oneflow/python/oneflow/nn/graph/graph.py", line 506, in _compile
eager_outputs = self._build_graph(*args)
File "/home/zzk/oneflow/python/oneflow/nn/graph/graph.py", line 614, in _build_graph
) = self._build_io("output", graph_build_util.build_graph_output, *outputs)
File "/home/zzk/oneflow/python/oneflow/nn/graph/graph.py", line 818, in _build_io
build_args.append(build_tensor_or_none(arg, name, repr_str))
File "/home/zzk/oneflow/python/oneflow/nn/graph/graph.py", line 798, in build_tensor_or_none
build_arg = build_func(name, tensor)
File "/home/zzk/oneflow/python/oneflow/framework/graph_build_util.py", line 187, in build_graph_output
assert out.is_lazy
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zzk/oneflow/python/oneflow/test_utils/automated_test_util/torch_flow_dual_object.py", line 703, in new_f
res = f(test_case)
File "test_tensor.py", line 482, in test_mul_inplace_tensor
x
File "/home/zzk/oneflow/python/oneflow/test_utils/automated_test_util/torch_flow_dual_object.py", line 387, in dual_method
raise OneFlowGraphBuildOrRunError(e)
oneflow.test_utils.automated_test_util.torch_flow_dual_object.OneFlowGraphBuildOrRunError: OneFlow nn.Graph Build Or Run Error:
----------------------------------------------------------------------
Ran 146 tests in 18.178s
FAILED (errors=1, skipped=8)