code: def to_device(
      x: Union[ivy.Array, ivy.NativeArray],
      device: Union[ivy.Device, ivy.NativeDevice],
      /,
      *,
      stream: Optional[Union[int, Any]] = None,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Move the input array x to the desired device, specified by device
      string.
  
      Parameters
      ----------
      x
          input array to be moved to the desired device
      device
          device to move the input array `x` to
      stream
          stream object to use during copy. In addition to the types supported in
          array.__dlpack__(), implementations may choose to support any library-specific
          stream object with the caveat that any code using such an object would not be
          portable.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          input array x placed on the desired device
  
      Examples
      --------
      >>> x = ivy.array([1., 2., 3.])
      >>> x = ivy.to_device(x, 'cpu')
      >>> print(x.device)
      cpu
      """
      return ivy.current_backend(x).to_device(
          x, device, stream=stream, out=out
      )
  
imports: import os
  import gc
  import abc
  import math
  import psutil
  import warnings
  import types
  from typing import Type, Optional, Tuple
  from typing import Union, Callable, Iterable, Any
  import ivy
  from ivy.func_wrapper import handle_out_argument, to_native_arrays_and_back, inputs_to_native_arrays, handle_nestable, handle_array_like_without_promotion, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 24 for calling a global function with example usage: to_device() and returns: ivy