parameters: (obj, stream=0, copy=True)
docstring: Create a DeviceRecord or DeviceArray like obj and optionally copy data from
      host to device. If obj already represents device memory, it is returned and
      no copy is made.
docstring_summary: Create a DeviceRecord or DeviceArray like obj and optionally copy data from
      host to device. If obj already represents device memory, it is returned and
      no copy is made.
docstring_tokens: Create a DeviceRecord or DeviceArray like obj and optionally copy data from host to device . If obj already represents device memory it is returned and no copy is made .
function: def auto_device(obj, stream=0, copy=True):
      """
      Create a DeviceRecord or DeviceArray like obj and optionally copy data from
      host to device. If obj already represents device memory, it is returned and
      no copy is made.
      """
      if _driver.is_device_memory(obj):
          return obj, False
      elif hasattr(obj, '__cuda_array_interface__'):
          return numba.cuda.as_cuda_array(obj), False
      else:
          if isinstance(obj, np.void):
              devobj = from_record_like(obj, stream=stream)
          else:
              # This allows you to pass non-array objects like constants
              # and objects implementing the
              # [array interface](https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.interface.html)
              # into this function (with no overhead -- copies -- for `obj`s
              # that are already `ndarray`s.
              obj = np.array(
                  obj,
                  copy=False,
                  subok=True)
              sentry_contiguous(obj)
              devobj = from_array_like(obj, stream=stream)
          if copy:
              devobj.copy_to_device(obj, stream=stream)
          return devobj, True
function_tokens: def auto_device ( obj , stream = 0 , copy = True ) : if _driver . is_device_memory ( obj ) : return obj , False elif hasattr ( obj , '__cuda_array_interface__' ) : return numba . cuda . as_cuda_array ( obj ) , False else : if isinstance ( obj , np . void ) : devobj = from_record_like ( obj , stream = stream ) else : # This allows you to pass non-array objects like constants # and objects implementing the # [array interface](https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.interface.html) # into this function (with no overhead -- copies -- for `obj`s # that are already `ndarray`s. obj = np . array ( obj , copy = False , subok = True ) sentry_contiguous ( obj ) devobj = from_array_like ( obj , stream = stream ) if copy : devobj . copy_to_device ( obj , stream = stream ) return devobj , True