@JuanFMontesinos Thanks. I misunderstood what self.training was for. Yes, that seems to work. But, if I’m training like this it won’t work :
            output = model(x_train)
            loss_value = loss(output, y_train)

            # backprop
            model.zero_grad()
            loss_value.backward()
            model.update_parameters(learning_rate)