relative-depth-using-pytorch icon indicating copy to clipboard operation
relative-depth-using-pytorch copied to clipboard

UpsamplingNearest2d' object has no attribute 'mode'

Open IConquer96 opened this issue 6 years ago • 2 comments

run the test_on_one_image.py

Processing sample ../../data/4.png /usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py:133: UserWarning: nn.UpsamplingNearest2d is deprecated. Use nn.Upsample instead. warnings.warn("nn.UpsamplingNearest2d is deprecated. Use nn.Upsample instead.") Traceback (most recent call last): File "test_on_one_image.py", line 73, in main() File "test_on_one_image.py", line 43, in main batch_output = (model(_processed_input)).float() File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 118, in forward return self.seq(x) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 101, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 77, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 52, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/home/pi/Downloads/relative-depth-using-pytorch-master/src/experiment/models/hourglass.py", line 27, in forward return self.list0+self.list1 File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py", line 134, in forward return super(UpsamplingNearest2d, self).forward(input) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/upsampling.py", line 79, in forward return F.upsample(input, self.size, self.scale_factor, self.mode) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 398, in getattr type(self).name, name)) AttributeError: 'UpsamplingNearest2d' object has no attribute 'mode'

IConquer96 avatar Nov 10 '18 04:11 IConquer96

hi,have u solve it?

Lvhhhh avatar Jun 11 '19 02:06 Lvhhhh

I think this may be a version issue. I solved it by adding some parameters which not exisit in Pytorch 0.3 or lower. Perhaps this will help you. Or you can just change your version to 0.3.

King-Hell avatar Apr 10 '20 07:04 King-Hell