error when value is a np.array int
https://github.com/pytorch/TensorRT/blob/5f66adefcea1302e91aa2b3b9e3120636d7027d8/py/torch_tensorrt/dynamo/conversion/converter_utils.py#L273
In this line, if the value is a np.array int, eg, a = np.array(50), then a.shape would be empty, and the ctx.net.add_constant function would throw Type error: incompatible function arguments.
Hi - thanks for the report. Are you encountering this bug when compiling a specific model?
Fix Outline
Ensure all np.array tensors have nonzero rank before calling add_constant here:
https://github.com/pytorch/TensorRT/blob/5f66adefcea1302e91aa2b3b9e3120636d7027d8/py/torch_tensorrt/dynamo/conversion/converter_utils.py#L272-L275
A regression test case to elicit this behavior might be to have a constant variable which is a dimensionless tensor, as in:
class TestModule(nn.Module):
def __init__(...):
self.const = torch.tensor(1)
...