def push_monitor(model, name, transfer_experience=False, save_records=False):
 assert hasattr(model, 'monitor')
 old_monitor = model.monitor
 setattr(model, name, old_monitor)
 del model.monitor
 if transfer_experience:
  monitor = Monitor.get_monitor(model)
  assert (monitor is not old_monitor)
  monitor._num_batches_seen = old_monitor._num_batches_seen
  monitor._examples_seen = old_monitor._examples_seen
  monitor._epochs_seen = old_monitor._epochs_seen
  if save_records:
   monitor.on_channel_conflict = 'copy_history'
   monitor.channels = copy.copy(old_monitor.channels)
   for (key, value) in list(monitor.channels.items()):
    value.prereqs = None
 return model

def push_monitor ( model , name , transfer_experience = False , save_records = False ) : assert hasattr ( model , 'monitor' ) old_monitor = model . monitor setattr ( model , name , old_monitor ) del model . monitor if transfer_experience : monitor = Monitor . get_monitor ( model ) assert ( monitor is not old_monitor ) monitor . _num_batches_seen = old_monitor . _num_batches_seen monitor . _examples_seen = old_monitor . _examples_seen monitor . _epochs_seen = old_monitor . _epochs_seen if save_records : monitor . on_channel_conflict = 'copy_history' monitor . channels = copy . copy ( old_monitor . channels ) for ( key , value ) in list ( monitor . channels . items ( ) ) : value . prereqs = None return model
when you load a model in a yaml file and you want to store its old monitor under a different name and start a new monitor .