class_docstr: A class to load dataset for TFR-BERT task.
class_docstr_tok: ["A","class","to","load","dataset","for","TFR-BERT","task","."]
code: def __init__(
      self,
      params,
      label_spec: Tuple[str, tf.io.FixedLenFeature] = None,
      **kwargs,
  ):
      context_feature_spec = {}
      example_feature_spec = {
          "input_ids": tf.io.FixedLenFeature(
              shape=(params.seq_length,),
              dtype=tf.int64,
              default_value=[0] * params.seq_length,
          ),
          "input_mask": tf.io.FixedLenFeature(
              shape=(params.seq_length,),
              dtype=tf.int64,
              default_value=[0] * params.seq_length,
          ),
          "segment_ids": tf.io.FixedLenFeature(
              shape=(params.seq_length,),
              dtype=tf.int64,
              default_value=[0] * params.seq_length,
          ),
      }
      if params.read_query_id:
          example_feature_spec.update(
              {
                  QUERY_ID: tf.io.FixedLenFeature(
                      shape=(1,), dtype=tf.int64, default_value=-1
                  )
              }
          )
      if params.read_document_id:
          example_feature_spec.update(
              {
                  DOCUMENT_ID: tf.io.FixedLenFeature(
                      shape=(1,), dtype=tf.int64, default_value=-1
                  )
              }
          )
  
      super().__init__(
          params=params,
          context_feature_spec=context_feature_spec,
          example_feature_spec=example_feature_spec,
          label_spec=label_spec,
          **kwargs,
      )
  
imports: import dataclasses
  import os
  import time
  from typing import Dict, Mapping, Optional, Tuple
  from absl import logging
  import numpy
  import tensorflow
  from official.core import task_factory
  from official.modeling.hyperparams import base_config
  from official.nlp.configs import encoders
  from tensorflow_ranking.extension import task
  from tensorflow_ranking.python.keras import metrics
  from tensorflow_ranking.python.keras import model
label_desc: Use image node_id 1 to create a new TFRBertDataLoader object from inherited base classes: tfr_task with example: obj = TFRBertDataLoader(params, label_spec)