ENOT-AutoDL/onnx2torch

The code torch.Size(shape) does not work properly in trace mode when shape is of type Tensor.

0x00-pl opened this issue · 1 comments

its runs ok on normal mode but got this Error in torch.fx.trace or torch.fx.experimental.proxy_tensor.make_fx.

  File "/home/.../site-packages/onnx2torch/node_converters/expand.py", line 24, in _forward
    return input_tensor * torch.ones(torch.Size(shape), dtype=input_tensor.dtype, device=input_tensor.device)
TypeError: torch.Size() takes an iterable of 'int' (item 0 is 'Tensor')

workround:
change torch.Size(shape) to torch.Size(shape.numpy()) will solve the Error.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.