class_docstr: Updates the train_time variable.
  
  Optionally stops training if we've passed a time limit.
class_docstr_tok: ["Updates","the","train_time","variable",".","Optionally","stops","training","if","we","'ve","passed","a","time","limit","."]
code: def after_run(self, run_context, vals):
      self._last_run_duration = time.time() - self._last_run_start_time
      train_time = vals.results[0]
      if (self._time_limit is not None) and (
          train_time > self._time_limit
      ):
          run_context.request_stop()
  
imports: import os
  import time
  from absl import logging
  from magenta.models.gansynth.lib import networks
  import numpy
  import tensorflow.compat.v1
  import tensorflow_gan
label_desc: Use image node_id 3 for calling the TrainTimeHook obj's underlying member method code with example usage: obj.after_run(run_context, vals) without return types