Package org.nd4j.parameterserver.updater
Class SynchronousParameterUpdater
- java.lang.Object
-
- org.nd4j.parameterserver.updater.BaseParameterUpdater
-
- org.nd4j.parameterserver.updater.SynchronousParameterUpdater
-
- All Implemented Interfaces:
ParameterServerUpdater
public class SynchronousParameterUpdater extends BaseParameterUpdater
-
-
Field Summary
-
Fields inherited from class org.nd4j.parameterserver.updater.BaseParameterUpdater
ndArrayHolder, updateStorage
-
-
Constructor Summary
Constructors Constructor Description SynchronousParameterUpdater(int workers)Initializes this updater withInMemoryUpdateStorageSynchronousParameterUpdater(UpdateStorage updateStorage, int workers)Initialize this updater with a custom update storageSynchronousParameterUpdater(UpdateStorage updateStorage, NDArrayHolder ndArrayHolder, int workers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAsync()Returns true if the given updater is async or synchronous updatesvoidpartialUpdate(org.nd4j.linalg.api.ndarray.INDArray arr, org.nd4j.linalg.api.ndarray.INDArray result, long idx, int... dimensions)Updates result based on arr along a particularINDArray#tensorAlongDimension(int, int...)intrequiredUpdatesForPass()Returns the number of required updates for a new passbooleanshouldReplicate()Returns true if the updater has accumulated enough ndarrays to replicate to the workersMap<String,Number>status()Returns the current status of this parameter server updaterStringtoJson()Serialize this updater as jsonvoidupdate(NDArrayMessage message)Do an update based on the ndarray message.voidupdate(org.nd4j.linalg.api.ndarray.INDArray arr, org.nd4j.linalg.api.ndarray.INDArray result)Updates result based on arr-
Methods inherited from class org.nd4j.parameterserver.updater.BaseParameterUpdater
isReady, ndArrayHolder, numUpdates, reset
-
-
-
-
Constructor Detail
-
SynchronousParameterUpdater
public SynchronousParameterUpdater(UpdateStorage updateStorage, NDArrayHolder ndArrayHolder, int workers)
- Parameters:
updateStorage-ndArrayHolder-workers-
-
SynchronousParameterUpdater
public SynchronousParameterUpdater(UpdateStorage updateStorage, int workers)
Initialize this updater with a custom update storage- Parameters:
updateStorage- the update storage to use
-
SynchronousParameterUpdater
public SynchronousParameterUpdater(int workers)
Initializes this updater withInMemoryUpdateStorage
-
-
Method Detail
-
requiredUpdatesForPass
public int requiredUpdatesForPass()
Returns the number of required updates for a new pass- Returns:
- the number of required updates for a new pass
-
isAsync
public boolean isAsync()
Returns true if the given updater is async or synchronous updates- Specified by:
isAsyncin interfaceParameterServerUpdater- Overrides:
isAsyncin classBaseParameterUpdater- Returns:
- true if the given updater is async or synchronous updates
-
status
public Map<String,Number> status()
Returns the current status of this parameter server updater- Returns:
-
toJson
public String toJson()
Serialize this updater as json- Returns:
-
shouldReplicate
public boolean shouldReplicate()
Returns true if the updater has accumulated enough ndarrays to replicate to the workers- Returns:
- true if replication should happen,false otherwise
-
update
public void update(NDArrayMessage message)
Do an update based on the ndarray message.- Parameters:
message-
-
partialUpdate
public void partialUpdate(org.nd4j.linalg.api.ndarray.INDArray arr, org.nd4j.linalg.api.ndarray.INDArray result, long idx, int... dimensions)Updates result based on arr along a particularINDArray#tensorAlongDimension(int, int...)- Parameters:
arr- the array to updateresult- the result ndarray to updateidx- the index to updatedimensions- the dimensions to update
-
update
public void update(org.nd4j.linalg.api.ndarray.INDArray arr, org.nd4j.linalg.api.ndarray.INDArray result)Updates result based on arr- Parameters:
arr- the array to updateresult- the result ndarray to update
-
-