def get_device(*args):
 for arg in args:
  if (type(arg) in _integer_types):
   check_cuda_available()
   return Device(arg)
  if isinstance(arg, ndarray):
   if (arg.device is None):
    continue
   return arg.device
  if (available and isinstance(arg, Device)):
   return arg
 return DummyDevice

def get_device ( * args ) : for arg in args : if ( type ( arg ) in _integer_types ) : check_cuda_available ( ) return Device ( arg ) if isinstance ( arg , ndarray ) : if ( arg . device is None ) : continue return arg . device if ( available and isinstance ( arg , Device ) ) : return arg return DummyDevice
gets the device from a device object .