code: def _make_smaller_batch_filter_fn(batch_size):
      """Returns a predicate function which takes in a batched data
      and returns a bool indicating whether the batch is of :attr:`batch_size`.
      """
  
      def _filter_fn(data):
          if isinstance(data, (list, tuple)):
              return _filter_fn(data[0])
          elif isinstance(data, dict):
              return _filter_fn(data[next(iter(data))])
          else:
              return tf.equal(tf.shape(data)[0], batch_size)
  
      return _filter_fn
  
imports: import six
  import tensorflow
  import numpy
  from texar.tf.utils import utils
label_desc: Use image node_id 2 for calling a global function with example usage: _make_smaller_batch_filter_fn(batch_size) and returns: _filter_fn, _filter_fn, _filter_fn, tf