class_docstr: A class to load dataset for ranking task.
class_docstr_tok: ["A","class","to","load","dataset","for","ranking","task","."]
docstr: Decodes a serialized ELWC.
docstr_tok: ["Decodes","a","serialized","ELWC","."]
code: def _decode(self, record: tf.Tensor) -> Dict[str, tf.Tensor]:
      """Decodes a serialized ELWC."""
      parsing_example_feature_spec = self._example_feature_spec
      if self._label_spec:
          parsing_example_feature_spec.update(dict([self._label_spec]))
  
      parsing_fn = tfr_data.make_parsing_fn(
          self._params.data_format,
          self._params.list_size,
          self._context_feature_spec,
          parsing_example_feature_spec,
          mask_feature_name=self._params.mask_feature_name,
          shuffle_examples=self._params.shuffle_examples,
          seed=self._params.seed,
      )
  
      # The TF-Ranking parsing functions only takes batched ELWCs as input and
      # output a dictionary from feature names to Tensors with the shape of
      # (batch_size, list_size, feature_length).
      features = parsing_fn(tf.reshape(record, [1]))
  
      # Remove the first batch_size dimension and leave batching to DataLoader
      # class in construction of distributed data set.
      output_features = {
          name: tf.squeeze(tensor, 0)
          for name, tensor in features.items()
      }
  
      # ELWC only supports tf.int64, but the TPU only supports tf.int32.
      # So cast all int64 to int32.
      for name in output_features:
          t = output_features[name]
          if t.dtype == tf.int64:
              t = tf.cast(t, tf.int32)
          output_features[name] = t
  
      return output_features
  
imports: import dataclasses
  from typing import Callable, Dict, Mapping, Optional, Tuple, Union
  import tensorflow
  from tensorflow_ranking.python import data
  from tensorflow_ranking.python.keras import losses
  from tensorflow_ranking.python.keras import metrics
  from tensorflow_ranking.python.keras import model
label_desc: Use image node_id 2 for calling the RankingDataLoader obj's underlying member method code with example usage: obj._decode(record) and returns: output_features