dimensions mismatched at input 1 at index 1. Input 0 shape: [1,256,90,120], Input 1 shape: [1,512,90,120]
See original GitHub issueHi, when I convert BiSeNet model to trt,
from model.build_BiSeNet import BiSeNet
model = BiSeNet(12, 'resnet18').cuda()
model.module.load_state_dict(torch.load('best_dice_loss_miou_0.655.pth'))
x = torch.ones((1, 3, 720, 960)).cuda()
model_trt = torch2trt(model, [x])
here comes an error:
[TensorRT] ERROR: (Unnamed Layer* 88) [Concatenation]: all concat input tensors must have the same dimensions except on the concatenation axis (0), but dimensions mismatched at input 1 at index 1. Input 0 shape: [1,256,90,120], Input 1 shape: [1,512,90,120] Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/home/segmentation/laomuji/BiSeNet/torch2trt/torch2trt/torch2trt.py”, line 347, in torch2trt outputs = module(*inputs) File “/home/segmentation/miniconda3/envs/dl/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 541, in call result = self.forward(*input, **kwargs) File “/home/segmentation/laomuji/BiSeNet/model/build_BiSeNet.py”, line 157, in forward result = self.feature_fusion_module(sx, cx) File “/home/segmentation/miniconda3/envs/dl/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 541, in call result = self.forward(*input, **kwargs) File “/home/segmentation/laomuji/BiSeNet/model/build_BiSeNet.py”, line 69, in forward x = torch.cat((input_1, input_2), dim=1) File “/home/segmentation/laomuji/BiSeNet/torch2trt/torch2trt/torch2trt.py”, line 198, in wrapper converter(ctx) File “/home/segmentation/laomuji/BiSeNet/torch2trt/torch2trt/converters/cat.py”, line 14, in convert_cat trt_inputs = [trt_(ctx.network, i) for i in inputs] File “/home/segmentation/laomuji/BiSeNet/torch2trt/torch2trt/converters/cat.py”, line 14, in <listcomp> trt_inputs = [trt_(ctx.network, i) for i in inputs] File “/home/segmentation/laomuji/BiSeNet/torch2trt/torch2trt/torch2trt.py”, line 115, in trt_ num_dim = len(t._trt.shape) # non-leaf tensors must already have _trt, get shape from that ValueError: len() should return >= 0
What’s wrong with it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Hi @SrivastavaKshitij ,
Does this error occur if you build torch2trt with plugins?
Best, John
@jaybdub I also meet the problem
[TensorRT] ERROR: INVALID_ARGUMENT: Can not find binding of given name
, when i buildtrt_net = torch2trt(net, inputs, fp16_mode=fp16,max_workspace_size=1 << 25)
no error. But when i want get the outputpreds_trt = trt_net(image)
will cause a error.