diff --git a/cpp-package/example/utils.h b/cpp-package/example/utils.h index 98b6472685b3..2ed5c4c11f02 100644 --- a/cpp-package/example/utils.h +++ b/cpp-package/example/utils.h @@ -42,7 +42,7 @@ bool check_datafiles(const std::vector &data_files) { return true; } -bool setDataIter(MXDataIter *iter , std::string useType, +bool setDataIter(MXDataIter *iter , const std::string &useType, const std::vector &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 4d4bedac8fec..9f289f0e248b 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 f4ce43d58d2d..edc396f1477c 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 a7632d4a61e8..6a37f8830479 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