Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About" invalid output_size "torch.Size([4, 45, 80])" (dim 1 must be between 41 and 45)" #22

Open
lianyingjieL opened this issue Apr 6, 2022 · 1 comment

Comments

@lianyingjieL
Copy link

When I run the original code, the following problems occur:
NVIDIA RTX A2000 x 2,Python3.7, CUDA 11.1, cuDNN 8.0.5, Pytorch 1.8.1, Horovod 0.22.1, Ubuntu 18.04, VNC, NVCC11.1, OpenMPI 4.0.0。

(myconda) root@b3193a16b028:/mnt/lyj/TASED_NET# python run_train.py
loading weight file
loaded
32
torch.Size([4, 3, 32, 360, 640])
torch.Size([4, 3, 32, 360, 640])
Traceback (most recent call last):
File "run_train.py", line 119, in
main()
File "run_train.py", line 92, in main
output = model(clip.cuda())
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 167, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 177, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 86, in parallel_apply
output.reraise()
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/_utils.py", line 429, in reraise
raise self.exc_type(msg)
ValueError: Caught ValueError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 61, in _worker
output = module(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/lyj/TASED_NET/model.py", line 98, in forward
z = self.unpool2(z, i1, y2.size())
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/pooling.py", line 462, in forward
self.padding, output_size)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/functional.py", line 843, in max_unpool3d
output_size = _unpool_output_size(input, kernel_size, _stride, padding, output_size)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/functional.py", line 754, in _unpool_output_size
output_size, d, min_size, max_size
ValueError: invalid output_size "torch.Size([4, 45, 80])" (dim 1 must be between 41 and 45)

@kylemin
Copy link
Member

kylemin commented Apr 6, 2022

Since TASED-Net has a series of max-pooling layers, it assumes that the spatial dimension of input (width and height) is a multiple of 16. I think you can resize your input to 640x320. As described in our paper, we actually resized every frame to 384x224.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants