Solved by jpeg729 in post #3 
              
              
                Those layers are not set directly as attributes of self, so you need to register them explicitly using self.add_module(namestr, layer). For example… 
class MLP(nn.Module):
    def __init__(self, h_sizes, out_size):
        ...
        for k in range(len(h_sizes)-1):
            self.hidden.append(nn…