code: def _array_to_new_backend(
      x: Union[ivy.Array, ivy.NativeArray], native: bool = False
  ) -> Union[ivy.Array, ivy.NativeArray]:
      # Frontend instances
      if hasattr(x, "_ivy_array"):
          return x
  
      # ivy.Array instances
      native_x = x.data if isinstance(x, ivy.Array) else x
      native_x_type = type(native_x).__name__
  
      # Modify native_type here since @tf.function converts tf.EagerTensor into
      # tf.Tensor when running @tf.function enclosed function
      if ivy.backend == "tensorflow":
          import tensorflow as tf
  
          native_x_type = (
              "EagerTensor"
              if not tf.executing_eagerly()
              and isinstance(native_x, tf.Tensor)
              else native_x_type
          )
  
      if native_x_type not in ARRAY_TO_BACKEND:
          return x
  
      # Check if the other possible backends match with the native data type
      native_x_backend = ARRAY_TO_BACKEND[native_x_type]
  
      # Handle the `Tensor` name clash in paddle and torch
      if not isinstance(native_x_backend, str):
          native_x_backend = (
              "torch"
              if "torch" in str(native_x.__class__)
              else "paddle"
          )
  
      # If the current backend and the backend for the given array match,
      # simply return the array as is
      if ivy.backend == native_x_backend:
          if native:
              return native_x
          np_intermediary = ivy.to_numpy(native_x)
          return ivy.array(np_intermediary)
  
      # Otherwise, convert to the new backend
      else:
          native_x_backend = ivy.with_backend(native_x_backend)
          # Handle native variable instances here
          if native_x_backend.gradients._is_variable(native_x):
              x_data = native_x_backend.gradients._variable_data(
                  native_x
              )
              # x_data = _array_to_new_backend(x_data, native=True)
              from ivy.functional.ivy.gradients import _variable
  
              return (
                  _variable(x_data).data
                  if native
                  else _variable(x_data)
              )
  
          np_intermediary = native_x_backend.to_numpy(native_x)
          ret = ivy.array(np_intermediary)
          return ret.data if native else ret
  
file_path: ivy/ivy/data_classes/array/conversions.py
imports: import numpy
  from typing import Any, Union, Tuple, Dict, Iterable, Optional
  import ivy
label_desc: Use image node_id 1 for calling a global function with example usage: _array_to_new_backend(x, native) and returns: x, x, ivy, unknown, native_x, unknown