I am trying to train the model but getting  error
RuntimeError: The size of tensor a (7) must match the size of tensor b (6) at non-singleton dimension 2
have the model with the following shapes
(Pdb) for _params in model.parameters(): print (_params.data.shape)
torch.Size([16, 1, 7, 7])
torch.Size([16])
torch.Size([16])
torch.Size([16])
torch.Size([16])
torch.Size([16])
torch.Size([8, 16, 1, 1])
torch.Size([8])
torch.Size([8])
torch.Size([8])
torch.Size([8, 8, 3, 3])
torch.Size([8])
torch.Size([8])
torch.Size([8])
torch.Size([16, 8, 1, 1])
torch.Size([16])
torch.Size([16])
torch.Size([16])
torch.Size([8, 16, 1, 1])
torch.Size([8])
torch.Size([8])
torch.Size([8])
torch.Size([8, 8, 3, 3])
torch.Size([8])
torch.Size([8])
torch.Size([8])
torch.Size([16, 8, 1, 1])
torch.Size([16])


my input have the shape [331, 1, 240 ,320]
I am trying to find the error using the following code
            optimizer = lib.optim.SGD(model.parameters(), lr=0.035, momentum=1)
            criterion = lib.torch.nn.MSELoss()
            optimizer.zero_grad()
            outputs = model(inputs)
            loss = criterion(outputs, target)
            loss.backward()
            optimizer.step()
            err += loss.item()

I am getting the following error .
==> training: (gpu 1, num_gpus 1)
==> online epoch # 0 [batchSize = 16] [learningRate = [0.001]]
Traceback (most recent call last):
  File "deep_nets.py", line 119, in <module>
    lib.trainEpoch(tr, _conf.model_dirname +'/results_tr', _conf, mconf, model, epoch=i)
  File "pytorch-0.4/torch_2_pytorch/lib/train.py", line 76, in trainEpoch
    outputs = model(inputs)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/container.py", line 91, in forward
    input = module(input)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "pytorch-0.4/torch_2_pytorch/helper.py", line 68, in forward
    y = self._modules[str(mx)](x[mx])
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/container.py", line 91, in forward
    input = module(input)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "pytorch-0.4/torch_2_pytorch/helper.py", line 68, in forward
    y = self._modules[str(mx)](x[mx])
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/container.py", line 91, in forward
    input = module(input)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "pytorch-0.4/torch_2_pytorch/helper.py", line 68, in forward
    y = self._modules[str(mx)](x[mx])
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/container.py", line 91, in forward
    input = module(input)
  File "anaconda3/envs/pytorch04/lib/python3.7/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "pytorch-0.4/torch_2_pytorch/helper.py", line 27, in forward
    return sum(x)
RuntimeError: The size of tensor a (7) must match the size of tensor b (6) at non-singleton dimension 2


Please help me out …