code: def batch_size_fn(new, count, size_so_far):
      max_src_in_batch, max_tgt_in_batch = 0, 0
      max_src_in_batch = max(max_src_in_batch, len(new[0] + 1))
      max_tgt_in_batch = max(max_tgt_in_batch, len(new[1] + 1))
      src_elements = count * max_src_in_batch
      tgt_elements = count * max_tgt_in_batch
      return max(src_elements, tgt_elements)
  
file_path: texar/examples/transformer/utils/utils.py
imports: import random
  import math
  import logging
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: batch_size_fn(new, count, size_so_far) and returns: max