code: def fetch_ad_ae(
      url: str, filepath: Union[str, os.PathLike], state_dict: dict
  ) -> None:
      """
      Download AE adversarial detector.
  
      Parameters
      ----------
      url
          URL to fetch detector from.
      filepath
          Local directory to save detector to.
      state_dict
          Dictionary containing the detector's parameters.
      """
      fetch_enc_dec(url, filepath)
      url_models = _join_url(url, "model")
      model_path = Path(filepath).joinpath("model").resolve()
      tf.keras.utils.get_file(
          model_path.joinpath("model.h5"),
          _join_url(url_models, "model.h5"),
      )
      tf.keras.utils.get_file(
          model_path.joinpath("checkpoint"),
          _join_url(url_models, "checkpoint"),
      )
      tf.keras.utils.get_file(
          model_path.joinpath("ae.ckpt.index"),
          _join_url(url_models, "ae.ckpt.index"),
      )
      tf.keras.utils.get_file(
          model_path.joinpath("ae.ckpt.data-00000-of-00002"),
          _join_url(url_models, "ae.ckpt.data-00000-of-00002"),
      )
      tf.keras.utils.get_file(
          model_path.joinpath("ae.ckpt.data-00001-of-00002"),
          _join_url(url_models, "ae.ckpt.data-00001-of-00002"),
      )
      hidden_layer_kld = state_dict["hidden_layer_kld"]
      if hidden_layer_kld:
          for i, (_, _) in enumerate(hidden_layer_kld.items()):
              hl = "model_hl_" + str(i)
              tf.keras.utils.get_file(
                  model_path.joinpath(hl + ".ckpt.index"),
                  _join_url(url_models, hl + ".ckpt.index"),
              )
              tf.keras.utils.get_file(
                  model_path.joinpath(hl + ".ckpt.data-00000-of-00002"),
                  _join_url(
                      url_models, hl + ".ckpt.data-00000-of-00002"
                  ),
              )
              tf.keras.utils.get_file(
                  model_path.joinpath(hl + ".ckpt.data-00001-of-00002"),
                  _join_url(
                      url_models, hl + ".ckpt.data-00001-of-00002"
                  ),
              )
  
imports: import logging
  import os
  from io import BytesIO
  from pathlib import Path
  from typing import Union, TYPE_CHECKING, Tuple
  import dill
  import requests
  from requests import RequestException
  import tensorflow
  from tensorflow.python.keras import backend
  from alibi_detect.models.tensorflow import PixelCNN
  from alibi_detect.saving import load_detector
  from alibi_detect.utils.url import _join_url
label_desc: Use image node_id 5 for calling a global function with example usage: fetch_ad_ae(url, filepath, state_dict) without return types