You can get the gradients from a tensor by
tensor.grad
For the skip connections, I’d try adding between a Linear or Conv3d keeping the size identical with padding and a relu activation and batchnorm. Highway Networks are an option, too.
But it seems you have an issue elsewhere. I notice your targets are under the variable “labels”. So why are you using MSELoss? If this is a classification problem, shouldn’t you be using CrossEntropyLoss or BCELoss?
https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html