public abstract class Engine
extends java.lang.Object
| 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.
|
abstract Engine |
getAlternativeEngine()
Returns the alternative
engine if available. |
static java.lang.String |
getDefaultEngineName()
Returns the default Engine name.
|
Device[] |
getDevices()
Returns an array of devices.
|
Device[] |
getDevices(int maxGpus)
Returns an array of devices given the maximum number of GPUs to use.
|
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.
|
int |
getGpuCount()
Returns the number of GPUs available in the system.
|
static Engine |
getInstance()
Returns the default Engine.
|
abstract int |
getRank()
Return the rank of the
Engine. |
java.lang.Integer |
getSeed()
Returns the random seed in DJL 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 SymbolBlock |
newSymbolBlock(NDManager manager)
Construct an empty SymbolBlock for loading.
|
void |
setRandomSeed(int seed)
Seeds the random number generator in DJL Engine.
|
public abstract Engine getAlternativeEngine()
engine if available.enginepublic abstract java.lang.String getEngineName()
public abstract int getRank()
Engine.public static java.lang.String getDefaultEngineName()
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 Device[] getDevices()
If GPUs are available, it will return an array of Device of size
\(min(numAvailable, maxGpus)\). Else, it will return an array with a single CPU device.
public Device[] getDevices(int maxGpus)
If GPUs are available, it will return an array of Device of size
\(min(numAvailable, maxGpus)\). Else, it will return an array with a single CPU device.
maxGpus - the max number of GPUs to use. Use 0 for no GPUs.public int getGpuCount()
public abstract SymbolBlock newSymbolBlock(NDManager manager)
manager - the manager to manage parametersSymbolBlock for static graphpublic 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 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 java.lang.Integer getSeed()
public static void debugEnvironment()