Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Optimize C++ API #13496

Merged
merged 2 commits into from
Dec 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp-package/example/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
zhaoyao73 marked this conversation as resolved.
Show resolved Hide resolved
if (!check_datafiles(data_files))
return false;
Expand Down
4 changes: 2 additions & 2 deletions cpp-package/include/mxnet-cpp/operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cpp-package/include/mxnet-cpp/operator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ 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());
}
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;
Expand Down
5 changes: 3 additions & 2 deletions docs/architecture/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -597,6 +597,7 @@ Written explicitly, it is:
inline TShape SmoothL1Shape_(const TShape& src,
const EnvArguments& env) {
return TShape(src);
}
```

### Define Functions
Expand Down