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

RuntimeError: The size of tensor a (11) must match the size of tensor b (10) at non-singleton dimension 3 #3

Open
QingdaChen opened this issue Apr 27, 2019 · 3 comments

Comments

@QingdaChen
Copy link

This is my code :

class Accurate_Modle((torch.nn.Module)):
def init(self,data_kind,padding):
super(Accurate_Modle, self).init()
self.con6 = torch.nn.Conv2d(2*112,384, kernel_size=1, stride=1, padding=0)
self.con7 = torch.nn.Conv2d(384, 384, kernel_size=1, stride=1, padding=0)
self.con8 = torch.nn.Conv2d(384, 384, kernel_size=1, stride=1, padding=0)
self.con9 = torch.nn.Conv2d(384, 1, kernel_size=1, stride=1, padding=0)
if data_kind=='mb':

        # torch.nn.init.constant_(self.con5.bias, 0)
        self.conv1 = torch.nn.Sequential(OctConv2d('first', in_channels=1, out_channels=112, kernel_size=3),
                                   OctReLU(),
                                   OctConv2d('regular', in_channels=112, out_channels=112, kernel_size=3),
                                   OctReLU(),
                                   OctConv2d('regular', in_channels=112, out_channels=112, kernel_size=3),
                                   OctReLU(),
                                   OctConv2d('regular', in_channels=112, out_channels=112, kernel_size=3),
                                   OctReLU(),
                                   OctConv2d('last', in_channels=112, out_channels=112, kernel_size=3),
                                   nn.ReLU(),
                                         )
        self.full = torch.nn.Sequential(
                                      self.con6,
                                      torch.nn.ReLU(),
                                      self.con7,
                                      torch.nn.ReLU(),
                                      self.con8,
                                      torch.nn.ReLU(),
                                      self.con9,
                                      torch.nn.Sigmoid()
                                )
    # elif data_kind=='kitt':
    #    #...



def forward(self,x0,x1,flag):
   if flag=='train':
       y0 = self.conv1(x0)  # left_patch
       y1 = self.conv1(x1)
       y3 = torch.cat((y0, y1), 1)
       # print(y3.shape)
       y = self.full(y3)
@QingdaChen
Copy link
Author

File "OctConv-master\octconv.py", line 100, in forward
high_group_out = high_group_hh + low_group_upsampled
RuntimeError: The size of tensor a (11) must match the size of tensor b (10) at non-singleton dimension 3

@savourylie
Copy link
Member

This is due to that fact that the code isn't able handle the valid padding as it isn't made very clear in the original paper. I'm fixing this up and will push it up shortly.

@xyxxmb
Copy link

xyxxmb commented May 23, 2019

@savourylie Has you solved the question yet? If solved, could you update the new code?

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

3 participants