Solved by dejanbatanjac in post #2 
              
              
                I am not sure where you used self.net but I create a working example for you: 

import torch
import torch.nn as nn


class RandomModel(nn.Module):
    def __init__(self):
        super().__init__();
        self.net = None
        self.linear = None
    def forward(self, x):            
        retu…