Package ai.djl.training
Class ParameterStore
java.lang.Object
ai.djl.training.ParameterStore
The
ParameterStore contains a map from a parameter to the mirrors of it on other devices.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newParameterStoreinstance.ParameterStore(NDManager manager, boolean copy) Constructs an emptyParameterStore. -
Method Summary
Modifier and TypeMethodDescriptionGet theNDManagerassociated withParameterStore.Returns the value of a mirrored parameter on a device.voidsetParameterServer(ParameterServer parameterServer, Device[] devices) Sets the parameterServer used to apply updates to the parameters.voidsync()Synchronizes the values on all mirrors with the main parameter.voidUpdates all the mirrored parameters.
-
Constructor Details
-
ParameterStore
public ParameterStore()Constructs a newParameterStoreinstance. -
ParameterStore
Constructs an emptyParameterStore.- Parameters:
manager- the manager to attach mirrored parameters tocopy- whether to always copy even for the same device as the original parameter
-
-
Method Details
-
setParameterServer
Sets the parameterServer used to apply updates to the parameters.- Parameters:
parameterServer- the parameterServerdevices- the devices to create mirrored parameters on
-
updateAllParameters
public void updateAllParameters()Updates all the mirrored parameters. -
getValue
Returns the value of a mirrored parameter on a device.- Parameters:
parameter- the parameter to get the value fordevice- the device to get the mirror fromtraining- true for a training forward pass- Returns:
- the value of the mirrored parameter on the device
-
getManager
Get theNDManagerassociated withParameterStore.- Returns:
- the
NDManager
-
sync
public void sync()Synchronizes the values on all mirrors with the main parameter.
-