public class LocalParameterServer extends java.lang.Object implements ParameterServer
LocalParameterServer
is an implementation of the ParameterServer
interface.Constructor and Description |
---|
LocalParameterServer(Optimizer optimizer)
Create a new instance of
LocalParameterServer for the given optimizer. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
init(java.lang.String parameterId,
NDArray[] value)
Initializes the
ParameterStore for the given parameter. |
void |
pull(java.lang.String parameterId,
NDArray[] weights,
int priority)
Pulls the value of a key from Parameter Server to NDArrays.
|
void |
push(java.lang.String parameterId,
NDArray[] grads,
int priority)
Updates values of a key in Parameter Server.
|
public LocalParameterServer(Optimizer optimizer)
LocalParameterServer
for the given optimizer.optimizer
- an optimizerpublic void init(java.lang.String parameterId, NDArray[] value)
ParameterStore
for the given parameter.init
in interface ParameterServer
parameterId
- the parameter IDvalue
- the values to be set for the given parameterpublic void push(java.lang.String parameterId, NDArray[] grads, int priority)
push
in interface ParameterServer
parameterId
- the key to updategrads
- the values corresponding to the key, values in array will be summed when key is
updatedpriority
- the priority of the push operation. Higher priority push operations are
likely to be executed before other push actionspublic void pull(java.lang.String parameterId, NDArray[] weights, int priority)
pull
in interface ParameterServer
parameterId
- the key to pullweights
- the NDArrays to store the value corresponding to the key, value will be copied
to the devices of the NDArrayspriority
- the priority of the push operation. Higher priority push operations are
likely to be executed before other push actionspublic void close()
close
in interface ParameterServer
close
in interface java.lang.AutoCloseable