class_docstr: Base class for the abstract InputSource. 
class_docstr_tok: ["Base","class","for","the","abstract","InputSource","."]
docstr: An InputSource might need some extra maintenance during training,
  which is done also through the Callback interface.
  This method returns the callbacks and the return value will be memoized.
  
  All callbacks will be automatically marked as `chief_only=False`,
  so they will run on all nodes.
  
  Callbacks returned by :class:`InputSource` only supports a subset of callback's functionalities:
  
  1. It cannot access the trainer, because an :class:`InputSource` can be used in pure inference.
  2. It cannot use the following methods: `trigger_{step,epoch}, {before,after}_epoch`.
  
  In other words, these callbacks should only have the basic functionality of `tf.train.SessionRunHooks`.
  
  Returns:
      list[Callback]: extra callbacks needed by this InputSource.
docstr_tok: ["An","InputSource","might","need","some","extra","maintenance","during","training",",","which","is","done","also","through","the","Callback","interface",".","This","method","returns","the","callbacks","and","the","return","value","will","be","memoized",".","All","callbacks","will","be","automatically","marked","as","`","chief_only=False","`",",","so","they","will","run","on","all","nodes",".","Callbacks","returned","by",":","class",":","`","InputSource","`","only","supports","a","subset","of","callback","'s","functionalities",":","1",".","It","can","not","access","the","trainer",",","because","an",":","class",":","`","InputSource","`","can","be","used","in","pure","inference",".","2",".","It","can","not","use","the","following","methods",":","`","trigger_","{","step",",","epoch","}",",","{","before",",","after","}","_epoch","`",".","In","other","words",",","these","callbacks","should","only","have","the","basic","functionality","of","`","tf.train.SessionRunHooks","`",".","Returns",":","list","[","Callback","]",":","extra","callbacks","needed","by","this","InputSource","."]
code: def get_callbacks(self):
      """
      An InputSource might need some extra maintenance during training,
      which is done also through the Callback interface.
      This method returns the callbacks and the return value will be memoized.
  
      All callbacks will be automatically marked as `chief_only=False`,
      so they will run on all nodes.
  
      Callbacks returned by :class:`InputSource` only supports a subset of callback's functionalities:
  
      1. It cannot access the trainer, because an :class:`InputSource` can be used in pure inference.
      2. It cannot use the following methods: `trigger_{step,epoch}, {before,after}_epoch`.
  
      In other words, these callbacks should only have the basic functionality of `tf.train.SessionRunHooks`.
  
      Returns:
          list[Callback]: extra callbacks needed by this InputSource.
      """
      assert self.setup_done()
      ret = [
          CallbackFactory(before_train=lambda _: self.reset_state())
      ] + self._get_callbacks()
  
      for r in ret:
          r.set_chief_only(
              False
          )  # no input callbacks should be chief-only
      return ret
  
imports: import copy
  from abc import ABCMeta, abstractmethod
  from contextlib import contextmanager
  import six
  import tensorflow
  from ..callbacks.base import CallbackFactory
  from ..tfutils.common import get_op_tensor_name
  from ..utils import logger
  from ..utils.argtools import call_only_once, memoized_method
  from ..compat import tfv1
label_desc: Use image node_id 6 for calling the InputSource obj's underlying member method code with example usage: obj.get_callbacks() and returns: ret