MoisesHer commented on a change in pull request #16893: Multi-tensor LAMB
URL: https://github.com/apache/incubator-mxnet/pull/16893#discussion_r352949278
 
 

 ##########
 File path: src/operator/contrib/multi_lamb-inl.h
 ##########
 @@ -0,0 +1,332 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ *  Copyright (c) 2019 by Contributors
+ * \file multi_lamb-inl.h
+ * \brief vectorized lars coefficient computed from sums of squared weights 
and grads
+ * \author Moises Hernandez
+ */
+#ifndef MXNET_OPERATOR_CONTRIB_MULTI_LAMB_INL_H_
+#define MXNET_OPERATOR_CONTRIB_MULTI_LAMB_INL_H_
+
+#include <dmlc/parameter.h>
+#include <mxnet/operator.h>
+#include <mxnet/operator_util.h>
+#include <mxnet/op_attr_types.h>
+#include <mshadow/base.h>
+#include <nnvm/op.h>
+#include <nnvm/op_attr_types.h>
+#include <vector>
+#include "../operator_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+#include "../tensor/init_op.h"
+#include "../tensor/util/tensor_util-inl.h"
+#include "multi_sum_sq-inl.h"
+
+namespace mxnet {
+namespace op {
+
+namespace multilamb {
+enum MultiLambUpdateResource {kTempSpace};
+}  // namespace multilamb
+
+struct MultiLAMBParam : public dmlc::Parameter<MultiLAMBParam> {
+  float learning_rate;
+  float beta1;
+  float beta2;
+  float epsilon;
+  float wd;
+  float rescale_grad;
+  float lower_bound;
+  float upper_bound;
+  float clip_gradient;
+  bool bias_correction;
+  int num_tensors;
+  mxnet::Tuple<int> step_count;
+
+  DMLC_DECLARE_PARAMETER(MultiLAMBParam) {
+    DMLC_DECLARE_FIELD(learning_rate)
+    .set_default(0.001f)
+    .describe("Learning rate");
+    DMLC_DECLARE_FIELD(beta1)
+    .set_default(0.9f)
+    .describe("Exponential decay rate for the first moment estimates.");
+    DMLC_DECLARE_FIELD(beta2)
+    .set_default(0.999f)
+    .describe("Exponential decay rate for the second moment estimates.");
+    DMLC_DECLARE_FIELD(epsilon)
+    .set_default(1e-6f)
+    .describe("Small value to avoid division by 0.");
+    DMLC_DECLARE_FIELD(wd)
+    .set_default(0.0f)
+    .describe("Weight decay augments the objective function with a "
+              "regularization term that penalizes large weights. "
+               "The penalty scales with the square of the magnitude of each 
weight.");
+    DMLC_DECLARE_FIELD(rescale_grad)
+    .set_default(1.0f)
+    .describe("Gradient rescaling factor");
+    DMLC_DECLARE_FIELD(lower_bound)
+    .set_default(1e-3f)
 
 Review comment:
   done, thanks

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to