code: def array(source_array, ctx=None, dtype=None):
      """Creates an array from any object exposing the array interface.
  
      Parameters
      ----------
      source_array : array_like
          An object exposing the array interface, an object whose `__array__`
          method returns an array, or any (nested) sequence.
      ctx : Context, optional
          Device context (default is the current default context).
      dtype : str or numpy.dtype, optional
          The data type of the output array. The default dtype is ``source_array.dtype``
          if `source_array` is an `NDArray`, `float32` otherwise.
  
      Returns
      -------
      NDArray, RowSparseNDArray or CSRNDArray
          An array with the same contents as the `source_array`.
  
      Examples
      --------
      >>> import numpy as np
      >>> mx.nd.array([1, 2, 3])
      <NDArray 3 @cpu(0)>
      >>> mx.nd.array([[1, 2], [3, 4]])
      <NDArray 2x2 @cpu(0)>
      >>> mx.nd.array(np.zeros((3, 2)))
      <NDArray 3x2 @cpu(0)>
      >>> mx.nd.array(np.zeros((3, 2)), mx.gpu(0))
      <NDArray 3x2 @gpu(0)>
      >>> mx.nd.array(mx.nd.zeros((3, 2), stype='row_sparse'))
      <RowSparseNDArray 3x2 @cpu(0)>
      """
      if spsp is not None and isinstance(
          source_array, spsp.csr.csr_matrix
      ):
          return _sparse_array(source_array, ctx=ctx, dtype=dtype)
      elif (
          isinstance(source_array, NDArray)
          and source_array.stype != "default"
      ):
          return _sparse_array(source_array, ctx=ctx, dtype=dtype)
      else:
          return _array(source_array, ctx=ctx, dtype=dtype)
  
file_path: mxnet/python/mxnet/ndarray/utils.py
imports: import ctypes
  from ..base import _LIB, check_call, py_str, c_str, string_types, mx_uint, NDArrayHandle
  from ..base import c_array, c_handle_array, c_str_array
  from .ndarray import NDArray
  from .ndarray import array
  from .ndarray import empty
  from .ndarray import zeros
  from .sparse import zeros
  from .sparse import empty
  from .sparse import array
  from .sparse import _ndarray_cls
label_desc: Use image node_id 3 for calling a global function with example usage: array(source_array, ctx, dtype) and returns: _sparse_array, _sparse_array, _array