docstr: Get training op for applying gradients to variables.
  
  Subclasses that need to do anything fancy with gradients should override
  this method.
  
  Returns:
  An optimizer
docstr_tok: ["Get","training","op","for","applying","gradients","to","variables",".","Subclasses","that","need","to","do","anything","fancy","with","gradients","should","override","this","method",".","Returns",":","An","optimizer"]
code: def get_training_op(self):
      """Get training op for applying gradients to variables.
  
      Subclasses that need to do anything fancy with gradients should override
      this method.
  
      Returns:
      An optimizer
      """
      if self.optimizer == "adam":
          train_op = torch.optim.Adam(
              self.trainables, lr=self.learning_rate
          )
      elif self.optimizer == "adagrad":
          train_op = torch.optim.Adagrad(
              self.trainables, lr=self.learning_rate
          )
      elif self.optimizer == "rmsprop":
          train_op = torch.optim.RMSprop(
              self.trainables,
              lr=self.learning_rate,
              momentum=self.momentum,
          )
      elif self.optimizer == "sgd":
          train_op = torch.optim.SGD(
              self.trainables, lr=self.learning_rate
          )
      else:
          raise NotImplementedError(
              "Unsupported optimizer %s" % self.optimizer
          )
      return train_op
  
file_path: deepchem/contrib/torch/torch_model.py
imports: import torch
  import time
  import numpy
  from deepchem.trans import undo_transforms
  from deepchem.utils.save import log
  from deepchem.models import Model
label_desc: Use image node_id 3 for calling the TorchMultitaskModel obj's underlying member method code with example usage: obj.get_training_op() and returns: train_op