One thing you can do is generate a random input and a random target and compute gradients for the input:
import torch
import torch.nn.functional as F
from torch.autograd import Variable

N = 5  # minibatch
C = 3 # class
input = Variable(torch.randn(N, C), requires_grad=True)
target = Variable(torch.zeros(N).random_(0, C).long())
loss = cross_entropy(input, target)
loss.backward()
print(input.grad)

And repeat, replacing `cross_entropy with your loss.