dhpollack:

x = torch.from_numpy(x).float()


@dhpollack: Thanks for your reply. But after implementing your suggestion, I’m getting the following error:

Traceback (most recent call last):
File “pytorch_tutorial.py”, line 50, in 
hidden_input = torch.mm(x, weights_input_hidden)
RuntimeError: matrices expected, got 1D, 2D tensors at d:\downloads\pytorch-master-1\torch\lib\th\generic/THTensorMath.c:1233

This code works perfectly when I’m running using numpy. So during conversion to pytorch I’m making some mistake.