code: def __init__(
      self,
      input_layer: Union[tf.keras.layers.Layer, tf.keras.Model],
      mlp: Optional[tf.keras.Model] = None,
      enc_dim: Optional[int] = None,
      step_dim: Optional[int] = None,
  ) -> None:
      super().__init__()
      self.input_layer = input_layer
      if isinstance(mlp, tf.keras.Model):
          self.mlp = mlp
      elif isinstance(enc_dim, int) and isinstance(step_dim, int):
          self.mlp = tf.keras.Sequential(
              [
                  Flatten(),
                  Dense(enc_dim + 2 * step_dim, activation=tf.nn.relu),
                  Dense(enc_dim + step_dim, activation=tf.nn.relu),
                  Dense(enc_dim, activation=None),
              ]
          )
      else:
          raise ValueError(
              "Need to provide either `enc_dim` and `step_dim` or a "
              "tf.keras.Sequential or tf.keras.Model `mlp`"
          )
  
file_path: alibi-detect/alibi_detect/cd/tensorflow/preprocess.py
imports: from typing import Callable, Dict, Optional, Type, Union
  import numpy
  import tensorflow
  from alibi_detect.utils.tensorflow.prediction import predict_batch, predict_batch_transformer
  from tensorflow.keras.layers import Dense, Flatten, Input, InputLayer
  from tensorflow.keras.models import Model
label_desc: Use image node_id 1 to create a new _Encoder object from inherited base classes: tf.keras with example: obj = _Encoder(input_layer, mlp, enc_dim, step_dim)