From 5d7cfd75be7b35b4a7cfcbeda8094e1c97bea845 Mon Sep 17 00:00:00 2001 From: Bing Xu Date: Thu, 12 Jan 2017 09:24:24 -0800 Subject: [PATCH] fix mxnet amalgamation (#96) --- include/nnvm/tuple.h | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/include/nnvm/tuple.h b/include/nnvm/tuple.h index 3de9a910ee6f..132e23e42302 100644 --- a/include/nnvm/tuple.h +++ b/include/nnvm/tuple.h @@ -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 + 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 + 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 @@ -511,30 +535,6 @@ class TShape : public Tuple { inline bool operator!=(const mshadow::Shape &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 - 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 - 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 };