code: def convert_to_numpy(x):
      def transform(x):
          if is_tensor(x):
              if x.requires_grad:
                  x = x.detach()
              # Tensor has to be moved to CPU before converting to numpy.
              if x.is_cuda or x.is_mps:
                  x = x.cpu()
          return np.array(x)
  
      if isinstance(x, (list, tuple)):
          return np.array([transform(e) for e in x])
      return transform(x)
  
imports: import contextlib
  import os
  import numpy
  import torch
  import tree
  from keras.backend.common import KerasVariable
  from keras.backend.common import global_state
  from keras.backend.common import standardize_dtype
  from keras.backend.common.dtypes import result_type
  from keras.backend.common.keras_tensor import KerasTensor
  from keras.backend.common.stateless_scope import StatelessScope
  from keras.backend.config import floatx
  from keras.utils.nest import pack_sequence_as
label_desc: Use image node_id 6 for calling a global function with example usage: convert_to_numpy(x) and returns: transform, np, np