code: def _decode_batch_input_fn(num_decode_batches, sorted_inputs, vocabulary,
                             batch_size, max_input_size,
                             task_id=-1, has_input=True):
    
    tf.logging.info(" batch %d" % num_decode_batches)
    for b in range(num_decode_batches):
      tf.logging.info("Decoding batch %d" % b)
      batch_length = 0
      batch_inputs = []
      for inputs in sorted_inputs[b * batch_size:(b + 1) * batch_size]:
        input_ids = vocabulary.encode(inputs)
        if max_input_size > 0:
          # Subtract 1 for the EOS_ID.
          input_ids = input_ids[:max_input_size - 1]
        if has_input or task_id > -1:  # Do not append EOS for pure LM tasks.
          final_id = text_encoder.EOS_ID if task_id < 0 else task_id
          input_ids.append(final_id)
        batch_inputs.append(input_ids)
        if len(input_ids) > batch_length:
          batch_length = len(input_ids)
      final_batch_inputs = []
      for input_ids in batch_inputs:
        assert len(input_ids) <= batch_length
        x = input_ids + [0] * (batch_length - len(input_ids))
        final_batch_inputs.append(x)
  
      yield {
          "inputs": np.array(final_batch_inputs).astype(np.int32),
      }
docs: Generator to produce batches of inputs.