You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/12/12 14:24:52 UTC

[GitHub] marcoabreu closed pull request #13496: Optimize C++ API

marcoabreu closed pull request #13496: Optimize C++ API
URL: https://github.com/apache/incubator-mxnet/pull/13496
 
 
   

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/example/utils.h b/cpp-package/example/utils.h
index 98b6472685b..2ed5c4c11f0 100644
--- a/cpp-package/example/utils.h
+++ b/cpp-package/example/utils.h
@@ -42,7 +42,7 @@ bool check_datafiles(const std::vector<std::string> &data_files) {
   return true;
   }
 
-bool setDataIter(MXDataIter *iter , std::string useType,
+bool setDataIter(MXDataIter *iter , const std::string &useType,
               const std::vector<std::string> &data_files, int batch_size) {
     if (!check_datafiles(data_files))
         return false;
diff --git a/cpp-package/include/mxnet-cpp/operator.h b/cpp-package/include/mxnet-cpp/operator.h
index 4d4bedac8fe..9f289f0e248 100644
--- a/cpp-package/include/mxnet-cpp/operator.h
+++ b/cpp-package/include/mxnet-cpp/operator.h
@@ -86,7 +86,7 @@ class Operator {
   * \param symbol the input symbol
   * \return reference of self
   */
-  Operator &SetInput(const std::string &name, Symbol symbol);
+  Operator &SetInput(const std::string &name, const Symbol &symbol);
   /*!
   * \brief add an input symbol
   * \param symbol the input symbol
@@ -133,7 +133,7 @@ class Operator {
   * \param ndarray the input ndarray
   * \return reference of self
   */
-  Operator &SetInput(const std::string &name, NDArray ndarray);
+  Operator &SetInput(const std::string &name, const NDArray &ndarray);
   /*!
   * \brief add an input ndarray
   * \param ndarray the input ndarray
diff --git a/cpp-package/include/mxnet-cpp/operator.hpp b/cpp-package/include/mxnet-cpp/operator.hpp
index f4ce43d58d2..edc396f1477 100644
--- a/cpp-package/include/mxnet-cpp/operator.hpp
+++ b/cpp-package/include/mxnet-cpp/operator.hpp
@@ -158,7 +158,7 @@ inline void Operator::Invoke(NDArray &output) {
   Invoke(outputs);
 }
 
-inline Operator &Operator::SetInput(const std::string &name, Symbol symbol) {
+inline Operator &Operator::SetInput(const std::string &name, const Symbol &symbol) {
     if (symbol.GetHandle()) {
       input_keys_.push_back(name.c_str());
       input_symbols_.push_back(symbol.GetHandle());
@@ -166,7 +166,7 @@ inline Operator &Operator::SetInput(const std::string &name, Symbol symbol) {
     return *this;
 }
 
-inline Operator &Operator::SetInput(const std::string &name, NDArray ndarray) {
+inline Operator &Operator::SetInput(const std::string &name, const NDArray &ndarray) {
   input_keys_.push_back(name.c_str());
   input_ndarrays_.push_back(ndarray.GetHandle());
   return *this;
diff --git a/docs/architecture/overview.md b/docs/architecture/overview.md
index a7632d4a61e..6a37f883047 100644
--- a/docs/architecture/overview.md
+++ b/docs/architecture/overview.md
@@ -567,8 +567,8 @@ let's check input data shape consistency and provide output shape.
 ```cpp
     typedef TShape (*UnaryShapeFunction)(const TShape& src,
                                          const EnvArguments& env);
-    typedef TShape (*BinaryShapeFunction)(const TShape&                                         const TShape& rhs,lhs,
-
+    typedef TShape (*BinaryShapeFunction)(const TShape& lhs,
+                                          const TShape& rhs,
                                           const EnvArguments& env);
 ```
 You can use `mshadow::TShape` to check input data shape and designate output data shape.
@@ -597,6 +597,7 @@ Written explicitly, it is:
     inline TShape SmoothL1Shape_(const TShape& src,
                                  const EnvArguments& env) {
       return TShape(src);
+    }
 ```
 
 ### Define Functions


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services