Pytorch Error Linear object

I got an inexplicable error:
Traceback (most recent call last):
File “temp.py”, line 39, in
loss = criterion(out, target)
File “/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 493, in call
result = self.forward(*input, **kwargs)
File “/anaconda3/lib/python3.7/site-packages/torch/nn/modules/loss.py”, line 443, in forward
return F.mse_loss(input, target, reduction=self.reduction)
File “/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py”, line 2244, in mse_loss
if not (target.size() == input.size()):
File “/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 539, in getattr
type(self).name, name))
AttributeError: ‘Linear’ object has no attribute ‘size’

Here is my code:
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim

class NeuralNetwork(nn.Module):
def init(self):
super(NeuralNetwork, 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
    return x

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

netz = NeuralNetwork()
#----------INPUT/Output----------------------
x = [1,0,0,0,1,0,0,0,1,1]
input = torch.Tensor([x for _ in range(10)])
out = netz(input)

x = [0,1,1,1,0,1,1,1,0,0]
target = torch.Tensor([x for _ in range(10)])

#-------------------------------------

#-------LERN-ALG0---------------------
criterion = nn.MSELoss()
loss = criterion(out, target)
print(loss)
#-------------------------------------

out = netz(input)
print(out)

As you can imagine, I’m a real beginner so it would be very kind if someone could help me…
Thanks

It looks like you forgot to call self.lin2:

x = self.lin2(x)
return x

I will try it soon. It‘s really amazing how fast you answered. Thanks a lot!