I’m trying to implement an inception block to train on, but I seem to be getting an error when I concatenate all the outputs from the convolutional layers.
The code is here:

  
      github.com
  
  
    maxmatical/pytorch-projects/blob/master/inception block 6
# inception style module
class convnet(nn.Module):
    def __init__(self):
        super(convnet, self).__init__()
        self.conv_3 = nn.Sequential(
            nn.Conv2d(3, 8, 1, padding = 0),
            nn.ReLU(),
            nn.Conv2d(8, 8, 3, padding = 1),
            nn.ReLU()
        )
        self.conv_5 = nn.Sequential(
            nn.Conv2d(3, 8, 1, padding = 0),
            nn.ReLU(),
            nn.Conv2d(8, 8, 5, padding = 2),
            nn.ReLU()
        )
        self.max_pool_conv_1 = nn.Sequential(
            nn.MaxPool2d(3, stride = 3), # window size 3x3
            nn.Conv2d(3, 8, 1, padding = 0),
            nn.ReLU()


  This file has been truncated. show original

  
  
    
    
  
  


When I run my training, I get this error

RuntimeError                              Traceback (most recent call last)
 in ()
12
13         # forward + backward + optimize
—> 14         outputs = net(inputs)
15         loss = criterion(outputs, labels)
16         loss.backward()
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489             result = self._slow_forward(*input, **kwargs)
490         else:
–> 491             result = self.forward(*input, **kwargs)
492         for hook in self._forward_hooks.values():
493             hook_result = hook(self, input, result)
 in forward(self, x)
33         x3 = self.conv_5(x)
34         x4 = self.max_pool_conv_1(x)
—> 35         x = torch.cat([x1,x2,x3,x4], 1) # concatenate all layers
36         x = x.view(x.size(0), -1) # flatten
37         x = F.relu(self.fc1(x))
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 32 and 10 in dimension 2 at /Users/soumith/code/builder/wheel/pytorch-src/aten/src/TH/generic/THTensorMath.c:3586
It looks like it has something to do with the torch.cat line. Could anyone offer any help?