szha closed pull request #9089: Fix warnings on cpp-package
URL: https://github.com/apache/incubator-mxnet/pull/9089
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/cpp-package/README.md b/cpp-package/README.md
index cc656352c1..93edd27d17 100644
--- a/cpp-package/README.md
+++ b/cpp-package/README.md
@@ -1,10 +1,5 @@
 # MXNet C++ Package
 
-<!--
-[![Build 
Status](https://travis-ci.org/dmlc/MXNet.cpp.svg?branch=master)](https://travis-ci.org/dmlc/MXNet.cpp)
-[![Build 
status](https://ci.appveyor.com/api/projects/status/ckfq6j53sg5ll01d/branch/master?svg=true)](https://ci.appveyor.com/project/lx75249/mxnet-cpp/branch/master)
--->
-
 To build the package, please refer to 
<https://mxnet.incubator.apache.org/get_started/build_from_source.html#build-the-c-package>.
 
 A basic tutorial can be found at 
<https://mxnet.incubator.apache.org/tutorials/c++/basics.html>.
diff --git a/cpp-package/example/charRNN.cpp b/cpp-package/example/charRNN.cpp
index 218d11efc9..d28ae33c63 100644
--- a/cpp-package/example/charRNN.cpp
+++ b/cpp-package/example/charRNN.cpp
@@ -549,8 +549,6 @@ void trainWithBuiltInRNNOp(const string file, int 
batch_size, int max_epoch, int
   }
   start_epoch++;
 
-  mx_float learning_rate = 0.0002;
-  mx_float weight_decay = 0.000002;
   Optimizer* opt = OptimizerRegistry::Find("ccsgd");
 //  opt->SetParam("momentum", 0.9)->SetParam("rescale_grad", 1.0 / batch_size)
 //  ->SetParam("clip_gradient", 10);
diff --git a/cpp-package/include/mxnet-cpp/optimizer.hpp 
b/cpp-package/include/mxnet-cpp/optimizer.hpp
index f9c885fc1f..cb8442dc9c 100644
--- a/cpp-package/include/mxnet-cpp/optimizer.hpp
+++ b/cpp-package/include/mxnet-cpp/optimizer.hpp
@@ -296,7 +296,6 @@ inline void AdamOptimizer::Update(int index, NDArray 
weight, NDArray grad) {
   CHECK_EQ(keys.size(), values.size());
 
   float lr = std::stof(params_["lr"]);
-  float wd = std::stof(params_["wd"]);
   float b1 = std::stof(params_["beta1"]);
   float b2 = std::stof(params_["beta2"]);
   float t = count_[index];
diff --git a/src/executor/graph_executor.cc b/src/executor/graph_executor.cc
index 77853a61ca..f34c67e544 100644
--- a/src/executor/graph_executor.cc
+++ b/src/executor/graph_executor.cc
@@ -139,7 +139,7 @@ const std::unordered_map<std::string, NDArray>& 
GraphExecutor::aux_state_map() c
   return aux_state_map_;
 }
 
-nnvm::NodeEntry AttrHint(nnvm::NodeEntry src, nnvm::NodeEntry like) {
+static nnvm::NodeEntry AttrHint(nnvm::NodeEntry src, nnvm::NodeEntry like) {
   static const Op* id_like = Op::Get("_identity_with_attr_like_rhs");
   nnvm::NodePtr n = nnvm::Node::Create();
   n->attrs.op = id_like;
@@ -310,7 +310,7 @@ nnvm::Graph GraphExecutor::InitFullGraph(nnvm::Symbol 
symbol,
  * \brief Assign context to the graph.
  * This is triggered by both simple_bind and bind flows.
  */
-Graph AssignContext(Graph g,
+static Graph AssignContext(Graph g,
                     const Context& default_ctx,
                     const std::map<std::string, Context>& ctx_map,
                     const std::vector<Context>& in_arg_ctxes,
@@ -435,7 +435,7 @@ Graph AssignContext(Graph g,
   return g;
 }
 
-void HandleInferShapeError(const size_t num_forward_inputs,
+static void HandleInferShapeError(const size_t num_forward_inputs,
                            const nnvm::IndexedGraph& idx,
                            const nnvm::ShapeVector& inferred_shapes) {
   int cnt = 10;
@@ -458,7 +458,7 @@ void HandleInferShapeError(const size_t num_forward_inputs,
              << oss.str();
 }
 
-void HandleInferTypeError(const size_t num_forward_inputs,
+static void HandleInferTypeError(const size_t num_forward_inputs,
                           const nnvm::IndexedGraph& idx,
                           const nnvm::DTypeVector& inferred_dtypes) {
   int cnt = 10;
@@ -481,7 +481,7 @@ void HandleInferTypeError(const size_t num_forward_inputs,
              << oss.str();
 }
 
-void HandleInferStorageTypeError(const size_t num_forward_inputs,
+static void HandleInferStorageTypeError(const size_t num_forward_inputs,
                                  const nnvm::IndexedGraph& idx,
                                  const StorageTypeVector& inferred_stypes) {
   int cnt = 10;
@@ -686,7 +686,7 @@ void GraphExecutor::InitArguments(const nnvm::IndexedGraph& 
idx,
  * Shareable storages include both default storage and row_sparse storage
  * if enable_row_sparse_sharing is `True`, otherwise default storage only.
  */
-NDArray ReshapeOrCreate(const std::string& name,
+static NDArray ReshapeOrCreate(const std::string& name,
                         const TShape& dest_arg_shape,
                         const int dest_arg_dtype,
                         const NDArrayStorageType dest_arg_stype,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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