you are zeroing the gradients right before calling backward(), hence they all will be zeros.
put the line: optimizer.zero_grad() above calling to net(inputs) so autograd will keep track of your gradients.