class_docstr: The implement of DialogReader.
docstr: Padding batch records and construct model's inputs.
docstr_tok: ["Padding","batch","records","and","construct","model","'s","inputs","."]
code: def _pad_batch_records(self, batch_records, is_infer):
      """
      Padding batch records and construct model's inputs.
      """
      batch_size = len(batch_records)
      batch = {}
      batch_token_ids = [record.token_ids for record in batch_records]
      batch_type_ids = [record.type_ids for record in batch_records]
      batch_pos_ids = [record.pos_ids for record in batch_records]
      batch["token_ids"] = pad_batch_data(
          batch_token_ids, pad_id=self.pad_id
      )
      batch["type_ids"] = pad_batch_data(
          batch_type_ids, pad_id=self.pad_id
      )
      batch["pos_ids"] = pad_batch_data(
          batch_pos_ids, pad_id=self.pad_id
      )
  
      batch_tgt_start_idx = [
          record.tgt_start_idx for record in batch_records
      ]
      batch["generation_mask"] = self._gen_self_attn_mask(
          batch_token_ids, batch_tgt_start_idx=batch_tgt_start_idx
      )
  
      if is_infer:
          tgt_ids = np.array(
              [[[self.bos_id]]] * len(batch_token_ids), dtype="int64"
          )
          if self.continuous_position:
              tgt_pos = np.array(batch_tgt_start_idx, dtype="int64")
          else:
              tgt_pos = np.zeros_like(
                  batch_tgt_start_idx, dtype="int64"
              )
          tgt_pos = tgt_pos.reshape(-1, 1, 1)
          batch["init_score"] = (
              np.zeros_like(tgt_ids, dtype="float32")
              .reshape(-1, 1)
              .tolist()
          )
          batch["tgt_ids"] = tgt_ids.tolist()
          batch["tgt_pos"] = tgt_pos.tolist()
  
          batch["tgt_generation_mask"] = batch["generation_mask"][
              :, 0:1, :
          ].astype("float32")
      else:
          batch["tgt_label"], batch["tgt_pos"] = mask(
              batch_tokens=batch_token_ids,
              vocab_size=self.vocab_size,
              sent_b_starts=batch_tgt_start_idx,
              is_unidirectional=True,
          )
  
      batch_data_id = [record.data_id for record in batch_records]
      batch["data_id"] = (
          np.array(batch_data_id).astype("int64").reshape([-1, 1])
      )
      return batch
  
imports: import csv
  from collections import namedtuple
  from contextlib import contextmanager
  import gzip
  import numpy
  from ..utils import pad_batch_data
  from ..utils.args import str2bool
  from ..utils.masking import mask
  from ..utils import tokenization
label_desc: Use image node_id 13 for calling the DialogReader obj's underlying member method code with example usage: obj._pad_batch_records(batch_records, is_infer) and returns: batch