Hello. I am now making GC-net-like own network,
where GC-net is : https://arxiv.org/pdf/1703.04309.pdf
I’m now having difficulty at 'cost-volume’making phase.
the code of the phase is :
def cost_volume(self, imgl, imgr):
xx_list = []
pad_opr1 = nn.ZeroPad2d((0, self.max_d, 0, 0))
xleft = pad_opr1(imgl)
for d in range(self.max_d): # maxdisp+1 ?
pad_opr2 = nn.ZeroPad2d((d, self.max_d - d, 0, 0))
xright = pad_opr2(imgr)
xx_temp = torch.cat((xleft, xright), 1)
xx_list.append(xx_temp)
xx = torch.cat(xx_list, 1)
xx = xx.view(1, self.max_d, 64, int(self.height / 2), int(self.width / 2) + self.max_d)
xx0 = xx.permute(0, 2, 1, 3, 4)
xx0 = xx0[:, :, :, :, :int(self.width / 2)]
return xx0
Here, ‘xleft = pad_opr1(imgl)’ code line makes error of following :
xleft = pad_opr1(imgl)
File “C:\Users\Administrator\PycharmProjects\eps\venv\lib\site-packages\torch\nn\modules\module.py”, line 550, in call
result = self.forward(*input, **kwargs)
File “C:\Users\Administrator\PycharmProjects\eps\venv\lib\site-packages\torch\nn\modules\padding.py”, line 17, in forward
return F.pad(input, self.padding, ‘constant’, self.value)
File “C:\Users\Administrator\PycharmProjects\eps\venv\lib\site-packages\torch\nn\functional.py”, line 3389, in _pad
assert len(pad) // 2 <= input.dim(), ‘Padding length too large’
AttributeError: ‘tuple’ object has no attribute ‘dim’
I cannot understand the error and guess how to deal with it.
Please anybody give me hints and breakthroughs and thank you very much.