Skip to content

Commit

Permalink
fix mxnet amalgamation (apache#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
antinucleon authored and piiswrong committed Jan 12, 2017
1 parent 0a65dec commit 5d7cfd7
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions include/nnvm/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,30 @@ class Tuple {
t.assign(tmp.begin(), tmp.end());
return is;
}
/*!
* \brief save the content into binary stream
* \param strm the output stream
* \tparam TStream any stream type that have write
*/
template<typename TStream>
inline void Save(TStream *strm) const {
strm->Write(&ndim_, sizeof(ndim_));
strm->Write(begin(), sizeof(ValueType) * ndim_);
}
/*!
* \brief load the content from binary stream
* \param strm the output stream
* \tparam TStream any stream type that have write
* \return whether the load is successful
*/
template<typename TStream>
inline bool Load(TStream *strm) {
if (strm->Read(&ndim_, sizeof(ndim_)) != sizeof(ndim_)) return false;
this->SetDim(ndim_);
size_t nread = sizeof(ValueType) * ndim_;
if (strm->Read(begin(), nread) != nread) return false;
return true;
}

protected:
// stack cache size
Expand Down Expand Up @@ -511,30 +535,6 @@ class TShape : public Tuple<index_t> {
inline bool operator!=(const mshadow::Shape<dim> &s) const {
return !(*this == s);
}
/*!
* \brief save the content into binary stream
* \param strm the output stream
* \tparam TStream any stream type that have write
*/
template<typename TStream>
inline void Save(TStream *strm) const {
strm->Write(&ndim_, sizeof(ndim_));
strm->Write(data(), sizeof(index_t) * ndim_);
}
/*!
* \brief load the content from binary stream
* \param strm the output stream
* \tparam TStream any stream type that have write
* \return whether the load is successful
*/
template<typename TStream>
inline bool Load(TStream *strm) {
if (strm->Read(&ndim_, sizeof(ndim_)) != sizeof(ndim_)) return false;
this->SetDim(ndim_);
size_t nread = sizeof(index_t) * ndim_;
if (strm->Read(data(), nread) != nread) return false;
return true;
}
#endif
};

Expand Down

0 comments on commit 5d7cfd7

Please sign in to comment.