# Update

namespace `paddle`
  class `ParameterUpdater`

    Subclassed by paddle::ParameterUpdaterComposite, paddle::RemoteParameterUpdater, paddle::SgdLocalUpdater, paddle::SgdThreadUpdater, paddle::SparseRemoteParameterUpdater

    Public Functions

    `ParameterUpdater`()
    virtual `~ParameterUpdater`()
    void `addParameterType`(ParameterType type)
    void `init`(std::vector<ParameterPtr> &parameters)
    virtual void `startPass`()
    virtual bool `finishPass`(real cost = 0)
    virtual PassType `startBatch`(int64_t batchSize)
    virtual void `finishBatch`(real cost)
    virtual void `update`( Parameter *para)
    virtual void `getParametersRemote`(bool fullSize = false, bool apply = false)
    virtual void `loadParametersRemote`(const std::string &dirName)
    virtual void `saveParametersRemote`(const std::string &dirName)
    virtual void `randParametersRemote`()
    virtual void `catchUpWith`()
    virtual void `apply`()
    virtual void `restore`()
    const std::vector<ParameterType> &`getParameterTypes`() const
    virtual void `setForwardbackwardTime`(uint64_t delta)

    Protected Functions

    virtual void `updateImpl`( Parameter *para) = 0

    Protected Attributes

    std::vector<ParameterType> `parameterTypes_`
    std::vector<ParameterPtr> `parameters_`
    std::map<size_t, size_t> `nonStaticParaIDMap_`
  class `ParameterUpdaterComposite`

    Inherits from paddle::ParameterUpdater

    Subclassed by paddle::SparseRemoteParameterUpdaterComposite

    Public Functions

    `ParameterUpdaterComposite`()
    virtual `~ParameterUpdaterComposite`()
    virtual void `init`(std::vector<ParameterPtr> &parameters) = 0
    virtual void `startPass`()
    virtual bool `finishPass`(real cost = 0)
    virtual PassType `startBatch`(int64_t batchSize)
    virtual void `finishBatch`(real cost)
    virtual void `getParametersRemote`(bool fullSize, bool apply)
    virtual void `loadParametersRemote`(const std::string &dirName)
    virtual void `saveParametersRemote`(const std::string &dirName)
    virtual void `randParametersRemote`()
    virtual void `catchUpWith`()
    virtual void `setForwardbackwardTime`(uint64_t delta)
    virtual void `apply`()
    virtual void `restore`()

    Protected Functions

    virtual void `updateImpl`( Parameter *para)

    Protected Attributes

    std::vector<std::unique_ptr<ParameterUpdater>> `updaters_`
    std::unique_ptr<SyncThreadPool> `syncThreadPool_`

namespace `paddle`

  Variables

  class paddle::IParameterUpdaterHook `__attribute__`
  class `IParameterUpdaterHook`
    #include <ParameterUpdaterHook.h>

    The parameter updater hook interface.

    The Parameter Updater hooks is a group of methods invoke before ParameterUpdater::updateImpl. It can modify gradient/momentum/etc before parameter optimization.

    Subclassed by paddle::StaticPruningHook

    Public Functions

    `~IParameterUpdaterHook`()
    virtual void `update`( Parameter *para) = 0

      The update hook method. Invoke before ParameterUpdater::updateImpl

    virtual void `init`( Parameter *para) = 0

      The init hook method. Invoke in ParameterUpdater::init

    Public Static Functions

    std::shared_ptr<IParameterUpdaterHook> `create`(const ParameterConfig &paramConfig, int idx)

      Create A ParameterUpdaterHook.

      The same parameter shared the same hooks. So it returns shared_ptr.

      Parameters
        - `param_config`: The parameter config.
        - `idx`: The element index of param_config.updater_hooks() array.

    Protected Functions

    `IParameterUpdaterHook`()

      Ctor.