class_docstr: Base class for single-cost trainer.
  
  Single-cost trainer has a :meth:`setup_graph` method which takes
  (input_signature, input, get_cost_fn, get_opt_fn), and build the training graph from them.
  
  To use a :class:`SingleCostTrainer` object, call `trainer.setup_graph(...); trainer.train(...)`.
class_docstr_tok: ["Base","class","for","single-cost","trainer",".","Single-cost","trainer","has","a",":","meth",":","`","setup_graph","`","method","which","takes","(","input_signature",",","input",",","get_cost_fn",",","get_opt_fn",")",",","and","build","the","training","graph","from","them",".","To","use","a",":","class",":","`","SingleCostTrainer","`","object",",","call","`","trainer.setup_graph","(","...",")",";","trainer.train","(","...",")","`","."]
docstr: Implement the logic to build the graph, with an :class:`InputSource`
  that's been setup already.
  
  Returns:
      [Callback]: list of callbacks needed
docstr_tok: ["Implement","the","logic","to","build","the","graph",",","with","an",":","class",":","`","InputSource","`","that","'s","been","setup","already",".","Returns",":","[","Callback","]",":","list","of","callbacks","needed"]
code: def _setup_graph(self, input, get_cost_fn, get_opt_fn):
      """
      Implement the logic to build the graph, with an :class:`InputSource`
      that's been setup already.
  
      Returns:
          [Callback]: list of callbacks needed
      """
  
imports: from abc import ABCMeta, abstractmethod
  import six
  import tensorflow
  from ..compat import tfv1, is_tfv2
  from ..input_source import PlaceholderInput
  from ..predict.base import OnlinePredictor
  from ..tfutils.gradproc import FilterNoneGrad
  from ..tfutils.tower import PredictTowerContext, TowerFunc, get_current_tower_context
  from ..utils import logger
  from ..utils.argtools import call_only_once, memoized
  from ..utils.develop import HIDE_DOC
  from .base import Trainer
label_desc: Use image node_id 2 for calling the SingleCostTrainer obj's underlying member method code with example usage: obj._setup_graph(input, get_cost_fn, get_opt_fn) without return types