code: def to_device(
      x: Union[tf.Tensor, tf.Variable],
      device: str,
      /,
      *,
      stream: Optional[int] = None,
      out: Optional[Union[tf.Tensor, tf.Variable]] = None,
  ) -> Union[tf.Tensor, tf.Variable]:
      if device is None:
          return x
      device = as_native_dev(device)
      current_dev = dev(x)
      if not _same_device(current_dev, device):
          with tf.device(f"/{device.upper()}"):
              return tf.identity(x)
      return x
  
imports: import tensorflow
  from typing import Union, Optional
  import ivy
  from ivy.functional.ivy.device import Profiler
label_desc: Use image node_id 3 for calling a global function with example usage: to_device() and returns: x, x, tf