Class LocalParameterServer

java.lang.Object
ai.djl.training.LocalParameterServer
All Implemented Interfaces:
ParameterServer, AutoCloseable

public class LocalParameterServer extends Object implements ParameterServer
LocalParameterServer is an implementation of the ParameterServer interface.
  • Constructor Details

    • LocalParameterServer

      public LocalParameterServer(Optimizer optimizer)
      Create a new instance of LocalParameterServer for the given optimizer.
      Parameters:
      optimizer - an optimizer
  • Method Details

    • init

      public void init(String parameterId, NDArray[] value)
      Initializes the ParameterStore for the given parameter.
      Specified by:
      init in interface ParameterServer
      Parameters:
      parameterId - the parameter ID
      value - the values to be set for the given parameter
    • update

      public void update(String parameterId, NDArray[] grads, NDArray[] params)
      Updates the parameter of a key from Parameter Server.
      Specified by:
      update in interface ParameterServer
      Parameters:
      parameterId - the key to identify the parameter
      grads - 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:
      close in interface AutoCloseable
      Specified by:
      close in interface ParameterServer