So, I ran this:
for epoch in range(epochs):
    epoch += 1
    inputs = Variable(torch.from_numpy(x_train))
    labels = Variable(torch.from_numpy(y_train))
    optimizer.zero_grad()
    outputs = model(inputs)
    loss = criterion(outputs,labels)
    loss.backward()
    optimizer.step()
    print('epoch {}, loss {} '. format(epoch, loss.data[0]))

and got this error:
UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
  Remove the CWD from sys.path while we load stuff.

Can someone be kind enough to explain the statement above? If possible, indicating the problem in my code.
Thanks!