Error calling a nn network

Hi Experts I have this very simple resnet network but I get an error at the end. Do you have hints ?

This is the first network:

class mlp(nn.Module):
    def __init__(self,nfeatures,nout):
        super(mlp, self).__init__()
        self.fc1 = nn.Linear(nfeatures,nout)
        self.tanh1=nn.Tanh()
    def forward(self, x):        
        output = self.fc1(x)
        input=self.tanh1(output)
        return outputtype or paste code here

And is called by this code:

tclass resnet(nn.Module):
    def __init__(self,nfea,out,depth=3):
        super().__init__()
        net=mlp(nfea,out)
        self.nfea=nfea
        self.out=out
        self.dep=depth
        self.resblock = nn.Sequential(*(self.dep*[net]))
        #print('hej')
        def forward(self, x):
            out=self.resblock(x)+x
            return outype or paste code here

I can do:

model=resnet(10,2,1).to(device)

But when I do:
inputs=torch.linspace(-2.0,2.0,10)

model(inputs)

I get cryptic error : NotImplementedError:

Any hints?

The indentation of the forward method in resnet is wrong, so decrease the indent (move it to the left) and it should work.

Yes of course. Thanks. :grinning: