class_docstr: Interface to build a `tf.keras.Model` for ranking with a mask Tensor.
  
  The `ModelBuilderWithMask` class is an abstract class to build a ranking model
  based on dense Tensors and a mask Tensor to indicate the padded ones.
  All the boilerplate codes related to constructing a `tf.keras.Model` are
  integrated in the ModelBuilder class.
  
  To be implemented by subclasses:
  
    * `create_inputs()`: Contains the logic to create `tf.keras.Input` for
    context and example inputs and mask for valid list items.
    * `preprocess()`: Contains the logic to preprocess context and example
    inputs.
    * `score()`: Contains the logic to score examples in list and return
    outputs.
  
  Example subclass implementation:
  
  ```python
  class SimpleModelBuilder(ModelBuilderWithMask):
  
    def __init__(self, context_feature_spec, example_feature_spec,
                 mask_feature_name, name=None):
      self._context_feature_spec = context_feature_spec
      self._example_feature_spec = example_feature_spec
      self._mask_feature_name = mask_feature_name
      self._name = name
  
    def create_inputs(self):
      context_inputs = {
          name: tf.keras.Input(
              shape=tuple(spec.shape),
              name=name,
              dtype=spec.dtype
          ) for name, spec in self._context_feature_spec.items()
      }
      example_inputs = {
          name: tf.keras.Input(
              shape=(None,) + tuple(spec.shape),
              name=name,
              dtype=spec.dtype
          ) for name, spec in self._example_feature_spec.items()
      }
      mask = tf.keras.Input(
          name=self._mask_feature_name, shape=(None,), dtype=tf.bool)
      return context_inputs, example_inputs, mask
  
    def preprocess(self, context_inputs, example_inputs, mask):
      context_features = {
          name: tf.math.log1p(
              tf.abs(tensor)) for name, tensor in context_inputs.items()
      }
      example_features = {
          name: tf.math.log1p(
              tf.abs(tensor)) for name, tensor in example_inputs.items()
      }
      return context_features, example_features
  
    def score(self, context_features, example_features, mask):
      x = tf.concat([tensor for tensor in example_features.values()], -1)
      return tf.keras.layers.Dense(1)(x)
  ```
docstr: Builds a Keras Model for Ranking Pipeline.
  
  Example usage:
  
  ```python
  model_builder = SimpleModelBuilder(
      {},
      {"example_feature_1": tf.io.FixedLenFeature(
          shape=(1,), dtype=tf.float32, default_value=0.0)},
      "list_mask", "model_builder")
  model = model_builder.build()
  ```
  
  Returns:
    A `tf.keras.Model`.
docstr_tok: ["Builds","a","Keras","Model","for","Ranking","Pipeline",".","Example","usage",":","``","`","python","model_builder","=","SimpleModelBuilder","(","{","}",",","{","``","example_feature_1","''",":","tf.io.FixedLenFeature","(","shape=","(","1",",",")",",","dtype=tf.float32",",","default_value=0.0",")","}",",","``","list_mask","''",",","``","model_builder","''",")","model","=","model_builder.build","(",")","``","`","Returns",":","A","`","tf.keras.Model","`","."]
code: def build(self) -> tf.keras.Model:
      """Builds a Keras Model for Ranking Pipeline.
  
      Example usage:
  
      ```python
      model_builder = SimpleModelBuilder(
          {},
          {"example_feature_1": tf.io.FixedLenFeature(
              shape=(1,), dtype=tf.float32, default_value=0.0)},
          "list_mask", "model_builder")
      model = model_builder.build()
      ```
  
      Returns:
        A `tf.keras.Model`.
      """
      context_inputs, example_inputs, mask = self.create_inputs()
      logging.info("Context features: %s", context_inputs)
      logging.info("Example features: %s", example_inputs)
      context_features, example_features = self.preprocess(
          context_inputs, example_inputs, mask
      )
      outputs = self.score(context_features, example_features, mask)
      return tf.keras.Model(
          inputs=dict(
              list(context_inputs.items())
              + list(example_inputs.items())
              + [(self._mask_feature_name, mask)]
          ),
          outputs=outputs,
          name=self._name,
      )
  
imports: import abc
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from absl import logging
  import tensorflow
  from tensorflow_ranking.python.keras import feature
  from tensorflow_ranking.python.keras import layers
label_desc: Use image node_id 5 for calling the ModelBuilderWithMask obj's underlying member method code with example usage: obj.build() and returns: tf