class_docstr: Preprocessing inputs with provided spec.
  
  Transformation including KPL or customized transformation like log1p can be
  defined and passed in `preprocess_spec` with the following example usage:
  
  ```python
  preprocess_spec = {
      **{name: lambda t: tf.math.log1p(t * tf.sign(t)) * tf.sign(t)
         for name in example_feature_spec.keys()},
      **{name: tf.reduce_mean(
          tf.keras.layers.Embedding(input_dim=10, output_dim=4)(x), axis=-2)
         for name in context_feature_spec.keys()}
  }
  preprocessor = PreprocessorWithSpec(preprocess_spec)
  ```
docstr: See `Preprocessor`.
docstr_tok: ["See","`","Preprocessor","`","."]
code: def __call__(
      self,
      context_inputs: TensorDict,
      example_inputs: TensorDict,
      mask: tf.Tensor,
  ) -> Tuple[TensorDict, TensorDict]:
      """See `Preprocessor`."""
      list_size = tf.shape(mask)[1]
  
      def apply_preprocess(key, value, is_example=False):
          """Applies the preprocessing spec and convert to tf.Tensor."""
          if key in self._preprocess_spec:
              value = self._preprocess_spec[key](value)
          if isinstance(value, tf.RaggedTensor):
              default_value = self._default_value_spec.get(key, 0.0)
              s = value.bounding_shape()
              new_shape = (
                  tf.concat([s[:1], [list_size], s[2:]], axis=0)
                  if is_example
                  else s
              )
              return value.to_tensor(default_value, shape=new_shape)
          else:
              return value
  
      context_features = {
          key: apply_preprocess(key, value)
          for key, value in context_inputs.items()
      }
      example_features = {
          key: apply_preprocess(key, value, True)
          for key, value in example_inputs.items()
      }
      return context_features, example_features
  
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 2 for calling the PreprocessorWithSpec obj's underlying member method code with example usage: obj.__call__(context_inputs, example_inputs, mask) and returns: context_features,  example_features, value, value