code: def __init__(
      self,
      encoder_net: Optional[tf.keras.Model] = None,
      input_layer: Optional[
          Union[tf.keras.layers.Layer, tf.keras.Model]
      ] = None,
      shape: Optional[tuple] = None,
      enc_dim: Optional[int] = None,
  ) -> None:
      super().__init__()
      is_enc = isinstance(encoder_net, tf.keras.Model)
      is_enc_dim = isinstance(enc_dim, int)
      if is_enc:
          self.encoder = encoder_net
      elif not is_enc and is_enc_dim:  # set default encoder
          input_layer = (
              InputLayer(input_shape=shape)
              if input_layer is None
              else input_layer
          )
          input_dim = np.prod(shape)
          step_dim = int((input_dim - enc_dim) / 3)
          self.encoder = _Encoder(
              input_layer, enc_dim=enc_dim, step_dim=step_dim
          )
      elif not is_enc and not is_enc_dim:
          raise ValueError(
              "Need to provide either `enc_dim` or a tf.keras.Sequential"
              " or tf.keras.Model `encoder_net`."
          )
  
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 UAE object from inherited base classes: tf.keras with example: obj = UAE(encoder_net, input_layer, shape, enc_dim)