Hello there,
I tried to solve this now for 2 Hours and  I still don’t know, what I should change in my code. 
Can You please help me?
Here’s my Code:
import os
import torch
import torch.nn as nn
import torch.nn.functional as f
from torch.autograd import Variable
import torch.optim as optim


class MeinNetz(nn.Module):
    def __init__(self):
        super(MeinNetz, self).__init__()
        self.lin1 = nn.Linear(10, 10)
        self.lin2 = nn.Linear(10, 10)

    def forward(self, x):
        x = f.relu(self.lin1(x))
        x = self.lin2(x)
        return x

    def num_flat_features(self, x):
        size = x.size()[1:]
        num = 1
        for i in size:
            num *= i
        return num


#netz = MeinNetz()

if os.path.isfile('MeinNetz.pt'):
    netz = torch.load('MeinNetz.pt')

for i in range(1000):
    x = [1, 0, 0, 0, 1, 0, 0, 0, 1, 1]
    input = Variable(torch.Tensor([x for _ in range(10)]))

    out = netz(input)

    x = [0, 1, 1, 1, 0, 1, 1, 1, 0, 0]
    target = Variable(torch.Tensor([x for _ in range(10)]))
    criterion = nn.MSELoss()
    loss = criterion(out, target)
    print(loss)

    netz.zero_grad()
    loss.backward()
    optimizer = optim.SGD(netz.parameters(), lr=0.10)
    optimizer.step()

torch.save(netz, 'MeinNetz.pt')


And this is the Error:
/Users/***/PycharmProjects/Pytorch/venv/mnist.py:40: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
  return F.log_softmax(x)
Traceback (most recent call last):
  File "/Users/***/PycharmProjects/Pytorch/venv/mnist.py", line 63, in <module>
    train(epoch)
  File "/Users/***/PycharmProjects/Pytorch/venv/mnist.py", line 59, in train
    loss.data[0]))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number


Thank You