code: def _setup_model_loss(self, lr):
          
          # Setup loss
          if not hasattr(self, "loss"):
              self.loss = SoftCrossEntropyLoss()
  
          # Setup optimizer
          if not hasattr(self, "optimizer"):
              self.optimizer = optim.Adam(self.parameters(), lr=lr)
docs: Setup loss and optimizer for PyTorch model.