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: Initializes the instance.
  
  Args:
    preprocess_spec: maps a feature key to a callable to preprocess a feature.
      Only include those features that need preprocessing.
    default_value_spec: maps a feature key to a default value to convert a
      RaggedTensor to Tensor. Default to 0. if not specified.
docstr_tok: ["Initializes","the","instance",".","Args",":","preprocess_spec",":","maps","a","feature","key","to","a","callable","to","preprocess","a","feature",".","Only","include","those","features","that","need","preprocessing",".","default_value_spec",":","maps","a","feature","key","to","a","default","value","to","convert","a","RaggedTensor","to","Tensor",".","Default","to","0.","if","not","specified","."]
code: def __init__(
      self,
      preprocess_spec: Optional[Dict[str, Callable[[Any], Any]]] = None,
      default_value_spec: Optional[Dict[str, float]] = None,
  ):
      """Initializes the instance.
  
      Args:
        preprocess_spec: maps a feature key to a callable to preprocess a feature.
          Only include those features that need preprocessing.
        default_value_spec: maps a feature key to a default value to convert a
          RaggedTensor to Tensor. Default to 0. if not specified.
      """
      self._preprocess_spec = preprocess_spec or {}
      self._default_value_spec = default_value_spec or {}
  
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 PreprocessorWithSpec object from inherited base classes: Preprocessor with example: obj = PreprocessorWithSpec(preprocess_spec, default_value_spec)