I understand, but why it is not showing the gradient values 
am i doing something wrong:

# Initialization
net = Net()
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
net.to(device)
# defining loss
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=0.01, momentum=0.9)

#some random input and lables
inputs = torch.rand(4,3,32,32)
labels = torch.rand(4)*10//5
inputs, labels= inputs.to(device), labels.to(device)

# zero_grad
net.zero_grad()
optimizer.zero_grad()

outputs = net(inputs)
loss = criterion(outputs, labels.long() )
print(loss.data)
print(loss.grad)
loss.backward()
print(loss.grad)
optimizer.step()
print(loss.grad)

output:
tensor(2.3276, device='cuda:0')
None
None
None