def auto_device(obj, stream=0, copy=True):
 if _driver.is_device_memory(obj):
  return (obj, False)
 else:
  sentry_contiguous(obj)
  if isinstance(obj, np.void):
   devobj = from_record_like(obj, stream=stream)
  else:
   devobj = from_array_like(obj, stream=stream)
  if copy:
   devobj.copy_to_device(obj, stream=stream)
  return (devobj, True)

def auto_device ( obj , stream = 0 , copy = True ) : if _driver . is_device_memory ( obj ) : return ( obj , False ) else : sentry_contiguous ( obj ) if isinstance ( obj , np . void ) : devobj = from_record_like ( obj , stream = stream ) else : devobj = from_array_like ( obj , stream = stream ) if copy : devobj . copy_to_device ( obj , stream = stream ) return ( devobj , True )
create a devicerecord or devicearray like obj and optionally copy data from host to device .