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

Commit

Permalink
Add GetName function in Symbol class for cpp pack (#12076)
Browse files Browse the repository at this point in the history
  • Loading branch information
haojin2 authored and nswamy committed Aug 9, 2018
1 parent 5aef78f commit 22bfbd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpp-package/include/mxnet-cpp/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class Symbol {
std::vector<std::string> ListOutputs() const;
/*! \return get the descriptions of auxiliary data for this symbol */
std::vector<std::string> ListAuxiliaryStates() const;
/*! \return get the name of the symbol */
std::string GetName() const;
/*!
* \brief infer and construct all the arrays to bind to executor by providing
* some known arrays.
Expand Down
8 changes: 8 additions & 0 deletions cpp-package/include/mxnet-cpp/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ inline std::vector<std::string> Symbol::ListAuxiliaryStates() const {
return ret;
}

inline std::string Symbol::GetName() const {
int success;
const char* out_name;
CHECK_EQ(MXSymbolGetName(GetHandle(), &out_name, &success), 0);
CHECK_EQ(success, 1);
return std::string(out_name);
}

inline void Symbol::InferShape(
const std::map<std::string, std::vector<mx_uint> > &arg_shapes,
std::vector<std::vector<mx_uint> > *in_shape,
Expand Down

0 comments on commit 22bfbd7

Please sign in to comment.