code: def _tensor_to_frontend_dtype(
      x: Union[torch.Tensor, np.ndarray, float]
  ) -> Union[np.ndarray, float]:
      if isinstance(x, torch.Tensor):
          x = x.cpu().detach().numpy()
      if isinstance(x, np.ndarray) and x.ndim == 0:
          x = x.item()
      return 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 1 for calling a global function with example usage: _tensor_to_frontend_dtype(x) and returns: x