Inconsistent inference results between PyTorch and converted TensorRT model with Interpolate operator
hongliyu0716 opened this issue · comments
hongliyu0716 commented
Description:
I'm experiencing a discrepancy between the inference results of PyTorch model and the TensorRT model obtained by converting it using the torch2trt tool.
Reproduce
This issue can be reproduced by the following script:
import torch
from torch.nn import Module
from torch2trt import torch2trt
para_0 = torch.randn([1, 2, 4, 4], dtype=torch.float32).cuda()
class interpolate(Module):
def forward(self, *args):
return torch.nn.functional.interpolate(args[0], size=(4, 6),scale_factor=None,mode='bicubic',align_corners=True,)
model = interpolate().float().eval().cuda()
model_trt = torch2trt(model, [para_0])
output = model(para_0)
output_trt = model_trt(para_0)
print(torch.max(torch.abs(output - output_trt)))
Environment
- torch: 2.1.1
- torch2trt: 0.4.0
- tensorrt: 8.6.1