def snapshot_object(target, filename, savefun=npz.save_npz, trigger=(1, 'epoch')):
 @extension.make_extension(trigger=trigger, priority=(-100))
 def snapshot_object(trainer):
  _snapshot_object(trainer, target, filename.format(trainer), savefun)
 return snapshot_object

def snapshot_object ( target , filename , savefun = npz . save_npz , trigger = ( 1 , 'epoch' ) ) : @ extension . make_extension ( trigger = trigger , priority = ( - 100 ) ) def snapshot_object ( trainer ) : _snapshot_object ( trainer , target , filename . format ( trainer ) , savefun ) return snapshot_object
returns a trainer extension to take snapshots of a given object .