def observe_value(observation_key, target_func):
 @extension.make_extension(trigger=(1, 'epoch'), priority=extension.PRIORITY_WRITER)
 def _observe_value(trainer):
  trainer.observation[observation_key] = target_func(trainer)
 return _observe_value

def observe_value ( observation_key , target_func ) : @ extension . make_extension ( trigger = ( 1 , 'epoch' ) , priority = extension . PRIORITY_WRITER ) def _observe_value ( trainer ) : trainer . observation [ observation_key ] = target_func ( trainer ) return _observe_value
returns a trainer extension to continuously record a value .