The input is generated in this block and it seems fine before it is actually passed into the block above…
class ResNet(nn.Module):
    def __init__(self, Block, Block_Temporal, layers, img_channels, seq):
        super(ResNet, self).__init__()
        self.sequence = seq
        self.in_channels = 64*self.sequence
        self.temporal_channels = 64
        self.conv_init = nn.Conv2d(img_channels*self.sequence, 64*self.sequence, kernel_size = 4,
                                                 stride = 2, padding = 1, groups = self.sequence)
        self.bn = nn.BatchNorm2d(64*self.sequence)
        self.relu = nn.ReLU()
        self.maxpool = nn.MaxPool2d(3, stride = 2, padding = 1)
        self.layer1 = self._make_layer(Block, layers[0], 1)
        self.layer2 = self._make_layer(Block, layers[1], 2)
        self.layer3 = self._make_layer(Block, layers[2], 4)
        self.layer4 = self._make_layer(Block, layers[3], 8)
        self.temporal1 = self._make_temporal_layer(Block_Temporal, 2)
        self.temporal2 = self._make_temporal_layer(Block_Temporal, 4)
        self.temporal3 = self._make_temporal_layer(Block_Temporal, 8)
        self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
        self.sigmoid = nn.Sigmoid()
        self.gru = nn.GRU(input_size = 1024, hidden_size = 512, batch_first = True, bias = False)
        
        
    def _make_layer(self, Block, num_blocks, step):
        layers = []
        channels = self.in_channels * step
        for i in range(num_blocks):
            layers.append(Block(channels, self.sequence))
        return nn.Sequential(*layers, nn.Conv2d(channels, channels*2, 3, stride = 2, padding = 1, groups = self.sequence),
                                      nn.BatchNorm2d(channels*2))
    
    def _make_temporal_layer(self, BLock_Temporal, step):
        return nn.Sequential(BLock_Temporal(self.temporal_channels*step, self.sequence))
                
        
    def forward(self, x):
        
        temporal_list = []
        x = self.conv_init(x)
        x = self.bn(x)
        x = self.relu(x)
        x = self.maxpool(x)
        
        
        x = self.layer1(x)
        
        
        temporal = self.temporal1(x)
        temporal_list.append(temporal)
        x = self.layer2(x)
        temporal = self.temporal2(x)
        temporal_list.append(temporal)
        x = self.layer3(x)
        temporal = self.temporal3(x)
        temporal_list.append(temporal)
        x = self.layer4(x)
        x = self.avgpool(x)
        x = x.squeeze()
        x = torch.split(x, int(x.size(1)/self.sequence), 1)
        x = torch.cat([x[i].unsqueeze(1) for i in range(len(x))], 1)
        x = self.gru(x)
        x = self.Sigmoid(x)
        temporal_list.append(x)
        
        
        return temporal_list

Error occurs in ‘self.layer1(x)’