public final class Device
extends java.lang.Object
Device
class provides the specified assignment for CPU/GPU processing on the NDArray
.
Users can use this to specify whether to load/compute the NDArray
on CPU/GPU with
deviceType and deviceId provided.
Modifier and Type | Class and Description |
---|---|
static interface |
Device.Type
Contains device type string constants.
|
Modifier and Type | Method and Description |
---|---|
static Device |
cpu()
Returns the default CPU Device.
|
boolean |
equals(java.lang.Object o) |
int |
getDeviceId()
Returns the
deviceId of the Device. |
java.lang.String |
getDeviceType()
Returns the device type of the Device.
|
static Device |
gpu()
Returns the default GPU Device.
|
static Device |
gpu(int deviceId)
Returns a new instance of GPU
Device with the specified deviceId . |
int |
hashCode() |
boolean |
isGpu()
Returns if the
Device is GPU. |
static Device |
of(java.lang.String deviceType,
int deviceId)
Returns a
Device with device type and device id. |
java.lang.String |
toString() |
public static Device of(java.lang.String deviceType, int deviceId)
Device
with device type and device id.deviceType
- the device type, typically CPU or GPUdeviceId
- the deviceId on the hardware.Device
instancepublic java.lang.String getDeviceType()
public int getDeviceId()
deviceId
of the Device.deviceId
of the Devicepublic boolean isGpu()
Device
is GPU.Device
is GPU.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static Device cpu()
public static Device gpu()
public static Device gpu(int deviceId)
Device
with the specified deviceId
.deviceId
- the GPU device IDDevice
with specified deviceId