Solved by Nikronic in post #2 
              
              
                Hi, 
In your network you are returning a nn.Module rather than a tensor. Probably, you want to return self.fc3(x). 

Also, please format code blocks to enhance readability. And generally, I think it would be very nice to learn the tools/rules available on this forum by first reading guidelines. 
Bes…