Closed sinha-abhash closed 6 years ago
@isht7 the following line
https://github.com/isht7/pytorch-deeplab-resnet/blob/9c05a9f70b3018252ca52024c9b449642cdd480c/deeplab_resnet.py#L193
should be replaced with
self.interp3 = nn.Upsample(size=(int(outS(input_size)), int(outS(input_size))), mode='bilinear')
because i becomes a float after the division by 2 and UpsamplingBilinear2d has been deprecated in favor of Upsample with mode argument.
I don't know about older pytorch versions, but the current upsample implementation only takes ints as sizes.
Hi, this code has been tested on only Python 2. Please use python 2.
@isht7 my requirement is with python3. Anyway, I will go with @jj0mst idea. Closing the issue for now. Thanks.
Hello I am using anaconda environment to execute your train code. But I am getting below error: /home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/modules/upsampling.py:180: UserWarning: nn.UpsamplingBilinear2d is deprecated. Use nn.Upsample instead. warnings.warn("nn.UpsamplingBilinear2d is deprecated. Use nn.Upsample instead.") Traceback (most recent call last): File "train.py", line 222, in
out = model(images)
File "/home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, *kwargs)
File "/home/abhash/Documents/Abhash/MG/deeplab-resnet/pytorch-deeplab-resnet/deeplab_resnet.py", line 198, in forward
out.append(self.interp3(self.Scale(x2))) # for 0.75x scale
File "/home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(input, **kwargs)
File "/home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/modules/upsampling.py", line 181, in forward
return super(UpsamplingBilinear2d, self).forward(input)
File "/home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/modules/upsampling.py", line 79, in forward
return F.upsample(input, self.size, self.scale_factor, self.mode)
File "/home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 1375, in upsample
return _functions.thnn.UpsamplingBilinear2d.apply(input, _pair(size), scale_factor)
File "/home/abhash/anaconda3/lib/python3.6/site-packages/torch/nn/_functions/thnn/upsampling.py", line 277, in forward
ctx.output_size[1],
TypeError: CudaSpatialUpSamplingBilinear_updateOutput received an invalid combination of arguments - got (int, torch.cuda.FloatTensor, torch.cuda.FloatTensor, float, float), but expected (int state, torch.cuda.FloatTensor input, torch.cuda.FloatTensor output, int outputHeight, int outputWidth)
Also, I am new to pytorch, so let pardon me if I am missing any obvious thing here. P.S.: anaconda3, python3.6 with GPU CUDA: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Tue_Jan_10_13:22:03_CST_2017 Cuda compilation tools, release 8.0, V8.0.61