code: def to_frontend_dtype(
      x: Union[torch.Tensor, TorchOutlierDetectorOutput]
  ) -> Union[np.ndarray, Dict[str, np.ndarray]]:
      """Converts any `torch` tensors found in input to `numpy` arrays.
  
      Takes a `torch` tensor or `TorchOutlierDetectorOutput` and converts any `torch` tensors found to `numpy` arrays
  
      Parameters
      ----------
      x
          Data to convert.
  
      Returns
      -------
      `np.ndarray` or dictionary of containing `numpy` arrays
      """
  
      return {
          "TorchOutlierDetectorOutput": lambda x: x.to_frontend_dtype(),
          "Tensor": _tensor_to_frontend_dtype,
      }.get(x.__class__.__name__, _raise_type_error)(x)
  
imports: from typing import List, Union, Optional, Dict
  from dataclasses import dataclass, fields
  from abc import ABC, abstractmethod
  import numpy
  import torch
  from alibi_detect.od.pytorch.ensemble import FitMixinTorch
  from alibi_detect.utils.pytorch.misc import get_device
  from alibi_detect.exceptions import ThresholdNotInferredError
  from alibi_detect.utils._types import TorchDeviceType
label_desc: Use image node_id 3 for calling a global function with example usage: to_frontend_dtype(x) and returns: dict