def setup_callbacks(self, callbacks, monitors):
        """
        Setup callbacks and monitors. Must be called after the main graph is built.

        Args:
            callbacks ([Callback]):
            monitors ([MonitorBase]):
        """
        assert isinstance(callbacks, list), callbacks
        assert isinstance(monitors, list), monitors
        describe_trainable_vars()   # TODO weird

        self.register_callback(MaintainStepCounter())
        for cb in callbacks:
            self.register_callback(cb)
        for cb in self._callbacks:
            assert not isinstance(cb, MonitorBase), "Monitor cannot be pre-registered for now!"
        registered_monitors = []
        for m in monitors:
            if self.register_callback(m):
                registered_monitors.append(m)
        self.monitors = Monitors(registered_monitors)
        self.register_callback(self.monitors)   # monitors is also a callback

        # some final operations that might modify the graph
        logger.info("Setup callbacks graph ...")
        self._callbacks = Callbacks(self._callbacks)
        self._callbacks.setup_graph(weakref.proxy(self))
def setup_callbacks ( self , callbacks , monitors ) : assert isinstance ( callbacks , list ) , callbacks assert isinstance ( monitors , list ) , monitors describe_trainable_vars ( ) self . register_callback ( MaintainStepCounter ( ) ) for cb in callbacks : self . register_callback ( cb ) for cb in self . _callbacks : assert not isinstance ( cb , MonitorBase ) , "Monitor cannot be pre-registered for now!" registered_monitors = [ ] for m in monitors : if self . register_callback ( m ) : registered_monitors . append ( m ) self . monitors = Monitors ( registered_monitors ) self . register_callback ( self . monitors ) logger . info ( "Setup callbacks graph ..." ) self . _callbacks = Callbacks ( self . _callbacks ) self . _callbacks . setup_graph ( weakref . proxy ( self ) )
Setup callbacks and monitors. Must be called after the main graph is built.

        Args:
            callbacks ([Callback]):
            monitors ([MonitorBase]):