class_docstr: One subclass of :class:`ModelDescBase` with the assupmtion of
  **single cost** and **single optimizer** training.
  It has the following constraints in addition to :class:`ModelDescBase`:
  
  1. `build_graph(...)` method should return a cost tensor when called under a training context.
     The cost will be the final cost to be optimized by the optimizer.
     Therefore it should include necessary regularization.
  
  2. Subclass is expected to implement :meth:`optimizer()` method.
docstr: Return the memoized optimizer returned by `optimizer()`.
  
  Users of :class:`ModelDesc` will need to implement `optimizer()`,
  which will only be called once per each model.
  
  Returns:
      a :class:`tf.train.Optimizer` instance.
docstr_tok: ["Return","the","memoized","optimizer","returned","by","`","optimizer","(",")","`",".","Users","of",":","class",":","`","ModelDesc","`","will","need","to","implement","`","optimizer","(",")","`",",","which","will","only","be","called","once","per","each","model",".","Returns",":","a",":","class",":","`","tf.train.Optimizer","`","instance","."]
code: def get_optimizer(self):
      """
      Return the memoized optimizer returned by `optimizer()`.
  
      Users of :class:`ModelDesc` will need to implement `optimizer()`,
      which will only be called once per each model.
  
      Returns:
          a :class:`tf.train.Optimizer` instance.
      """
      ret = self.optimizer()
      assert isinstance(
          ret, tfv1.train.Optimizer
      ), "ModelDesc.optimizer() must return an instance of tf.train.Optimizer! Got {} instead.".format(
          str(ret)
      )
      return ret
  
file_path: tensorpack/tensorpack/train/model_desc.py
imports: import tensorflow
  from ..utils.argtools import memoized_method
  from ..tfutils.common import get_op_tensor_name
  from ..tfutils.tower import get_current_tower_context
  from ..compat import _backport_tensor_spec, tfv1
label_desc: Use image node_id 1 for calling the ModelDesc obj's underlying member method code with example usage: obj.get_optimizer() and returns: ret