public abstract class Engine
extends java.lang.Object
Engine interface is the base of the provided implementation for DJL.
Any framework-specific functionality should be provided through this class. In general, it
should contain methods to detect information about the usable machine hardware and to create a
new NDManager and Model.
EngineProvider| Constructor and Description |
|---|
Engine() |
| Modifier and Type | Method and Description |
|---|---|
abstract Device |
defaultDevice()
Returns the system's default device.
|
static Engine |
getEngine(java.lang.String engineName)
Returns the
Engine with the given name. |
abstract java.lang.String |
getEngineName()
Returns the name of the Engine.
|
abstract int |
getGpuCount()
Returns the number of GPUs available in the system.
|
abstract java.lang.management.MemoryUsage |
getGpuMemory(Device device)
Returns the
MemoryUsage of the specified GPU device. |
static Engine |
getInstance()
Returns the default Engine.
|
abstract java.lang.String |
getVersion()
Returns the version of the deep learning framework.
|
abstract NDManager |
newBaseManager()
Creates a new top-level
NDManager. |
abstract NDManager |
newBaseManager(Device device)
|
abstract Model |
newModel(Device device)
Constructs a new model.
|
public abstract java.lang.String getEngineName()
public static Engine getInstance()
EngineEngineProviderpublic static Engine getEngine(java.lang.String engineName)
Engine with the given name.engineName - the name of Engine to retrieveEngineEngineProviderpublic abstract int getGpuCount()
public abstract java.lang.management.MemoryUsage getGpuMemory(Device device)
MemoryUsage of the specified GPU device.device - the GPU Device to retrieveMemoryUsage of the specified GPU deviceEngineException - if operation is not supportedjava.lang.IllegalArgumentException - if Device is not GPU devicepublic abstract Device defaultDevice()
If the system has GPU available, then the default device is Device.gpu().
Otherwise, the default device returned is Device.cpu()
public abstract java.lang.String getVersion()
public abstract Model newModel(Device device)
device - the device that the model will be loaded ontopublic abstract NDManager newBaseManager()
NDManager