Assertion failed when use int8 calibration for common onnx model.
Description
Say we have an onnx model defined as follows:
class MyModel(torch.nn.Module):
def forward(self, x):
x = x + 1
return x
model = MyModel().eval()
dummy = torch.randn(1, 2, 4, 4)
torch.save([dummy], 'dummy.pt')
torch.onnx.export(model, (dummy,), 'model.onnx')
And I use dummy.npy (transformed from dummy.pt) and model.onnx to build an INT8 engine, internal error will happen:
[TensorRT] INFO: Detected 1 inputs and 1 output network tensors.
[TensorRT] WARNING: Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles
[TensorRT] INFO: Starting Calibration with batch size 1.
[TensorRT] WARNING: Explicit batch network detected and batch size specified, use execute without batch size instead.
[TensorRT] INTERNAL ERROR: Assertion failed: d.nbDims >= 1
../rtSafe/safeHelpers.cpp:419
Aborting...
But if I change the model to :
class MyModel(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv1 = torch.nn.Conv2d(2, 3, 1, 1)
def forward(self, x):
x = self.conv1(x)
return x
Everything goes will. So is this problem a known issue for trt? or is it fixed in a newer trt version?
Environment
TensorRT Version: 7.0.0.11 GPU Type: T4 Nvidia Driver Version: 418.67 CUDA Version: 10.0 CUDNN Version: 7.6.5 Operating System + Version: centos Python Version (if applicable): 3.7.7 PyTorch Version (if applicable): 1.6.0a0+9bfb91b
Hello @chenbohua3 , thanks for reporting this is fixed in 7.2, could you upgrade your TRT? thanks!
@ttyio thanks. I have just tested this model in trt7.2, it works well:) And I am now testing more complicated models to see if there are other problems:)
Thanks @chenbohua3 , closing
Hi, could you explain what cause this issue? @ttyio i have to deal with tensorrt version 6.5. And needs to know whats causing this error