Package ai.djl.training
Class LocalParameterServer
- java.lang.Object
-
- ai.djl.training.LocalParameterServer
-
- All Implemented Interfaces:
ParameterServer,java.lang.AutoCloseable
public class LocalParameterServer extends java.lang.Object implements ParameterServer
LocalParameterServeris an implementation of theParameterServerinterface.
-
-
Constructor Summary
Constructors Constructor Description LocalParameterServer(Optimizer optimizer)Create a new instance ofLocalParameterServerfor the given optimizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidinit(java.lang.String parameterId, NDArray[] value)Initializes theParameterStorefor the given parameter.voidupdate(java.lang.String parameterId, NDArray[] grads, NDArray[] params)Updates the parameter of a key from Parameter Server.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ai.djl.training.ParameterServer
update
-
-
-
-
Constructor Detail
-
LocalParameterServer
public LocalParameterServer(Optimizer optimizer)
Create a new instance ofLocalParameterServerfor the given optimizer.- Parameters:
optimizer- an optimizer
-
-
Method Detail
-
init
public void init(java.lang.String parameterId, NDArray[] value)Initializes theParameterStorefor the given parameter.- Specified by:
initin interfaceParameterServer- Parameters:
parameterId- the parameter IDvalue- the values to be set for the given parameter
-
update
public void update(java.lang.String parameterId, NDArray[] grads, NDArray[] params)Updates the parameter of a key from Parameter Server.- Specified by:
updatein interfaceParameterServer- Parameters:
parameterId- the key to identify the parametergrads- the gradient NDArrays in different devices to apply the update.params- the parameter NDArrays in different devices to be updated.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceParameterServer
-
-