code: def update_stats(stats, start_time, step_result):
      """Update stats: write summary and accumulate statistics."""
      _, output_tuple = step_result
  
      # Update statistics
      batch_size = output_tuple.batch_size
      stats["step_time"] += time.time() - start_time
      stats["train_loss"] += output_tuple.train_loss * batch_size
      stats["grad_norm"] += output_tuple.grad_norm
      stats["predict_count"] += output_tuple.predict_count
      stats["word_count"] += output_tuple.word_count
      stats["sequence_count"] += batch_size
  
      return (
          output_tuple.global_step,
          output_tuple.learning_rate,
          output_tuple.train_summary,
          output_tuple.pruning_summary,
      )
  
imports: from __future__ import print_function
  import math
  import os
  import random
  import time
  import tensorflow
  from .None import inference, gnmt_model
  from .gnmt import attention_model, model
  from .gnmt import model_helper
  from .gnmt.utils import nmt_utils, misc_utils
label_desc: Use image node_id 8 for calling a global function with example usage: update_stats(stats, start_time, step_result) and returns: output_tuple,  output_tuple,  output_tuple,  output_tuple