Hello,
i am a Newbie in PyTorch and AI and make this for privacy.
My code have to take X numbers (floats) from a list and give me back the X+1 number (float) but all what i become back is:
for Output-tensor
tensor([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan],
       device='cuda:0', grad_fn=<ThAddBackward>)

and for loss:
tensor(nan, device='cuda:0', grad_fn=<MseLossBackward>)

i dont know what this is 
Here is my Code, thank you for your help:
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import os

DatasetNumber = 1
DataAmount = 2
matrix1 = torch.Tensor(DataAmount * 5)
matrix2 = torch.Tensor(DataAmount * 5)

class TestNetz(nn.Module):

    # Netz erzeugen

    def __init__(self):

        super(TestNetz, self).__init__()
        self.lin1 = nn.Linear(DataAmount * 5, DataAmount * 5)  # Schichten (Hiddenlayer) (Funktionen die erlernt werden um vom Input auf Output zu kommen)
        self.lin2 = nn.Linear(DataAmount * 5, DataAmount * 5)

    def forward(self, x):
        x = F.log_softmax(self.lin1(x), 0)  # Aktivierungsfunktion relu
        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

    # Daten vorbereiten

    k = open('Datenset.txt', 'r')
    lines = k.readlines()

    i = 0
    while i < DataAmount:
        j = 0
        while j < 5:
            matrix1[j + (5 * i)] = float(lines[j + (5 * i) + (DatasetNumber * 5)])
            matrix2[j + (5 * i)] = float(lines[(DatasetNumber * DataAmount) + (DataAmount * 5)])
            j = j + 1
        i = i + 1



    print(matrix1)
    print(matrix2)


netz = TestNetz()
netz = netz.cuda()
print(netz)

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


for i in range(100):
    # Input
    input = Variable(matrix1)
    input = input.cuda()

    out = netz(input)

    print(out)

    # Ziel
    target = Variable(matrix2)
    target = target.cuda()
    criterion = nn.MSELoss()  # Fehlerberechnung
    loss = criterion(out, target)
    #print(loss)

    netz.zero_grad()
    loss.backward()
    optimizer = optim.SGD(netz.parameters(), lr=0.01)  # Optimizer (SGD) mit Lernrate
    optimizer.step()


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