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 |
---|---|
void |
debugEnvironment()
Logs debug information about the environment for use when debugging environment issues.
|
static java.util.Collection<Engine> |
getAllEngines()
Returns a Collection of engines 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.
|
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 static Engine getInstance()
Engine
EngineProvider
public static boolean hasEngine(java.lang.String engineName)
engineName
- the name of Engine to checktrue
if the specified engine is availableEngineProvider
public static java.util.Collection<Engine> getAllEngines()
Collection<Engine>
that are supportedpublic static Engine getEngine(java.lang.String engineName)
Engine
with the given name.engineName
- the name of Engine to retrieveEngine
EngineProvider
public 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 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()
NDManager
public abstract NDManager newBaseManager(Device device)
device
- the default Device
NDManager
public abstract GradientCollector newGradientCollector()
GradientCollector
.GradientCollector
public ParameterServer newParameterServer(Optimizer optimizer)
ParameterServer
.optimizer
- the optimizer to updateParameterServer
public abstract void setRandomSeed(int seed)
This will affect all Device
s and all operators using Engine's random number
generator.
seed
- the seed to be fixed in Enginepublic void debugEnvironment()