Hi,
I am working on a regression problem related to material science by using residual NNs. My whole neural network is using fully connected layers with residual connections along with Batch-Normalization and Activation. The following is the network that I have tried to implement which is from the Paper: IRNet
import torch.nn as nn
import torch.nn.functional as F

class Net(torch.nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.linear1 = nn.Linear(in_features=86, out_features=1024)
        self.bn1 = nn.BatchNorm1d(num_features=1024)
        self.linear2 = nn.Linear(in_features=1024, out_features=1024)
        self.linear3 = nn.Linear(in_features=1024, out_features=1024)
        self.linear4 = nn.Linear(in_features=1024, out_features=1024)
        self.linear5 = nn.Linear(in_features=1024, out_features=512)
        self.bn2 = nn.BatchNorm1d(num_features=512)
        self.linear6 = nn.Linear(in_features=512, out_features=512)
        self.linear7 = nn.Linear(in_features=512, out_features=512)
        self.linear8 = nn.Linear(in_features=512, out_features=256)
        self.bn3 = nn.BatchNorm1d(num_features=256)
        self.linear9 = nn.Linear(in_features=256, out_features=256)
        self.linear10 = nn.Linear(in_features=256, out_features=256)
        self.linear11 = nn.Linear(in_features=256, out_features=128)
        self.bn4 = nn.BatchNorm1d(num_features=128)
        self.linear12 = nn.Linear(in_features=128, out_features=128)
        self.linear13 = nn.Linear(in_features=128, out_features=128)
        self.linear14 = nn.Linear(in_features=128, out_features=64)
        self.bn5 = nn.BatchNorm1d(num_features=64)
        self.linear15 = nn.Linear(in_features=64, out_features=64)
        self.linear16 = nn.Linear(in_features=64, out_features=32)
        self.bn6 = nn.BatchNorm1d(num_features=32)
        self.linear17 = nn.Linear(in_features=32, out_features=1)

    def forward(self, x):
        x = x.unsqueeze(0)
        
        residual1 = x
        residual1 = F.interpolate(residual1, size=[32,1024], mode='nearest', align_corners=None)
        x = F.relu(self.bn1(self.linear1(x)))
        x += residual1
        
        residual2 = x
        x = F.relu(self.bn1(self.linear2(x)))
        x += residual2
        
        residual3 = x
        x = F.relu(self.bn1(self.linear3(x)))
        x += residual3
        
        residual4 = x
        x = F.relu(self.bn1(self.linear4(x)))
        x += residual4
        
        residual5 = x
        residual5 = F.interpolate(residual1, size=[32,512], mode='nearest', align_corners=None)        
        x = F.relu(self.bn2(self.linear5(x)))
        x += residual15
        
        residual6 = x
        x = F.relu(self.bn2(self.linear6(x)))
        x += residual16
        
        residual7 = x
        x = F.relu(self.bn2(self.linear7(x)))
        x += residual7
        
        residual8 = x
        residual8 = F.interpolate(residual1, size=[32,256], mode='nearest', align_corners=None)        
        x = F.relu(self.bn3(self.linear8(x)))
        x += residual8
        
        residual9 = x
        x = F.relu(self.bn3(self.linear9(x)))
        x += residual9
        
        residual10 = x
        x = F.relu(self.bn3(self.linear10(x)))
        x += residual10
        
        residual11 = x
        residual11 = F.interpolate(residual1, size=[32,128], mode='nearest', align_corners=None)        
        x = F.relu(self.bn4(self.linear11(x)))
        x += residual11
        
        residual12 = x
        x = F.relu(self.bn4(self.linear12(x)))
        x += residual12
        
        residual13 = x
        x = F.relu(self.bn4(self.linear13(x)))
        x += residual13
        
        residual14 = x
        residual14 = F.interpolate(residual1, size=[32,64], mode='nearest', align_corners=None)                
        x = F.relu(self.bn5(self.linear14(x)))
        x += residual14
        
        residual15 = x
        x = F.relu(self.bn5(self.linear15(x)))
        x += residual15
        
        residual16 = x
        residual16 = F.interpolate(residual1, size=[32,32], mode='nearest', align_corners=None)                
        x = F.relu(self.bn6(self.linear16(x)))
        x += residual16
        
        out = self.linear16(x)
        
        return out

But it is giving me an error when I try to perform model.train() with model.forward(Xtrain) as shown below:
RuntimeError                              Traceback (most recent call last)
<ipython-input-23-a7d2104011f1> in <module>
     16         # in case you wanted a semi-full example
     17         model.train()
---> 18         outputs = model.forward(batch_x_train)
     19         train_loss = criterion(outputs,batch_y_train)
     20 

<ipython-input-20-6d0a8f559e2f> in forward(self, x)
     33 
     34         residual1 = x
---> 35         residual1 = F.interpolate(residual1, size=[32,1024], mode='nearest', align_corners=None)
     36         x = F.relu(self.bn1(self.linear1(x)))
     37         x += residual1

~/.local/lib/python3.6/site-packages/torch/nn/functional.py in interpolate(input, size, scale_factor, mode, align_corners)
   2508 
   2509     if input.dim() == 3 and mode == 'nearest':
-> 2510         return torch._C._nn.upsample_nearest1d(input, _output_size(1))
   2511     elif input.dim() == 4 and mode == 'nearest':
   2512         return torch._C._nn.upsample_nearest2d(input, _output_size(2))

RuntimeError: It is expected output_size equals to 1, but got size 2
Can you tell me what is wrong with my code?
In the following post on pytorch it was said that interpolate could be used for this purpose