Thank you for the clarification.
Also, is it ok to perform squeeze/unsqueeze every time whenever I want to add layers with different inputs which as follows:
        x = x.unsqueeze(0)
        
        residual1 = x
        residual1 = F.interpolate(residual1, size=[1024], mode='nearest', align_corners=None)
        x = x.squeeze(0)
        residual1 = residual1.squeeze(0)
        x = F.relu(self.bn1(self.linear1(x)))
        x += residual1

Will it effect the data-processing or the result?