question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jaybdubcommented, Oct 22, 2019

Hi @SrivastavaKshitij ,

Does this error occur if you build torch2trt with plugins?

Best, John

0reactions
xieyddcommented, Nov 30, 2019

@jaybdub I also meet the problem [TensorRT] ERROR: INVALID_ARGUMENT: Can not find binding of given name, when i build trt_net = torch2trt(net, inputs, fp16_mode=fp16,max_workspace_size=1 << 25) no error. But when i want get the output preds_trt = trt_net(image) will cause a error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensorflow Input Dimension mismatch problem - Stack Overflow
An LSTM takes as input 3D tensors and you are passing in 1D tensors so you need to reshape it to the appropriate...
Read more >
All input arrays must have same number of dimensions
This error occurs when you attempt to concatenate two NumPy arrays that have different dimensions. The following example shows how to fix this ......
Read more >
Issue with Multiplying a TensorRT with Another which leads to ...
In the PyTorch script, I am Multiplying a vector of dimension torch. ... Input 0 shape: [-1,-1,52,52,2], Input 1 shape: [-1,-1,3,-1,-1,2] ...
Read more >
DML_GATHER_OPERATOR_DE...
Gathers elements from the input tensor along **Axis**, using **IndicesTensor** to remap indices.
Read more >
Dimension error when trying to use Neuron compiled HF ...
Incorrect tensor shape at input tensor #0: received 5 128 768, expected 1 128 768.\n Incorrect tensor shape at input tensor #1: received...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found