Program Listing for File apply_momentum.h

Return to documentation for file (include/converter/include/ops/apply_momentum.h)

#ifndef MINDSPORE_CORE_OPS_APPLY_MOMENTUM_H_
#define MINDSPORE_CORE_OPS_APPLY_MOMENTUM_H_
#include <map>
#include <memory>
#include <set>
#include <string>
#include <vector>

#include "mindapi/base/types.h"
#include "ops/base_operator.h"

namespace mindspore {
namespace ops {
constexpr auto kNameApplyMomentum = "ApplyMomentum";
class MIND_API ApplyMomentum : public BaseOperator {
 public:
  MIND_API_BASE_MEMBER(ApplyMomentum);
  ApplyMomentum() : BaseOperator(kNameApplyMomentum) {
    InitIOName({"var", "accum", "lr", "grad", "momentum"}, {"var", "accum"});
  }
  void Init(const bool use_nesterov = false, const bool use_locking = false, const float gradient_scale = 1.0);
  void set_use_nesterov(const bool use_nesterov);
  void set_use_locking(const bool use_locking);
  void set_gradient_scale(const float gradient_scale);
  bool get_use_nesterov() const;
  bool get_use_locking() const;
  float get_gradient_scale() const;
};
MIND_API abstract::AbstractBasePtr ApplyMomentumInfer(const abstract::AnalysisEnginePtr &,
                                                      const PrimitivePtr &primitive,
                                                      const std::vector<abstract::AbstractBasePtr> &input_args);
using kPrimApplyMomentumPtr = std::shared_ptr<ApplyMomentum>;
}  // namespace ops
}  // namespace mindspore
#endif  // MINDSPORE_CORE_OPS_APPLY_MOMENTUM_H_