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: Initializes the instance.
  
  Args:
    mask_feature_name: name of 2D mask boolean feature.
    name: (optional) name of the Model.
docstr_tok: ["Initializes","the","instance",".","Args",":","mask_feature_name",":","name","of","2D","mask","boolean","feature",".","name",":","(","optional",")","name","of","the","Model","."]
code: def __init__(
      self, mask_feature_name: str, name: Optional[str] = None
  ):
      """Initializes the instance.
  
      Args:
        mask_feature_name: name of 2D mask boolean feature.
        name: (optional) name of the Model.
      """
      self._mask_feature_name = mask_feature_name
      self._name = name
      if self._mask_feature_name is None:
          raise ValueError("mask_feature_name cannot be None.")
  
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 1 to create a new ModelBuilderWithMask object from inherited base classes: AbstractModelBuilder with example: obj = ModelBuilderWithMask(mask_feature_name, name)