public abstract class Engine
extends java.lang.Object
Engine interface is the base of the provided implementation for DJL.
Any engine-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 |
|---|---|
static void |
debugEnvironment()
Prints debug information about the environment for debugging environment issues.
|
Device |
defaultDevice()
Returns the engine's default
Device. |
static java.util.Set<java.lang.String> |
getAllEngines()
Returns a set of engine names that are loaded.
|
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.
|
static Engine |
getInstance()
Returns the default Engine.
|
int |
getRank()
Return the rank of the
Engine. |
abstract java.lang.String |
getVersion()
Returns the version of the deep learning engine.
|
abstract boolean |
hasCapability(java.lang.String capability)
Returns whether the engine has the specified capability.
|
static boolean |
hasEngine(java.lang.String engineName)
Returns if the specified engine is available.
|
abstract NDManager |
newBaseManager()
Creates a new top-level
NDManager. |
abstract NDManager |
newBaseManager(Device device)
|
abstract GradientCollector |
newGradientCollector()
Returns a new instance of
GradientCollector. |
abstract Model |
newModel(java.lang.String name,
Device device)
Constructs a new model.
|
ParameterServer |
newParameterServer(Optimizer optimizer)
Returns a new instance of
ParameterServer. |
abstract void |
setRandomSeed(int seed)
Seeds the random number generator in DJL Engine.
|
public abstract java.lang.String getEngineName()
public int getRank()
Engine.public static Engine getInstance()
EngineEngineProviderpublic static boolean hasEngine(java.lang.String engineName)
engineName - the name of Engine to checktrue if the specified engine is availableEngineProviderpublic static java.util.Set<java.lang.String> getAllEngines()
public static Engine getEngine(java.lang.String engineName)
Engine with the given name.engineName - the name of Engine to retrieveEngineEngineProviderpublic abstract java.lang.String getVersion()
public abstract boolean hasCapability(java.lang.String capability)
capability - the capability to retrievetrue if the engine has the specified capabilitypublic Device defaultDevice()
Device.Devicepublic abstract Model newModel(java.lang.String name, Device device)
name - the model namedevice - the device that the model will be loaded ontopublic abstract NDManager newBaseManager()
NDManagerpublic abstract NDManager newBaseManager(Device device)
device - the default DeviceNDManagerpublic abstract GradientCollector newGradientCollector()
GradientCollector.GradientCollectorpublic ParameterServer newParameterServer(Optimizer optimizer)
ParameterServer.optimizer - the optimizer to updateParameterServerpublic abstract void setRandomSeed(int seed)
This will affect all Devices and all operators using Engine's random number
generator.
seed - the seed to be fixed in Enginepublic static void debugEnvironment()