chenchr:

a = Variable(torch.from_numpy(np.array([[[[1, 2, 3],[4,5,6],[7, 8, 9]]]])))


This line has to be:
a = Variable(torch.from_numpy(np.array([[[[1, 2, 3],[4,5,6],[7, 8, 9]]]])).float())

i.e. the input a has to be either of type Float or Double