diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..57ed3aeea564d3ca54ea02c6912fcc03df89c966 --- /dev/null +++ b/.clang-format @@ -0,0 +1,7 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +Standard: Cpp11 +IndentWidth: 4 +NamespaceIndentation: All +... diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e81d3d3c46b8ec735b51d961fbd53e42d81f0cf5..b9866b5dbcaf23230d5e684eedc659912a674db4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,6 +6,7 @@ repos: files: (src).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|cu|h|hpp|hxx)$ - id: remove-tabs files: (src).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|cu|h|hpp|hxx)$ + - repo: https://github.com/pre-commit/pre-commit-hooks sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0 hooks: @@ -18,11 +19,21 @@ repos: files: (src).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|cu|h|hpp|hxx)$ - id: trailing-whitespace files: (src).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|cu|h|hpp|hxx)$ + - repo: local hooks: - id: clang-format-with-version-check name: clang-format description: Format files with ClangFormat. - entry: bash .clang_format.hook -i + entry: bash ./tools/pre-commit.hooks/.clang_format.hook -i language: system files: (src).*\.(c|cc|cxx|cpp|h|hpp|hxx)$ + +#- repo: local +# hooks: +# - id: copyright_checker +# name: copyright_checker +# entry: python ./tools/pre-commit.hooks/.copyright.hook +# language: system +# files: (src).*\.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$ +# exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$ diff --git a/src/common/type_define.h b/src/common/type_define.h index e59748612b407ad4a17fad87012a82619b875f17..0c450f7eb0b1688dedb9c15178aaa65bd02b67a7 100644 --- a/src/common/type_define.h +++ b/src/common/type_define.h @@ -23,30 +23,31 @@ SOFTWARE. namespace paddle_mobile { -namespace framework { -template class OperatorBase; -class OpDesc; -class BlockDesc; -class InferShapeContext; -} - -using VariableNameMap = std::map>; - -template -using OpCreator = std::function *( - const std::string & /*type*/, const VariableNameMap & /*inputs*/, - const VariableNameMap & /*outputs*/, - const framework::AttributeMap & /*attrs*/)>; - -using GradOpMakerFN = - std::function>( - const framework::OpDesc &, - const std::unordered_set & /*no_grad_set*/, - std::unordered_map * /*grad_to_var*/, - const std::vector &grad_block)>; - -using InferVarTypeFN = std::function; - -using InferShapeFN = std::function; + namespace framework { + template class OperatorBase; + class OpDesc; + class BlockDesc; + class InferShapeContext; + } + + using VariableNameMap = std::map>; + + template + using OpCreator = std::function *( + const std::string & /*type*/, const VariableNameMap & /*inputs*/, + const VariableNameMap & /*outputs*/, + const framework::AttributeMap & /*attrs*/)>; + + using GradOpMakerFN = + std::function>( + const framework::OpDesc &, + const std::unordered_set & /*no_grad_set*/, + std::unordered_map * /*grad_to_var*/, + const std::vector &grad_block)>; + + using InferVarTypeFN = + std::function; + + using InferShapeFN = std::function; }; diff --git a/src/common/types.h b/src/common/types.h index 75f830a0e4285be177e0402624f6b82b90305b55..388ae4863285b24ef33c6b7aab1f28f5b59a2bd9 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -19,45 +19,45 @@ SOFTWARE. #pragma once; namespace paddle_mobile { -enum class Precision : int { FP32 = 0 }; + enum class Precision : int { FP32 = 0 }; -//! device type -enum DeviceTypeEnum { kINVALID = -1, kCPU = 0, kFPGA = 1, kGPU_MALI = 2 }; + //! device type + enum DeviceTypeEnum { kINVALID = -1, kCPU = 0, kFPGA = 1, kGPU_MALI = 2 }; -template struct DeviceType {}; + template struct DeviceType {}; -typedef DeviceType CPU; -typedef DeviceType FPGA; -typedef DeviceType GPU_MALI; + typedef DeviceType CPU; + typedef DeviceType FPGA; + typedef DeviceType GPU_MALI; -//! data type -enum DataType { - PM_INVALID = -1, - PM_HALF = 0, - PM_FLOAT = 1, - PM_DOUBLE = 2, - PM_INT8 = 3, - PM_INT16 = 4, - PM_INT32 = 5, - PM_INT64 = 6, - PM_UINT8 = 7, - PM_UINT16 = 8, - PM_UINT32 = 9, - PM_STRING = 10, - PM_BOOL = 11, - PM_SHAPE = 12, - PM_TENSOR = 13 -}; -//! -enum PMStatus { - PMSuccess = 0xFF, /*!< No errors */ - PMNotInitialized = 0x01, /*!< Data not initialized. */ - PMInvalidValue = 0x02, /*!< Incorrect variable value. */ - PMMemAllocFailed = 0x03, /*!< Memory allocation error. */ - PMUnKownError = 0x04, /*!< Unknown error. */ - PMOutOfAuthority = 0x05, /*!< Try to modified data not your own*/ - PMOutOfMem = 0x06, /*!< OOM error*/ - PMUnImplError = 0x07, /*!< Unimplement error. */ - PMWrongDevice = 0x08 /*!< un-correct device. */ -}; + //! data type + enum DataType { + PM_INVALID = -1, + PM_HALF = 0, + PM_FLOAT = 1, + PM_DOUBLE = 2, + PM_INT8 = 3, + PM_INT16 = 4, + PM_INT32 = 5, + PM_INT64 = 6, + PM_UINT8 = 7, + PM_UINT16 = 8, + PM_UINT32 = 9, + PM_STRING = 10, + PM_BOOL = 11, + PM_SHAPE = 12, + PM_TENSOR = 13 + }; + //! + enum PMStatus { + PMSuccess = 0xFF, /*!< No errors */ + PMNotInitialized = 0x01, /*!< Data not initialized. */ + PMInvalidValue = 0x02, /*!< Incorrect variable value. */ + PMMemAllocFailed = 0x03, /*!< Memory allocation error. */ + PMUnKownError = 0x04, /*!< Unknown error. */ + PMOutOfAuthority = 0x05, /*!< Try to modified data not your own*/ + PMOutOfMem = 0x06, /*!< OOM error*/ + PMUnImplError = 0x07, /*!< Unimplement error. */ + PMWrongDevice = 0x08 /*!< un-correct device. */ + }; } diff --git a/src/common/variant.h b/src/common/variant.h index 24eee64ff387b638a8650fb9be230aed75b8a8d7..2b67619baaf8475a52d6b358a41c44c7c2015b05 100644 --- a/src/common/variant.h +++ b/src/common/variant.h @@ -21,79 +21,79 @@ SOFTWARE. #pragma once namespace paddle_mobile { -template struct IDToType { typedef Type type_t; }; + template struct IDToType { typedef Type type_t; }; -template struct VariantHelper { - static const size_t size = sizeof(F) > VariantHelper::size - ? sizeof(F) - : VariantHelper::size; + template struct VariantHelper { + static const size_t size = sizeof(F) > VariantHelper::size + ? sizeof(F) + : VariantHelper::size; - inline static void Destroy(size_t id, void *data) { - if (id == typeid(F).hash_code()) { - reinterpret_cast(data)->~F(); - } else { - VariantHelper::Destroy(id, data); - } - } -}; + inline static void Destroy(size_t id, void *data) { + if (id == typeid(F).hash_code()) { + reinterpret_cast(data)->~F(); + } else { + VariantHelper::Destroy(id, data); + } + } + }; -template struct VariantHelper { - static const size_t size = sizeof(F); - inline static void Destroy(size_t id, void *data) { - if (id == typeid(F).hash_code()) { - // reinterpret_cast(data)->~F(); - } else { - // std::cout << "未匹配到 " << std::endl; - } - } -}; + template struct VariantHelper { + static const size_t size = sizeof(F); + inline static void Destroy(size_t id, void *data) { + if (id == typeid(F).hash_code()) { + // reinterpret_cast(data)->~F(); + } else { + // std::cout << "未匹配到 " << std::endl; + } + } + }; -template class RawData { -public: - char data[size]; - RawData() {} - RawData(const RawData &raw_data) { strcpy(data, raw_data.data); } - // void operator=(const RawData &raw_data){ - // strcpy(data, raw_data.data); - // } -}; + template class RawData { + public: + char data[size]; + RawData() {} + RawData(const RawData &raw_data) { strcpy(data, raw_data.data); } + // void operator=(const RawData &raw_data){ + // strcpy(data, raw_data.data); + // } + }; -template struct Variant { - Variant(const Variant &variant) { - // std::cout << " 赋值构造函数 " << std::endl; - type_id = variant.type_id; - data = variant.data; - } + template struct Variant { + Variant(const Variant &variant) { + // std::cout << " 赋值构造函数 " << std::endl; + type_id = variant.type_id; + data = variant.data; + } - Variant() : type_id(invalid_type()) {} - ~Variant() { - // helper::Destroy(type_id, &data); - } + Variant() : type_id(invalid_type()) {} + ~Variant() { + // helper::Destroy(type_id, &data); + } - template void Set(Args &&... args) { - helper::Destroy(type_id, &data); - new (&data) T(std::forward(args)...); - type_id = typeid(T).hash_code(); - } + template void Set(Args &&... args) { + helper::Destroy(type_id, &data); + new (&data) T(std::forward(args)...); + type_id = typeid(T).hash_code(); + } - template T &Get() const { - if (type_id == typeid(T).hash_code()) { - return *const_cast(reinterpret_cast(&data)); - } else { - // std::cout << " bad cast in variant " << std::endl; - throw std::bad_cast(); - } - } + template T &Get() const { + if (type_id == typeid(T).hash_code()) { + return *const_cast(reinterpret_cast(&data)); + } else { + // std::cout << " bad cast in variant " << std::endl; + throw std::bad_cast(); + } + } - size_t TypeId() const { return type_id; } + size_t TypeId() const { return type_id; } -private: - static inline size_t invalid_type() { return typeid(void).hash_code(); } - typedef VariantHelper helper; - size_t type_id; - RawData data; -}; + private: + static inline size_t invalid_type() { return typeid(void).hash_code(); } + typedef VariantHelper helper; + size_t type_id; + RawData data; + }; -template struct Vistor { typedef T type_t; }; + template struct Vistor { typedef T type_t; }; } // namespace paddle_mobile diff --git a/src/framework/attribute.cpp b/src/framework/attribute.cpp index 2fa533167bf88ba5bf729ac8a7b12e9e841668d2..07b2be99fd37ce8a3cf1faa8621b2690c182dd74 100644 --- a/src/framework/attribute.cpp +++ b/src/framework/attribute.cpp @@ -19,5 +19,5 @@ SOFTWARE. #include "attribute.h" namespace paddle_mobile { -namespace framework {} + namespace framework {} } // namespace paddle_mobile diff --git a/src/framework/attribute.h b/src/framework/attribute.h index f51ff03cec88b8599e82798c925bc2a1d87401f9..c80f53c079d0ff78137d5171fb8bfe95f7ffea4c 100644 --- a/src/framework/attribute.h +++ b/src/framework/attribute.h @@ -22,107 +22,110 @@ SOFTWARE. #include "framework.pb.h" namespace paddle_mobile { -namespace framework { + namespace framework { -class BlockDesc; + class BlockDesc; -class Attribute { -public: - static Attribute GetAttrValue(const proto::OpDesc::Attr &attr_desc) { - // std::cout << "begin get attr value" << std::endl; - Attribute attr; - switch (attr_desc.type()) { - case proto::AttrType::BOOLEAN: { - attr.Set(attr_desc.b()); - break; - } - case proto::AttrType::INT: { - attr.Set(attr_desc.i()); - break; - } - case proto::AttrType::FLOAT: { - attr.Set(attr_desc.f()); - break; - } - case proto::AttrType::STRING: { - attr.Set(attr_desc.s()); - break; - } - case proto::AttrType::BOOLEANS: { - std::vector val(attr_desc.bools_size()); - for (int i = 0; i < attr_desc.bools_size(); ++i) { - val[i] = attr_desc.bools(i); - } - attr.Set>(val); - break; - } - case proto::AttrType::INTS: { - std::vector val(attr_desc.ints_size()); - for (int i = 0; i < attr_desc.ints_size(); ++i) { - val[i] = attr_desc.ints(i); - } - attr.Set>(val); - break; - } - case proto::AttrType::FLOATS: { - std::vector val(attr_desc.floats_size()); - for (int i = 0; i < attr_desc.floats_size(); ++i) { - val[i] = attr_desc.floats(i); - } - attr.Set>(val); - break; - } - case proto::AttrType::STRINGS: { - std::vector val(attr_desc.strings_size()); - for (int i = 0; i < attr_desc.strings_size(); ++i) { - val[i] = attr_desc.strings(i); - } - attr.Set>(val); - break; - } - case proto::AttrType::LONG: { - attr.Set(attr_desc.l()); - break; - } - default: - // std::cout << " not support " << std::endl; - break; - } - // std::cout << "end get attr value" << std::endl; - return attr; - } + class Attribute { + public: + static Attribute + GetAttrValue(const proto::OpDesc::Attr &attr_desc) { + // std::cout << "begin get attr value" << std::endl; + Attribute attr; + switch (attr_desc.type()) { + case proto::AttrType::BOOLEAN: { + attr.Set(attr_desc.b()); + break; + } + case proto::AttrType::INT: { + attr.Set(attr_desc.i()); + break; + } + case proto::AttrType::FLOAT: { + attr.Set(attr_desc.f()); + break; + } + case proto::AttrType::STRING: { + attr.Set(attr_desc.s()); + break; + } + case proto::AttrType::BOOLEANS: { + std::vector val(attr_desc.bools_size()); + for (int i = 0; i < attr_desc.bools_size(); ++i) { + val[i] = attr_desc.bools(i); + } + attr.Set>(val); + break; + } + case proto::AttrType::INTS: { + std::vector val(attr_desc.ints_size()); + for (int i = 0; i < attr_desc.ints_size(); ++i) { + val[i] = attr_desc.ints(i); + } + attr.Set>(val); + break; + } + case proto::AttrType::FLOATS: { + std::vector val(attr_desc.floats_size()); + for (int i = 0; i < attr_desc.floats_size(); ++i) { + val[i] = attr_desc.floats(i); + } + attr.Set>(val); + break; + } + case proto::AttrType::STRINGS: { + std::vector val(attr_desc.strings_size()); + for (int i = 0; i < attr_desc.strings_size(); ++i) { + val[i] = attr_desc.strings(i); + } + attr.Set>(val); + break; + } + case proto::AttrType::LONG: { + attr.Set(attr_desc.l()); + break; + } + default: + // std::cout << " not support " << std::endl; + break; + } + // std::cout << "end get attr value" << std::endl; + return attr; + } - Attribute() {} - template Attribute &Set(Args &&... args) { - variant_.Set(args...); - return *this; - } + Attribute() {} + template + Attribute &Set(Args &&... args) { + variant_.Set(args...); + return *this; + } - template T &Get() const { return variant_.Get(); } + template T &Get() const { return variant_.Get(); } -private: - Variant, std::vector, - std::vector, bool, std::vector, BlockDesc *, - int64_t> - variant_; -}; + private: + Variant, + std::vector, std::vector, bool, + std::vector, BlockDesc *, int64_t> + variant_; + }; -using AttributeMap = std::unordered_map; + using AttributeMap = std::unordered_map; -class AttrReader { -public: - explicit AttrReader(const AttributeMap &attrs) : attrs_(attrs) {} + class AttrReader { + public: + explicit AttrReader(const AttributeMap &attrs) : attrs_(attrs) {} - template inline T Get(const std::string &name) const { - // PADDLE_ENFORCE(attrs_.count(name) != 0, "%s should be in - // AttributeMap", - // name); - return ((Attribute)attrs_.at(name)).Get(); - } + template inline T Get(const std::string &name) const { + // PADDLE_ENFORCE(attrs_.count(name) != 0, "%s should + // be in + // AttributeMap", + // name); + return ((Attribute)attrs_.at(name)).Get(); + } -private: - const AttributeMap &attrs_; -}; + private: + const AttributeMap &attrs_; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/block_desc.cpp b/src/framework/block_desc.cpp index ed7e25478fe43e62302d897c302ecde4ff30bdea..a771d16a81a8f6e5ef726cd6aac45aae4dd85477 100644 --- a/src/framework/block_desc.cpp +++ b/src/framework/block_desc.cpp @@ -19,32 +19,32 @@ SOFTWARE. #include "block_desc.h" namespace paddle_mobile { -namespace framework { + namespace framework { -std::vector> BlockDesc::Vars() const { - std::vector> res; - for (const auto &p : vars_) { - res.push_back(p.second); - } - return res; -} + std::vector> BlockDesc::Vars() const { + std::vector> res; + for (const auto &p : vars_) { + res.push_back(p.second); + } + return res; + } -std::vector> BlockDesc::Ops() const { - std::vector> res; - for (const auto &op : ops_) { - res.push_back(op); - } - return res; -} + std::vector> BlockDesc::Ops() const { + std::vector> res; + for (const auto &op : ops_) { + res.push_back(op); + } + return res; + } -BlockDesc::BlockDesc(const proto::BlockDesc &desc) : desc_(desc) { - for (const proto::VarDesc &var_desc : desc_.vars()) { - vars_[var_desc.name()].reset(new VarDesc(var_desc)); - } - for (const proto::OpDesc &op_desc : desc_.ops()) { - ops_.emplace_back(new framework::OpDesc(op_desc)); - } -} + BlockDesc::BlockDesc(const proto::BlockDesc &desc) : desc_(desc) { + for (const proto::VarDesc &var_desc : desc_.vars()) { + vars_[var_desc.name()].reset(new VarDesc(var_desc)); + } + for (const proto::OpDesc &op_desc : desc_.ops()) { + ops_.emplace_back(new framework::OpDesc(op_desc)); + } + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/block_desc.h b/src/framework/block_desc.h index 4a71c1b7a0e6826b63370558b2dd1a758d800dcd..3e75fbbeb83f1b3552cec1e0157de99439dafe96 100644 --- a/src/framework/block_desc.h +++ b/src/framework/block_desc.h @@ -24,46 +24,50 @@ SOFTWARE. #include "var_desc.h" namespace paddle_mobile { -namespace framework { + namespace framework { -class BlockDesc : PaddleMobileObject { -public: - BlockDesc(const proto::BlockDesc &desc); + class BlockDesc : PaddleMobileObject { + public: + BlockDesc(const proto::BlockDesc &desc); - const int &ID() const { return desc_.idx(); } + const int &ID() const { return desc_.idx(); } - const int &Parent() const { return desc_.parent_idx(); } + const int &Parent() const { return desc_.parent_idx(); } - bool operator==(const paddle_mobile::framework::BlockDesc &in_block) const { - return this->ID() == in_block.ID() && this->Parent() == in_block.Parent(); - } + bool operator==( + const paddle_mobile::framework::BlockDesc &in_block) const { + return this->ID() == in_block.ID() && + this->Parent() == in_block.Parent(); + } - bool operator<(const paddle_mobile::framework::BlockDesc &in_block) const { - return this->ID() < in_block.ID() && this->Parent() < in_block.Parent(); - } + bool operator<( + const paddle_mobile::framework::BlockDesc &in_block) const { + return this->ID() < in_block.ID() && + this->Parent() < in_block.Parent(); + } - std::vector> Vars() const; - std::vector> Ops() const; + std::vector> Vars() const; + std::vector> Ops() const; -private: - proto::BlockDesc desc_; - std::vector> ops_; - std::unordered_map> vars_; -}; + private: + proto::BlockDesc desc_; + std::vector> ops_; + std::unordered_map> vars_; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile namespace std { -template <> struct hash { - typedef paddle_mobile::framework::BlockDesc argument_type; - typedef std::size_t result_type; - result_type operator()(argument_type const &s) const noexcept { - result_type const h1(std::hash{}(s.ID())); - result_type const h2(std::hash{}(s.ID())); - return h1 ^ (h2 << 1); - } -}; + template <> struct hash { + typedef paddle_mobile::framework::BlockDesc argument_type; + typedef std::size_t result_type; + result_type operator()(argument_type const &s) const noexcept { + result_type const h1(std::hash{}(s.ID())); + result_type const h2(std::hash{}(s.ID())); + return h1 ^ (h2 << 1); + } + }; } // namespace std diff --git a/src/framework/data_layout.h b/src/framework/data_layout.h index bb76f224a8d932c04982bef322ef82368f4c82df..5564d000470ec1dc221ef56f3e9e77d24a4fffb8 100644 --- a/src/framework/data_layout.h +++ b/src/framework/data_layout.h @@ -19,49 +19,50 @@ limitations under the License. */ #include namespace paddle_mobile { -namespace framework { + namespace framework { -enum class DataLayout { - kNHWC = 0, - kNCHW = 1, - kAnyLayout = 2, -}; + enum class DataLayout { + kNHWC = 0, + kNCHW = 1, + kAnyLayout = 2, + }; -inline DataLayout StringToDataLayout(const std::string &str) { - std::string s(str); - for (size_t i = 0; i < s.size(); ++i) { - s[i] = toupper(s[i]); - } + inline DataLayout StringToDataLayout(const std::string &str) { + std::string s(str); + for (size_t i = 0; i < s.size(); ++i) { + s[i] = toupper(s[i]); + } - if (s == "NHWC") { - return DataLayout::kNHWC; - } else if (s == "NCHW") { - return DataLayout::kNCHW; - } else if (s == "ANYLAYOUT") { - return DataLayout::kAnyLayout; - } else { - // std::cout << "Unknown storage order string: %s", s; - } -} + if (s == "NHWC") { + return DataLayout::kNHWC; + } else if (s == "NCHW") { + return DataLayout::kNCHW; + } else if (s == "ANYLAYOUT") { + return DataLayout::kAnyLayout; + } else { + // std::cout << "Unknown storage order string: %s", s; + } + } -inline std::string DataLayoutToString(const DataLayout &data_layout) { - switch (data_layout) { - case DataLayout::kNHWC: - return "NHWC"; - case DataLayout::kNCHW: - return "NCHW"; - case DataLayout::kAnyLayout: - return "ANY_LAYOUT"; - default: - break; - // std::cout << "unknown DataLayou %d", data_layout; - } -} + inline std::string DataLayoutToString(const DataLayout &data_layout) { + switch (data_layout) { + case DataLayout::kNHWC: + return "NHWC"; + case DataLayout::kNCHW: + return "NCHW"; + case DataLayout::kAnyLayout: + return "ANY_LAYOUT"; + default: + break; + // std::cout << "unknown DataLayou %d", data_layout; + } + } -inline std::ostream &operator<<(std::ostream &out, const DataLayout &l) { - out << DataLayoutToString(l); - return out; -} + inline std::ostream &operator<<(std::ostream &out, + const DataLayout &l) { + out << DataLayoutToString(l); + return out; + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/data_transform.cpp b/src/framework/data_transform.cpp index cdb184c3c22793c1e45e5caea0715725927dd98d..2b9cab381ccc00b648c80258a9ebb0799a010995 100644 --- a/src/framework/data_transform.cpp +++ b/src/framework/data_transform.cpp @@ -21,67 +21,72 @@ SOFTWARE. #include "data_transform.h" namespace paddle_mobile { -namespace framework { + namespace framework { -static void PassTensorData(Tensor *from, Tensor *to) { - to->ShareDataWith(*from); - *from = Tensor(); -} + static void PassTensorData(Tensor *from, Tensor *to) { + to->ShareDataWith(*from); + *from = Tensor(); + } -void DataTransform(const OpKernelType &expected_kernel_type, - const OpKernelType &kernel_type_for_var, - const Tensor &input_tensor, Tensor *output_tensor) { - bool transformed = false; - Tensor in; - in.ShareDataWith(input_tensor); - Tensor out; + void DataTransform(const OpKernelType &expected_kernel_type, + const OpKernelType &kernel_type_for_var, + const Tensor &input_tensor, Tensor *output_tensor) { + bool transformed = false; + Tensor in; + in.ShareDataWith(input_tensor); + Tensor out; - // // do layout transform - // if (NeedTransformLayout(expected_kernel_type.data_layout_, - // kernel_type_for_var.data_layout_)) { - // TransDataLayout(kernel_type_for_var, expected_kernel_type, in, &out); - // transformed = true; - // PassTensorData(&out, &in); - // } - // - // // do data type transform - // if (expected_kernel_type.data_type_ != kernel_type_for_var.data_type_) { - // TransDataType(kernel_type_for_var, expected_kernel_type, in, &out); - // transformed = true; - // PassTensorData(&out, &in); - // } - // - // // do device transform - // if (!platform::is_same_place(kernel_type_for_var.place_, - // expected_kernel_type.place_)) { - // TransDataDevice(in, expected_kernel_type.place_, &out); - // transformed = true; - // PassTensorData(&out, &in); - // } - // - // PADDLE_ENFORCE(transformed, "No transform is applied, please check!"); - // get output data - output_tensor->ShareDataWith(in); -} + // // do layout transform + // if (NeedTransformLayout(expected_kernel_type.data_layout_, + // kernel_type_for_var.data_layout_)) { + // TransDataLayout(kernel_type_for_var, expected_kernel_type, in, + // &out); + // transformed = true; + // PassTensorData(&out, &in); + // } + // + // // do data type transform + // if (expected_kernel_type.data_type_ != + // kernel_type_for_var.data_type_) { + // TransDataType(kernel_type_for_var, expected_kernel_type, in, + // &out); + // transformed = true; + // PassTensorData(&out, &in); + // } + // + // // do device transform + // if (!platform::is_same_place(kernel_type_for_var.place_, + // expected_kernel_type.place_)) { + // TransDataDevice(in, expected_kernel_type.place_, &out); + // transformed = true; + // PassTensorData(&out, &in); + // } + // + // PADDLE_ENFORCE(transformed, "No transform is applied, please + // check!"); + // get output data + output_tensor->ShareDataWith(in); + } -void CopyVariableWithTensor(const Variable &in_var, const Tensor &tensor, - Variable &out_var) { - // if (in_var.IsType()) { - // auto& in_lod_tensor = in_var.Get(); - // auto* tran_lod_tensor = out_var.GetMutable(); - // tran_lod_tensor->set_lod(in_lod_tensor.lod()); - // tran_lod_tensor->set_layout(in_lod_tensor.layout()); - // tran_lod_tensor->ShareDataWith(tensor); - // } else if (in_var.IsType()) { - // auto& in_selected_rows = in_var.Get(); - // auto* trans_selected_rows = out_var.GetMutable(); - // trans_selected_rows->set_height(in_selected_rows.height()); - // trans_selected_rows->set_rows(in_selected_rows.rows()); - // trans_selected_rows->mutable_value()->ShareDataWith(tensor); - // } else { - // PADDLE_THROW("unknown var type"); - // } -} + void CopyVariableWithTensor(const Variable &in_var, + const Tensor &tensor, Variable &out_var) { + // if (in_var.IsType()) { + // auto& in_lod_tensor = in_var.Get(); + // auto* tran_lod_tensor = out_var.GetMutable(); + // tran_lod_tensor->set_lod(in_lod_tensor.lod()); + // tran_lod_tensor->set_layout(in_lod_tensor.layout()); + // tran_lod_tensor->ShareDataWith(tensor); + // } else if (in_var.IsType()) { + // auto& in_selected_rows = in_var.Get(); + // auto* trans_selected_rows = + // out_var.GetMutable(); + // trans_selected_rows->set_height(in_selected_rows.height()); + // trans_selected_rows->set_rows(in_selected_rows.rows()); + // trans_selected_rows->mutable_value()->ShareDataWith(tensor); + // } else { + // PADDLE_THROW("unknown var type"); + // } + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/data_transform.h b/src/framework/data_transform.h index 13ffdfb39d297694d8a8d62a34e56b6468e9ad8c..8851b096c661f5111f04b948d3ae521d846ae2c4 100644 --- a/src/framework/data_transform.h +++ b/src/framework/data_transform.h @@ -28,14 +28,14 @@ SOFTWARE. #include "variable.h" namespace paddle_mobile { -namespace framework { + namespace framework { -void DataTransform(const OpKernelType &expected_kernel_type, - const OpKernelType &kernel_type_for_var, - const Tensor &input_tensor, Tensor *out); + void DataTransform(const OpKernelType &expected_kernel_type, + const OpKernelType &kernel_type_for_var, + const Tensor &input_tensor, Tensor *out); -void CopyVariableWithTensor(const Variable &in_var, const Tensor &tensor, - Variable &out_var); + void CopyVariableWithTensor(const Variable &in_var, + const Tensor &tensor, Variable &out_var); -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/data_type.h b/src/framework/data_type.h index 9593c60ed0d3f580d3328661eef831450a3dc197..9683211797b070b1d9e6a3c70e5d98d9c33891c5 100644 --- a/src/framework/data_type.h +++ b/src/framework/data_type.h @@ -21,23 +21,23 @@ SOFTWARE. #include "framework.pb.h" namespace paddle_mobile { -namespace framework { + namespace framework { -// inline proto::VarType::Type ToDataType(std::type_index type) { -// using namespace paddle_mobile::framework::proto; -// if (typeid(float).hash_code() == type.hash_code()) { -// return proto::VarType::FP32; -// } else if (typeid(double).hash_code() == type.hash_code()) { -// return proto::VarType::FP64; -// } else if (typeid(int).hash_code() == type.hash_code()) { -// return proto::VarType::INT32; -// } else if (typeid(int64_t).hash_code() == type.hash_code()) { -// return proto::VarType::INT64; -// } else if (typeid(bool).hash_code() == type.hash_code()) { -// return proto::VarType::BOOL; -// } else { -//// PADDLE_THROW("Not supported"); -// } -// } -} + // inline proto::VarType::Type ToDataType(std::type_index type) { + // using namespace paddle_mobile::framework::proto; + // if (typeid(float).hash_code() == type.hash_code()) { + // return proto::VarType::FP32; + // } else if (typeid(double).hash_code() == type.hash_code()) { + // return proto::VarType::FP64; + // } else if (typeid(int).hash_code() == type.hash_code()) { + // return proto::VarType::INT32; + // } else if (typeid(int64_t).hash_code() == type.hash_code()) { + // return proto::VarType::INT64; + // } else if (typeid(bool).hash_code() == type.hash_code()) { + // return proto::VarType::BOOL; + // } else { + //// PADDLE_THROW("Not supported"); + // } + // } + } } // namespace paddle_mobile diff --git a/src/framework/ddim.cc b/src/framework/ddim.cc index ae368bdd75b503201c5f728933c53ee9dedf066d..20998979ca5788bb4c84ec399fe7a53fd052cce4 100644 --- a/src/framework/ddim.cc +++ b/src/framework/ddim.cc @@ -15,311 +15,320 @@ limitations under the License. */ #include "ddim.h" namespace paddle_mobile { -namespace framework { - -/// @cond HIDDEN - -template Dim make_dim(const int64_t *d) { - return Dim(*d, make_dim(d + 1)); -} - -template <> Dim<0> make_dim<0>(const int64_t *d) { return Dim<0>(*d); } - -void make_ddim(DDim &ddim, const int64_t *dims, int n) { - switch (n) { - case 0: - ddim = make_dim<0>(dims); - break; - case 1: - ddim = make_dim<1>(dims); - break; - case 2: - ddim = make_dim<2>(dims); - break; - case 3: - ddim = make_dim<3>(dims); - break; - case 4: - ddim = make_dim<4>(dims); - break; - case 5: - ddim = make_dim<5>(dims); - break; - case 6: - ddim = make_dim<6>(dims); - break; - case 7: - ddim = make_dim<7>(dims); - break; - case 8: - ddim = make_dim<8>(dims); - break; - case 9: - ddim = make_dim<9>(dims); - break; - default: - // std::cout << "Dynamic dimensions must have between [1, 9] - // dimensions."; - break; - } -} - -/// @endcond - -DDim make_ddim(std::initializer_list dims) { - DDim result(make_dim(0)); - make_ddim(result, dims.begin(), dims.size()); - return result; -} - -DDim make_ddim(const std::vector &dims) { - DDim result(make_dim(0)); - make_ddim(result, &dims[0], dims.size()); - return result; -} - -DDim make_ddim(const std::vector &dims) { - std::vector res(dims.size()); - std::transform(dims.begin(), dims.end(), res.begin(), - [](int d) { return static_cast(d); }); - return make_ddim(res); -} - -/// @cond HIDDEN -// XXX For some reason, putting this in an anonymous namespace causes errors -struct DynamicMutableIndexer : Vistor { -public: - explicit DynamicMutableIndexer(int idx) : idx_(idx) {} - - template int64_t &operator()(Dim &dim) const { return dim[idx_]; } - -private: - int idx_; -}; - -struct DynamicConstIndexer : public Vistor { -public: - explicit DynamicConstIndexer(int idx) : idx_(idx) {} - - template int64_t operator()(const Dim &dim) const { - return dim[idx_]; - } - -private: - int idx_; -}; - -/// @endcond - -int64_t &DDim::operator[](int idx) { - return DDim::ApplyVistor(DynamicMutableIndexer(idx), *this); -} - -int64_t DDim::operator[](int idx) const { - return DDim::ApplyVistor(DynamicConstIndexer(idx), *this); -} - -int DDim::size() const { return arity(*this); } - -bool DDim::operator==(DDim d) const { - // if (var.which() != d.getVar().which()) { - // return false; - // } else { - std::vector v1 = vectorize(*this); - std::vector v2 = vectorize(d); - - for (unsigned int i = 0; i < v1.size(); i++) { - if (v1[i] != v2[i]) { - return false; - } - } - - return true; - // } -} - -bool DDim::operator!=(DDim d) const { return !(*this == d); } - -DDim DDim::operator+(DDim d) const { - std::vector v1 = vectorize(*this); - std::vector v2 = vectorize(d); - - std::vector v3; - - assert(v1.size() == v2.size()); - - for (unsigned int i = 0; i < v1.size(); i++) { - v3.push_back(v1[i] + v2[i]); - } - - return make_ddim(v3); -} - -DDim DDim::operator*(DDim d) const { - std::vector v1 = vectorize(*this); - std::vector v2 = vectorize(d); - - std::vector v3; - - assert(v1.size() == v2.size()); - - for (unsigned int i = 0; i < v1.size(); i++) { - v3.push_back(v1[i] * v2[i]); - } - - return make_ddim(v3); -} - -int64_t get(const DDim &ddim, int idx) { return ddim[idx]; } - -void set(DDim &ddim, int idx, int value) { ddim[idx] = value; } - -/// @cond HIDDEN -struct VectorizeVisitor : Vistor { - std::vector &vector; - - explicit VectorizeVisitor(std::vector &v) : vector(v) {} - - template void operator()(const T &t) { - vector.push_back(t.head); - this->operator()(t.tail); - } - - void operator()(const Dim<0> &t) {} -}; -/// @endcond - -std::vector vectorize(const DDim &ddim) { - std::vector result; - VectorizeVisitor visitor(result); - DDim::ApplyVistor(visitor, ddim); - return result; -} - -// NOTE: framework::vectorize converts to type int64_t -// which does not fit cudnn inputs. -std::vector vectorize2int(const DDim &ddim) { - std::vector temp = vectorize(ddim); - std::vector result(temp.begin(), temp.end()); - return result; -} - -struct ProductVisitor : Vistor { - template int64_t operator()(const Dim &dim) { - return product(dim); - } -}; - -int64_t product(const DDim &ddim) { - ProductVisitor visitor; - return DDim::ApplyVistor(visitor, ddim); -} - -struct SliceVectorizeVisitor : Vistor { - std::vector &vector; - int begin; - int end; - - SliceVectorizeVisitor(std::vector &v, int b, int e) - : vector(v), begin(b), end(e) { - // PADDLE_ENFORCE(begin < end, - // "Begin index must be less than end index in ddim - // slice."); - // PADDLE_ENFORCE(begin >= 0, - // "Begin index can't be less than zero in ddim slice."); - } - - template void operator()(const Dim &dim) { - if (begin == 0) { - vector.push_back(dim.head); - } else { - --begin; - } - --end; - if (end > 0) { - this->operator()(dim.tail); - } - } - - void operator()(const Dim<0> &dim) { - // PADDLE_ENFORCE(end == 0, "End index in ddim slice is out of bound."); - } -}; - -DDim slice_ddim(const DDim &ddim, int begin, int end) { - std::vector vec; - vec.reserve(end - begin); - SliceVectorizeVisitor visitor(vec, begin, end); - // boost::apply_visitor(visitor, dim); - DDim::ApplyVistor(visitor, ddim); - // visitor(ddim.var.Get>()); - return make_ddim(vec); -} - -/// \cond HIDDEN - -struct ArityVisitor : Vistor { - template int operator()(Dim) const { return D; } -}; - -/// \endcond - -int arity(const DDim &d) { - ArityVisitor arityVisitor = ArityVisitor(); - return DDim::ApplyVistor(arityVisitor, d); - // return arityVisitor(d.var.Get>()); - // return boost::apply_visitor(ArityVisitor(), d); } -} -/// \cond HIDDEN - -/// \endcond - -struct OSVistor : Vistor { - OSVistor(std::ostream &os) : os_(os) {} - - template std::ostream &operator()(Dim dim) const { - return os_ << dim; - } - -private: - std::ostream &os_; -}; - -std::ostream &operator<<(std::ostream &os, const DDim &ddim) { - auto vistor = OSVistor(os); - DDim::ApplyVistor(vistor, ddim); - return os; -} - -DDim::DDim(std::initializer_list init_list) { - *this = make_ddim(init_list); -} - -DDim flatten_to_2d(const DDim &src, int num_col_dims) { - int rank = src.size(); - return make_ddim({product(slice_ddim(src, 0, num_col_dims)), - product(slice_ddim(src, num_col_dims, rank))}); -} - -DDim flatten_to_1d(const DDim &src) { return make_ddim({product(src)}); } - -DDim stride(const DDim &ddim) { - std::vector strides(ddim.size()); - strides[ddim.size() - 1] = 1; - for (int i = ddim.size() - 2; i >= 0; --i) { - strides[i] = strides[i + 1] * ddim[i + 1]; - } - return framework::make_ddim(strides); -} - -DDim stride_numel(const framework::DDim &ddim) { - std::vector strides(ddim.size()); - strides[ddim.size() - 1] = ddim[ddim.size() - 1]; - for (int i = ddim.size() - 2; i >= 0; --i) { - strides[i] = strides[i + 1] * ddim[i]; - } - return framework::make_ddim(strides); -} - -} // namespace framework + namespace framework { + + /// @cond HIDDEN + + template Dim make_dim(const int64_t *d) { + return Dim(*d, make_dim(d + 1)); + } + + template <> Dim<0> make_dim<0>(const int64_t *d) { return Dim<0>(*d); } + + void make_ddim(DDim &ddim, const int64_t *dims, int n) { + switch (n) { + case 0: + ddim = make_dim<0>(dims); + break; + case 1: + ddim = make_dim<1>(dims); + break; + case 2: + ddim = make_dim<2>(dims); + break; + case 3: + ddim = make_dim<3>(dims); + break; + case 4: + ddim = make_dim<4>(dims); + break; + case 5: + ddim = make_dim<5>(dims); + break; + case 6: + ddim = make_dim<6>(dims); + break; + case 7: + ddim = make_dim<7>(dims); + break; + case 8: + ddim = make_dim<8>(dims); + break; + case 9: + ddim = make_dim<9>(dims); + break; + default: + // std::cout << "Dynamic dimensions must have between [1, + // 9] + // dimensions."; + break; + } + } + + /// @endcond + + DDim make_ddim(std::initializer_list dims) { + DDim result(make_dim(0)); + make_ddim(result, dims.begin(), dims.size()); + return result; + } + + DDim make_ddim(const std::vector &dims) { + DDim result(make_dim(0)); + make_ddim(result, &dims[0], dims.size()); + return result; + } + + DDim make_ddim(const std::vector &dims) { + std::vector res(dims.size()); + std::transform(dims.begin(), dims.end(), res.begin(), + [](int d) { return static_cast(d); }); + return make_ddim(res); + } + + /// @cond HIDDEN + // XXX For some reason, putting this in an anonymous namespace causes + // errors + struct DynamicMutableIndexer : Vistor { + public: + explicit DynamicMutableIndexer(int idx) : idx_(idx) {} + + template int64_t &operator()(Dim &dim) const { + return dim[idx_]; + } + + private: + int idx_; + }; + + struct DynamicConstIndexer : public Vistor { + public: + explicit DynamicConstIndexer(int idx) : idx_(idx) {} + + template int64_t operator()(const Dim &dim) const { + return dim[idx_]; + } + + private: + int idx_; + }; + + /// @endcond + + int64_t &DDim::operator[](int idx) { + return DDim::ApplyVistor(DynamicMutableIndexer(idx), *this); + } + + int64_t DDim::operator[](int idx) const { + return DDim::ApplyVistor(DynamicConstIndexer(idx), *this); + } + + int DDim::size() const { return arity(*this); } + + bool DDim::operator==(DDim d) const { + // if (var.which() != d.getVar().which()) { + // return false; + // } else { + std::vector v1 = vectorize(*this); + std::vector v2 = vectorize(d); + + for (unsigned int i = 0; i < v1.size(); i++) { + if (v1[i] != v2[i]) { + return false; + } + } + + return true; + // } + } + + bool DDim::operator!=(DDim d) const { return !(*this == d); } + + DDim DDim::operator+(DDim d) const { + std::vector v1 = vectorize(*this); + std::vector v2 = vectorize(d); + + std::vector v3; + + assert(v1.size() == v2.size()); + + for (unsigned int i = 0; i < v1.size(); i++) { + v3.push_back(v1[i] + v2[i]); + } + + return make_ddim(v3); + } + + DDim DDim::operator*(DDim d) const { + std::vector v1 = vectorize(*this); + std::vector v2 = vectorize(d); + + std::vector v3; + + assert(v1.size() == v2.size()); + + for (unsigned int i = 0; i < v1.size(); i++) { + v3.push_back(v1[i] * v2[i]); + } + + return make_ddim(v3); + } + + int64_t get(const DDim &ddim, int idx) { return ddim[idx]; } + + void set(DDim &ddim, int idx, int value) { ddim[idx] = value; } + + /// @cond HIDDEN + struct VectorizeVisitor : Vistor { + std::vector &vector; + + explicit VectorizeVisitor(std::vector &v) : vector(v) {} + + template void operator()(const T &t) { + vector.push_back(t.head); + this->operator()(t.tail); + } + + void operator()(const Dim<0> &t) {} + }; + /// @endcond + + std::vector vectorize(const DDim &ddim) { + std::vector result; + VectorizeVisitor visitor(result); + DDim::ApplyVistor(visitor, ddim); + return result; + } + + // NOTE: framework::vectorize converts to type int64_t + // which does not fit cudnn inputs. + std::vector vectorize2int(const DDim &ddim) { + std::vector temp = vectorize(ddim); + std::vector result(temp.begin(), temp.end()); + return result; + } + + struct ProductVisitor : Vistor { + template int64_t operator()(const Dim &dim) { + return product(dim); + } + }; + + int64_t product(const DDim &ddim) { + ProductVisitor visitor; + return DDim::ApplyVistor(visitor, ddim); + } + + struct SliceVectorizeVisitor : Vistor { + std::vector &vector; + int begin; + int end; + + SliceVectorizeVisitor(std::vector &v, int b, int e) + : vector(v), begin(b), end(e) { + // PADDLE_ENFORCE(begin < end, + // "Begin index must be less than end index in + // ddim + // slice."); + // PADDLE_ENFORCE(begin >= 0, + // "Begin index can't be less than zero in + // ddim slice."); + } + + template void operator()(const Dim &dim) { + if (begin == 0) { + vector.push_back(dim.head); + } else { + --begin; + } + --end; + if (end > 0) { + this->operator()(dim.tail); + } + } + + void operator()(const Dim<0> &dim) { + // PADDLE_ENFORCE(end == 0, "End index in ddim slice is out + // of bound."); + } + }; + + DDim slice_ddim(const DDim &ddim, int begin, int end) { + std::vector vec; + vec.reserve(end - begin); + SliceVectorizeVisitor visitor(vec, begin, end); + // boost::apply_visitor(visitor, dim); + DDim::ApplyVistor(visitor, ddim); + // visitor(ddim.var.Get>()); + return make_ddim(vec); + } + + /// \cond HIDDEN + + struct ArityVisitor : Vistor { + template int operator()(Dim) const { return D; } + }; + + /// \endcond + + int arity(const DDim &d) { + ArityVisitor arityVisitor = ArityVisitor(); + return DDim::ApplyVistor(arityVisitor, d); + // return arityVisitor(d.var.Get>()); + // return boost::apply_visitor(ArityVisitor(), d); } + } + /// \cond HIDDEN + + /// \endcond + + struct OSVistor : Vistor { + OSVistor(std::ostream &os) : os_(os) {} + + template std::ostream &operator()(Dim dim) const { + return os_ << dim; + } + + private: + std::ostream &os_; + }; + + std::ostream &operator<<(std::ostream &os, const DDim &ddim) { + auto vistor = OSVistor(os); + DDim::ApplyVistor(vistor, ddim); + return os; + } + + DDim::DDim(std::initializer_list init_list) { + *this = make_ddim(init_list); + } + + DDim flatten_to_2d(const DDim &src, int num_col_dims) { + int rank = src.size(); + return make_ddim({product(slice_ddim(src, 0, num_col_dims)), + product(slice_ddim(src, num_col_dims, rank))}); + } + + DDim flatten_to_1d(const DDim &src) { + return make_ddim({product(src)}); + } + + DDim stride(const DDim &ddim) { + std::vector strides(ddim.size()); + strides[ddim.size() - 1] = 1; + for (int i = ddim.size() - 2; i >= 0; --i) { + strides[i] = strides[i + 1] * ddim[i + 1]; + } + return framework::make_ddim(strides); + } + + DDim stride_numel(const framework::DDim &ddim) { + std::vector strides(ddim.size()); + strides[ddim.size() - 1] = ddim[ddim.size() - 1]; + for (int i = ddim.size() - 2; i >= 0; --i) { + strides[i] = strides[i + 1] * ddim[i]; + } + return framework::make_ddim(strides); + } + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/ddim.h b/src/framework/ddim.h index 8378c77de5899b119cbfa89d9f7fadca946f56ea..15b306f62d96c0aebf733aeb9ba4f256a62c36c6 100644 --- a/src/framework/ddim.h +++ b/src/framework/ddim.h @@ -22,140 +22,145 @@ limitations under the License. */ #include namespace paddle_mobile { -namespace framework { - -/** - * \brief A dynamically sized dimension. - * - * The number of dimensions must be between [1, 9]. - */ -struct DDim { - typedef Variant, Dim<1>, Dim<2>, Dim<3>, Dim<4>, Dim<5>, Dim<6>, - Dim<7>, Dim<8>, Dim<9>> - DDimVar; - DDimVar var; - - template - static typename Vistor::type_t ApplyVistor(Vistor vistor, const DDim &d) { - if (d.var.TypeId() == typeid(Dim<0>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<1>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<2>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<3>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<4>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<5>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<6>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<7>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<8>).hash_code()) { - return vistor(d.var.Get>()); - } else if (d.var.TypeId() == typeid(Dim<9>).hash_code()) { - return vistor(d.var.Get>()); - } else { - printf(" dim not support \n"); - throw std::bad_exception(); - // return typename Vistor::type_t(); - } - } - - DDim() { var.Set>(Dim<1>()); } - - template explicit DDim(const Dim &in) { var.Set>(in); } - - /*implicit*/ DDim(std::initializer_list init_list); - - template DDim &operator=(const Dim &in) { - var.Set>(in); - return *this; - } - - int64_t &operator[](int idx); - - int64_t operator[](int idx) const; - - // template - // typename Visitor::result_type apply_visitor(Visitor& visitor) { - // return var.apply_visitor(visitor); - // } - // - // template - // typename Visitor::result_type apply_visitor(Visitor& visitor) const { - // return var.apply_visitor(visitor); - // } - - DDimVar getVar() { return var; } - - bool operator==(DDim d) const; - - bool operator!=(DDim d) const; - - DDim operator+(DDim d) const; - - DDim operator*(DDim d) const; - - int size() const; -}; - -/** - * \brief Make a DDim from std::vector - * - * \param dims An vector of ints. Must be sized between [1, 9] - */ -DDim make_ddim(const std::vector &dims); - -DDim make_ddim(const std::vector &dims); - -/** - * \brief Make a DDim from an initializer list - * - * \param dims An initializer list of ints. Must be sized between [1, 9] - * - */ -DDim make_ddim(std::initializer_list dims); - -int64_t get(const DDim &dim, int idx); - -void set(DDim &dim, int idx, int val); - -std::vector vectorize(const DDim &ddim); - -std::vector vectorize2int(const DDim &ddim); - -int64_t product(const DDim &ddim); - -/** - * \brief Slice a ddim - * - * Slice dim with [begin, end). - * e.g. DDim d = make_ddim({1,2,3,4,5}); - * slice_ddim(d, 1, 3); ====> {2,3} - */ -DDim slice_ddim(const DDim &dim, int begin, int end); - -/** - * \brief What is the length of this dimension? - * - * \param Dynamic dimension to inspect - */ + namespace framework { + + /** + * \brief A dynamically sized dimension. + * + * The number of dimensions must be between [1, 9]. + */ + struct DDim { + typedef Variant, Dim<1>, Dim<2>, Dim<3>, Dim<4>, Dim<5>, + Dim<6>, Dim<7>, Dim<8>, Dim<9>> + DDimVar; + DDimVar var; + + template + static typename Vistor::type_t ApplyVistor(Vistor vistor, + const DDim &d) { + if (d.var.TypeId() == typeid(Dim<0>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<1>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<2>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<3>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<4>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<5>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<6>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<7>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<8>).hash_code()) { + return vistor(d.var.Get>()); + } else if (d.var.TypeId() == typeid(Dim<9>).hash_code()) { + return vistor(d.var.Get>()); + } else { + printf(" dim not support \n"); + throw std::bad_exception(); + // return typename Vistor::type_t(); + } + } + + DDim() { var.Set>(Dim<1>()); } + + template explicit DDim(const Dim &in) { + var.Set>(in); + } + + /*implicit*/ DDim(std::initializer_list init_list); + + template DDim &operator=(const Dim &in) { + var.Set>(in); + return *this; + } + + int64_t &operator[](int idx); + + int64_t operator[](int idx) const; + + // template + // typename Visitor::result_type apply_visitor(Visitor& visitor) { + // return var.apply_visitor(visitor); + // } + // + // template + // typename Visitor::result_type apply_visitor(Visitor& visitor) + // const { + // return var.apply_visitor(visitor); + // } + + DDimVar getVar() { return var; } + + bool operator==(DDim d) const; + + bool operator!=(DDim d) const; + + DDim operator+(DDim d) const; + + DDim operator*(DDim d) const; + + int size() const; + }; + + /** + * \brief Make a DDim from std::vector + * + * \param dims An vector of ints. Must be sized between [1, 9] + */ + DDim make_ddim(const std::vector &dims); + + DDim make_ddim(const std::vector &dims); + + /** + * \brief Make a DDim from an initializer list + * + * \param dims An initializer list of ints. Must be sized between [1, 9] + * + */ + DDim make_ddim(std::initializer_list dims); + + int64_t get(const DDim &dim, int idx); + + void set(DDim &dim, int idx, int val); + + std::vector vectorize(const DDim &ddim); + + std::vector vectorize2int(const DDim &ddim); + + int64_t product(const DDim &ddim); + + /** + * \brief Slice a ddim + * + * Slice dim with [begin, end). + * e.g. DDim d = make_ddim({1,2,3,4,5}); + * slice_ddim(d, 1, 3); ====> {2,3} + */ + DDim slice_ddim(const DDim &dim, int begin, int end); + + /** + * \brief What is the length of this dimension? + * + * \param Dynamic dimension to inspect + */ -int arity(const DDim &ddim); + int arity(const DDim &ddim); -std::ostream &operator<<(std::ostream &, const DDim &); + std::ostream &operator<<(std::ostream &, const DDim &); -// Reshape a tensor to a matrix. The matrix's first dimension(column length) -// will be the product of tensor's first `num_col_dims` dimensions. -DDim flatten_to_2d(const DDim &src, int num_col_dims); + // Reshape a tensor to a matrix. The matrix's first dimension(column + // length) + // will be the product of tensor's first `num_col_dims` dimensions. + DDim flatten_to_2d(const DDim &src, int num_col_dims); -DDim flatten_to_1d(const DDim &src); + DDim flatten_to_1d(const DDim &src); -DDim stride(const DDim &ddim); + DDim stride(const DDim &ddim); -DDim stride_numel(const DDim &ddim); -} // namespace framework + DDim stride_numel(const DDim &ddim); + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/dim.h b/src/framework/dim.h index 6525d468f69462f1bd54a90e6e9f39e130f8b571..7be68ee3391ce3cede6476ce0f240c63fe682d0c 100644 --- a/src/framework/dim.h +++ b/src/framework/dim.h @@ -21,388 +21,410 @@ #include "platform/hostdevice.h" namespace paddle_mobile { -namespace framework { + namespace framework { -// Statically sized, statically indexed dimension -template struct Dim { - static constexpr int dimensions = i; + // Statically sized, statically indexed dimension + template struct Dim { + static constexpr int dimensions = i; - template - HOSTDEVICE Dim(int64_t _head, Args... _tail) : head(_head), tail(_tail...) { - static_assert(sizeof...(_tail) == i - 1, - "Dim initialized with the wrong number of parameters"); - } + template + HOSTDEVICE Dim(int64_t _head, Args... _tail) + : head(_head), tail(_tail...) { + static_assert( + sizeof...(_tail) == i - 1, + "Dim initialized with the wrong number of parameters"); + } - HOSTDEVICE - Dim(int64_t _head, const Dim &_tail) : head(_head), tail(_tail) {} + HOSTDEVICE + Dim(int64_t _head, const Dim &_tail) + : head(_head), tail(_tail) {} - HOSTDEVICE - Dim() : head(0), tail() {} + HOSTDEVICE + Dim() : head(0), tail() {} - /** Construct a Dim from a linear index and size. Uses Fortran order - * indexing. */ - HOSTDEVICE - Dim(int64_t idx, const Dim &size) - : head(idx % size.head), tail(idx / size.head, size.tail) {} + /** Construct a Dim from a linear index and size. Uses Fortran + * order + * indexing. */ + HOSTDEVICE + Dim(int64_t idx, const Dim &size) + : head(idx % size.head), tail(idx / size.head, size.tail) {} - /** Construct a Dim with each dimension set to the given index */ - HOSTDEVICE - Dim(int64_t idx) : head(idx), tail(idx) {} + /** Construct a Dim with each dimension set to the given index */ + HOSTDEVICE + Dim(int64_t idx) : head(idx), tail(idx) {} - HOSTDEVICE - bool operator==(const Dim &o) const { - return (head == o.head) && (tail == o.tail); - } + HOSTDEVICE + bool operator==(const Dim &o) const { + return (head == o.head) && (tail == o.tail); + } - HOSTDEVICE - bool operator!=(const Dim &o) const { return !(*this == o); } + HOSTDEVICE + bool operator!=(const Dim &o) const { return !(*this == o); } - HOSTDEVICE - int64_t &operator[](int idx); - HOSTDEVICE - int64_t operator[](int idx) const; + HOSTDEVICE + int64_t &operator[](int idx); + HOSTDEVICE + int64_t operator[](int idx) const; - HOST std::string to_string() const; + HOST std::string to_string() const; - int64_t head; - Dim tail; -}; + int64_t head; + Dim tail; + }; -// Base case specialization -template <> struct Dim<0> { - static constexpr int dimensions = 0; + // Base case specialization + template <> struct Dim<0> { + static constexpr int dimensions = 0; - HOSTDEVICE - Dim(int64_t _head) {} + HOSTDEVICE + Dim(int64_t _head) {} - HOSTDEVICE - Dim() {} + HOSTDEVICE + Dim() {} - HOSTDEVICE - Dim(int idx, const Dim<0> &size) { + HOSTDEVICE + Dim(int idx, const Dim<0> &size) { #ifndef __CUDA_ARCH__ - if (idx > 0) { - throw std::invalid_argument("Index out of range."); - } + if (idx > 0) { + throw std::invalid_argument("Index out of range."); + } #else - PADDLE_ASSERT(idx == 0); + PADDLE_ASSERT(idx == 0); #endif - } - - HOSTDEVICE - bool operator==(const Dim<0> &o) const { return true; } - - HOSTDEVICE - bool operator!=(const Dim<0> &o) const { return false; } - - HOSTDEVICE - int64_t &operator[](int idx); - HOSTDEVICE - int64_t operator[](int idx) const; -}; - -namespace { - -// Helper for accessing Dim classes -template struct DimGetter { - // Return a copy if Dim is const - template HOSTDEVICE static int64_t impl(const D &d) { - return DimGetter::impl(d.tail); - } - // Return a reference if Dim is mutable - template HOSTDEVICE static int64_t &impl(D &d) { - return DimGetter::impl(d.tail); - } -}; - -// Eureka! We found the element! -template <> struct DimGetter<0> { - // Return a copy if Dim is const - template HOSTDEVICE static int64_t impl(const D &d) { - return d.head; - } - // Return a reference if Dim is mutable - template HOSTDEVICE static int64_t &impl(D &d) { return d.head; } -}; - -template HOSTDEVICE int64_t &indexer(Dim &dim, int idx) { + } + + HOSTDEVICE + bool operator==(const Dim<0> &o) const { return true; } + + HOSTDEVICE + bool operator!=(const Dim<0> &o) const { return false; } + + HOSTDEVICE + int64_t &operator[](int idx); + HOSTDEVICE + int64_t operator[](int idx) const; + }; + + namespace { + + // Helper for accessing Dim classes + template struct DimGetter { + // Return a copy if Dim is const + template + HOSTDEVICE static int64_t impl(const D &d) { + return DimGetter::impl(d.tail); + } + // Return a reference if Dim is mutable + template HOSTDEVICE static int64_t &impl(D &d) { + return DimGetter::impl(d.tail); + } + }; + + // Eureka! We found the element! + template <> struct DimGetter<0> { + // Return a copy if Dim is const + template + HOSTDEVICE static int64_t impl(const D &d) { + return d.head; + } + // Return a reference if Dim is mutable + template HOSTDEVICE static int64_t &impl(D &d) { + return d.head; + } + }; + + template HOSTDEVICE int64_t &indexer(Dim &dim, int idx) { #ifndef __CUDA_ARCH__ - if (idx < 0) { - throw std::invalid_argument("Tried to access a negative dimension"); - } + if (idx < 0) { + throw std::invalid_argument( + "Tried to access a negative dimension"); + } #else - PADDLE_ASSERT(idx >= 0); + PADDLE_ASSERT(idx >= 0); #endif - if (idx == 0) { - return dim.head; - } - return indexer(dim.tail, idx - 1); -} + if (idx == 0) { + return dim.head; + } + return indexer(dim.tail, idx - 1); + } -template <> HOSTDEVICE int64_t &indexer<0>(Dim<0> &dim, int idx) { + template <> HOSTDEVICE int64_t &indexer<0>(Dim<0> &dim, int idx) { #ifndef __CUDA_ARCH__ - throw std::invalid_argument("Invalid index"); + throw std::invalid_argument("Invalid index"); #else - PADDLE_ASSERT(false); + PADDLE_ASSERT(false); #if CUDA_VERSION < 8000 - // On CUDA versions previous to 8.0, only __shared__ variables - // could be declared as static in the device code. - int64_t head = 0; + // On CUDA versions previous to 8.0, only __shared__ variables + // could be declared as static in the device code. + int64_t head = 0; #else - static int64_t head = 0; + static int64_t head = 0; #endif - return head; + return head; #endif -} + } -template HOSTDEVICE int64_t indexer(const Dim &dim, int idx) { + template + HOSTDEVICE int64_t indexer(const Dim &dim, int idx) { #ifndef __CUDA_ARCH__ - if (idx < 0) { - throw std::invalid_argument("Tried to access a negative dimension"); - } + if (idx < 0) { + throw std::invalid_argument( + "Tried to access a negative dimension"); + } #else - PADDLE_ASSERT(idx >= 0); + PADDLE_ASSERT(idx >= 0); #endif - if (idx == 0) { - return dim.head; - } - return indexer(dim.tail, idx - 1); -} - -template <> HOSTDEVICE int64_t indexer<0>(const Dim<0> &dim, int idx) { + if (idx == 0) { + return dim.head; + } + return indexer(dim.tail, idx - 1); + } + + template <> + HOSTDEVICE int64_t indexer<0>(const Dim<0> &dim, int idx) { #ifndef __CUDA_ARCH__ - throw std::invalid_argument("Invalid index"); + throw std::invalid_argument("Invalid index"); #else - PADDLE_ASSERT(false); + PADDLE_ASSERT(false); #if CUDA_VERSION < 8000 - // On CUDA versions previous to 8.0, only __shared__ variables - // could be declared as static in the device code. - int64_t head = 0; + // On CUDA versions previous to 8.0, only __shared__ variables + // could be declared as static in the device code. + int64_t head = 0; #else - static int64_t head = 0; + static int64_t head = 0; #endif - return head; + return head; #endif -} - -} // namespace -// Static access to constant Dim -template HOSTDEVICE int64_t get(const Dim &d) { - return DimGetter::impl(d); -} - -// Static access to mutable Dim -template HOSTDEVICE int64_t &get(Dim &d) { - return DimGetter::impl(d); -} - -// Dynamic access to constant Dim -template HOSTDEVICE int64_t Dim::operator[](int i) const { - // std::cout << "l: " << l << std::endl; - return indexer(*this, i); -} - -// Dynamic access to mutable Dim -template HOSTDEVICE int64_t &Dim::operator[](int i) { - return indexer(*this, i); -} - -// Dynamic access to constant Dim -inline HOSTDEVICE int64_t Dim<0>::operator[](int i) const { - return indexer(*this, i); -} - -// Dynamic access to mutable Dim -inline HOSTDEVICE int64_t &Dim<0>::operator[](int i) { - return indexer(*this, i); -} - -// Dynamic access to constant Dim -// without std::enable_if will try to instantiate this on get<0>(d) -template -HOSTDEVICE typename std::enable_if<(l > 0), int64_t>::type get(const Dim &d, - int i) { - return d[i]; -} - -// Dynamic access to mutable Dim -template -HOSTDEVICE typename std::enable_if<(l > 0), int64_t &>::type get(Dim &d, - int i) { - return d[i]; -} - -// Dot product of two dims -template -HOSTDEVICE int64_t linearize(const Dim &a, const Dim &b) { - return a.head * b.head + linearize(a.tail, b.tail); -} - -// Base case dot product of two Dims -// Notice it is inline because it is no longer a template -template <> -HOSTDEVICE inline int64_t linearize(const Dim<0> &a, const Dim<0> &b) { - return 0; -} - -// Product of a Dim -template HOSTDEVICE int64_t product(const Dim &a, int prod = 1) { - return prod * a.head * product(a.tail); -} - -// Base case product of a Dim -// Notice it is inline because it is no longer a template -template <> HOSTDEVICE inline int64_t product(const Dim<0> &a, int prod) { - return prod; -} - -// Is 0 <= idx_i < size_i for all i? -template -HOSTDEVICE bool contained(const Dim &idx, const Dim &size) { - return ((0 <= idx.head) && (idx.head < size.head) && - contained(idx.tail, size.tail)); -} - -// Base case of is 0 <= idx_i < size_i ? -// Notice it is inline because it is no longer a template -template <> -HOSTDEVICE inline bool contained(const Dim<0> &idx, const Dim<0> &size) { - return true; -} - -/** - * \brief Compute exclusive prefix-multiply of a Dim. - */ -template -HOSTDEVICE Dim ex_prefix_mul(const Dim &src, int mul = 1) { - return Dim(mul, ex_prefix_mul(src.tail, mul * src.head)); -} - -///\cond HIDDEN -// Base case of ex_prefix_mul -// Notice it is inline because it is no longer a template -template <> HOSTDEVICE inline Dim<0> ex_prefix_mul(const Dim<0> &src, int mul) { - return Dim<0>(); -} -///\endcond - -/** - * Add two dimensions together - */ -template HOSTDEVICE Dim dim_plus(const Dim &a, const Dim &b) { - return Dim(a.head + b.head, dim_plus(a.tail, b.tail)); -} - -// Base case -template <> -HOSTDEVICE inline Dim<0> dim_plus(const Dim<0> &a, const Dim<0> &b) { - return Dim<0>(); -} - -template -HOSTDEVICE Dim operator+(const Dim &lhs, const Dim &rhs) { - return dim_plus(lhs, rhs); -} - -/** - * Multiply two dimensions together - */ -template HOSTDEVICE Dim dim_mult(const Dim &a, const Dim &b) { - return Dim(a.head * b.head, dim_mult(a.tail, b.tail)); -} - -// Base case -template <> -HOSTDEVICE inline Dim<0> dim_mult(const Dim<0> &a, const Dim<0> &b) { - return Dim<0>(); -} - -template -HOSTDEVICE Dim operator*(const Dim &lhs, const Dim &rhs) { - return dim_mult(lhs, rhs); -} - -/** - * \brief Normalize strides to ensure any dimension with extent 1 - * has stride 0. - * - * \param size Dim object containing the size of an array - * \param stride Dim object containing stride of an array - * \return Dim object the same size as \p size with normalized strides - * - */ - -template -HOSTDEVICE Dim normalize_strides(const Dim &size, const Dim &stride) { - int norm_stride = size.head == 1 ? 0 : stride.head; - return Dim(norm_stride, normalize_strides(size.tail, stride.tail)); -} - -///\cond HIDDEN - -template <> -HOSTDEVICE inline Dim<0> normalize_strides(const Dim<0> &size, - const Dim<0> &stride) { - return Dim<0>(); -} - -///\endcond - -/** - * Helper function to create a Dim - * - * \param idxes The type of Dim constructed depends on the number of params - * - */ - -template -HOSTDEVICE Dim make_dim(Args... idxes) { - return Dim(idxes...); -} - -// Allows us to output a Dim -// XXX For some reason, overloading fails to resolve this correctly -template -typename std::enable_if<(i > 1), std::ostream &>::type -operator<<(std::ostream &os, const Dim &d) { - os << d.head << ", " << d.tail; - return os; -} - -// Base case that allows us to output a Dim -// XXX I wish this could be an overload instead of a template -template -typename std::enable_if<(i == 1), std::ostream &>::type -operator<<(std::ostream &os, const Dim &d) { - os << d.head; - return os; -} - -inline std::ostream &operator<<(std::ostream &os, const Dim<0> &d) { - return os; -} - -template HOST std::string Dim::to_string() const { - std::stringstream stream; - - stream << *this; - - return stream.str(); -} - -template -HOSTDEVICE Dim linear_to_dimension(int linear_index, Dim extents) { - Dim result; - - for (int i = 0; i < D - 1; ++i) { - result[i] = linear_index % extents[i]; - linear_index /= extents[i]; - } - - result[D - 1] = linear_index; - - return result; -} - -} // namespace framework + } + + } // namespace + // Static access to constant Dim + template HOSTDEVICE int64_t get(const Dim &d) { + return DimGetter::impl(d); + } + + // Static access to mutable Dim + template HOSTDEVICE int64_t &get(Dim &d) { + return DimGetter::impl(d); + } + + // Dynamic access to constant Dim + template HOSTDEVICE int64_t Dim::operator[](int i) const { + // std::cout << "l: " << l << std::endl; + return indexer(*this, i); + } + + // Dynamic access to mutable Dim + template HOSTDEVICE int64_t &Dim::operator[](int i) { + return indexer(*this, i); + } + + // Dynamic access to constant Dim + inline HOSTDEVICE int64_t Dim<0>::operator[](int i) const { + return indexer(*this, i); + } + + // Dynamic access to mutable Dim + inline HOSTDEVICE int64_t &Dim<0>::operator[](int i) { + return indexer(*this, i); + } + + // Dynamic access to constant Dim + // without std::enable_if will try to instantiate this on get<0>(d) + template + HOSTDEVICE typename std::enable_if<(l > 0), int64_t>::type + get(const Dim &d, int i) { + return d[i]; + } + + // Dynamic access to mutable Dim + template + HOSTDEVICE typename std::enable_if<(l > 0), int64_t &>::type + get(Dim &d, int i) { + return d[i]; + } + + // Dot product of two dims + template + HOSTDEVICE int64_t linearize(const Dim &a, const Dim &b) { + return a.head * b.head + linearize(a.tail, b.tail); + } + + // Base case dot product of two Dims + // Notice it is inline because it is no longer a template + template <> + HOSTDEVICE inline int64_t linearize(const Dim<0> &a, const Dim<0> &b) { + return 0; + } + + // Product of a Dim + template + HOSTDEVICE int64_t product(const Dim &a, int prod = 1) { + return prod * a.head * product(a.tail); + } + + // Base case product of a Dim + // Notice it is inline because it is no longer a template + template <> + HOSTDEVICE inline int64_t product(const Dim<0> &a, int prod) { + return prod; + } + + // Is 0 <= idx_i < size_i for all i? + template + HOSTDEVICE bool contained(const Dim &idx, const Dim &size) { + return ((0 <= idx.head) && (idx.head < size.head) && + contained(idx.tail, size.tail)); + } + + // Base case of is 0 <= idx_i < size_i ? + // Notice it is inline because it is no longer a template + template <> + HOSTDEVICE inline bool contained(const Dim<0> &idx, + const Dim<0> &size) { + return true; + } + + /** + * \brief Compute exclusive prefix-multiply of a Dim. + */ + template + HOSTDEVICE Dim ex_prefix_mul(const Dim &src, int mul = 1) { + return Dim(mul, ex_prefix_mul(src.tail, mul * src.head)); + } + + ///\cond HIDDEN + // Base case of ex_prefix_mul + // Notice it is inline because it is no longer a template + template <> + HOSTDEVICE inline Dim<0> ex_prefix_mul(const Dim<0> &src, int mul) { + return Dim<0>(); + } + ///\endcond + + /** + * Add two dimensions together + */ + template + HOSTDEVICE Dim dim_plus(const Dim &a, const Dim &b) { + return Dim(a.head + b.head, dim_plus(a.tail, b.tail)); + } + + // Base case + template <> + HOSTDEVICE inline Dim<0> dim_plus(const Dim<0> &a, const Dim<0> &b) { + return Dim<0>(); + } + + template + HOSTDEVICE Dim operator+(const Dim &lhs, const Dim &rhs) { + return dim_plus(lhs, rhs); + } + + /** + * Multiply two dimensions together + */ + template + HOSTDEVICE Dim dim_mult(const Dim &a, const Dim &b) { + return Dim(a.head * b.head, dim_mult(a.tail, b.tail)); + } + + // Base case + template <> + HOSTDEVICE inline Dim<0> dim_mult(const Dim<0> &a, const Dim<0> &b) { + return Dim<0>(); + } + + template + HOSTDEVICE Dim operator*(const Dim &lhs, const Dim &rhs) { + return dim_mult(lhs, rhs); + } + + /** + * \brief Normalize strides to ensure any dimension with extent 1 + * has stride 0. + * + * \param size Dim object containing the size of an array + * \param stride Dim object containing stride of an array + * \return Dim object the same size as \p size with normalized strides + * + */ + + template + HOSTDEVICE Dim normalize_strides(const Dim &size, + const Dim &stride) { + int norm_stride = size.head == 1 ? 0 : stride.head; + return Dim(norm_stride, + normalize_strides(size.tail, stride.tail)); + } + + ///\cond HIDDEN + + template <> + HOSTDEVICE inline Dim<0> normalize_strides(const Dim<0> &size, + const Dim<0> &stride) { + return Dim<0>(); + } + + ///\endcond + + /** + * Helper function to create a Dim + * + * \param idxes The type of Dim constructed depends on the number of + * params + * + */ + + template + HOSTDEVICE Dim make_dim(Args... idxes) { + return Dim(idxes...); + } + + // Allows us to output a Dim + // XXX For some reason, overloading fails to resolve this correctly + template + typename std::enable_if<(i > 1), std::ostream &>::type + operator<<(std::ostream &os, const Dim &d) { + os << d.head << ", " << d.tail; + return os; + } + + // Base case that allows us to output a Dim + // XXX I wish this could be an overload instead of a template + template + typename std::enable_if<(i == 1), std::ostream &>::type + operator<<(std::ostream &os, const Dim &d) { + os << d.head; + return os; + } + + inline std::ostream &operator<<(std::ostream &os, const Dim<0> &d) { + return os; + } + + template HOST std::string Dim::to_string() const { + std::stringstream stream; + + stream << *this; + + return stream.str(); + } + + template + HOSTDEVICE Dim linear_to_dimension(int linear_index, + Dim extents) { + Dim result; + + for (int i = 0; i < D - 1; ++i) { + result[i] = linear_index % extents[i]; + linear_index /= extents[i]; + } + + result[D - 1] = linear_index; + + return result; + } + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/executor.cpp b/src/framework/executor.cpp index 1459f04de5055c02a991b37cb33f5e611ce3959b..c0ebe397609a37791eadeb6a73841d70edd7127f 100644 --- a/src/framework/executor.cpp +++ b/src/framework/executor.cpp @@ -23,84 +23,93 @@ SOFTWARE. #include "variable.h" namespace paddle_mobile { -namespace framework { + namespace framework { -template -Executor::Executor(const Program p) : program_(p) { - if (use_optimize_) { - to_predict_program_ = program_.optimizeProgram; - } else { - to_predict_program_ = program_.originProgram; - } + template + Executor::Executor(const Program p) : program_(p) { + if (use_optimize_) { + to_predict_program_ = program_.optimizeProgram; + } else { + to_predict_program_ = program_.originProgram; + } - const std::vector> blocks = - to_predict_program_->Blocks(); - // std::cout << " **block size " << blocks.size() << std::endl; - for (int i = 0; i < blocks.size(); ++i) { - std::shared_ptr block_desc = blocks[i]; - std::vector> ops = block_desc->Ops(); - // std::cout << " ops " << ops.size() << std::endl; - for (int j = 0; j < ops.size(); ++j) { - std::shared_ptr op = ops[j]; - // std::cout << " input 0 " << op->Input("Input")[0] << std::endl; - if (op->Type() == "conv2d" && op->Input("Input")[0] == "pixel") { - // std::cout << " conv2d attr size: " << op->GetAttrMap().size() - // << std::endl; - // std::cout << " input size: " << op->GetInputs().size() << - // std::endl; + const std::vector> blocks = + to_predict_program_->Blocks(); + // std::cout << " **block size " << blocks.size() << std::endl; + for (int i = 0; i < blocks.size(); ++i) { + std::shared_ptr block_desc = blocks[i]; + std::vector> ops = block_desc->Ops(); + // std::cout << " ops " << ops.size() << std::endl; + for (int j = 0; j < ops.size(); ++j) { + std::shared_ptr op = ops[j]; + // std::cout << " input 0 " << op->Input("Input")[0] + // << std::endl; + if (op->Type() == "conv2d" && + op->Input("Input")[0] == "pixel") { + // std::cout << " conv2d attr size: " << + // op->GetAttrMap().size() + // << std::endl; + // std::cout << " input size: " << + // op->GetInputs().size() << + // std::endl; - // std::cout << " output size: " << op->GetOutputs().size() << - // std::endl; + // std::cout << " output size: " << + // op->GetOutputs().size() << + // std::endl; - Attribute strides_attr = op->GetAttrMap().at("strides"); - std::vector stride = strides_attr.Get>(); - for (int k = 0; k < stride.size(); ++k) { - // std::cout << " stride " << stride[k] << std::endl; - } + Attribute strides_attr = op->GetAttrMap().at("strides"); + std::vector stride = + strides_attr.Get>(); + for (int k = 0; k < stride.size(); ++k) { + // std::cout << " stride " << stride[k] << + // std::endl; + } - std::shared_ptr> conv = - std::make_shared>( - op->Type(), op->GetInputs(), op->GetOutputs(), op->GetAttrMap(), - program_.scope); - ops_of_block_[*block_desc.get()].push_back(conv); - } - } - } -} + std::shared_ptr> conv = + std::make_shared>( + op->Type(), op->GetInputs(), op->GetOutputs(), + op->GetAttrMap(), program_.scope); + ops_of_block_[*block_desc.get()].push_back(conv); + } + } + } + } -template -std::shared_ptr Executor::predict(Tensor &t) { - // feed - auto scope = program_.scope; - Variable *g_feed_value = scope->Var("pixel"); - auto tensor = g_feed_value->GetMutable(); - tensor->ShareDataWith(t); + template + std::shared_ptr Executor::predict(Tensor &t) { + // feed + auto scope = program_.scope; + Variable *g_feed_value = scope->Var("pixel"); + auto tensor = g_feed_value->GetMutable(); + tensor->ShareDataWith(t); - Variable *con_output = scope->Var("conv2d_0.tmp_0"); - Tensor *output_tensor = con_output->GetMutable(); - output_tensor->mutable_data({1, 16, 32, 32}); - // std::cout << typeid(output_tensor).name() << std::endl; - // std::cout << "output_tensor dims: " << output_tensor->dims() << std::endl; + Variable *con_output = scope->Var("conv2d_0.tmp_0"); + Tensor *output_tensor = con_output->GetMutable(); + output_tensor->mutable_data({1, 16, 32, 32}); + // std::cout << typeid(output_tensor).name() << std::endl; + // std::cout << "output_tensor dims: " << output_tensor->dims() << + // std::endl; - std::shared_ptr out_tensor = std::make_shared(); - out_tensor.reset(output_tensor); + std::shared_ptr out_tensor = std::make_shared(); + out_tensor.reset(output_tensor); - predict(t, 0); - return out_tensor; -} + predict(t, 0); + return out_tensor; + } -template -void Executor::predict(const Tensor &t, int block_id) { - std::shared_ptr to_predict_block = - to_predict_program_->Block(block_id); - for (int j = 0; j < ops_of_block_[*to_predict_block.get()].size(); ++j) { - auto op = ops_of_block_[*to_predict_block.get()][j]; - // std::cout << "开始run" << std::endl; - op->Run(); - } -} + template + void Executor::predict(const Tensor &t, int block_id) { + std::shared_ptr to_predict_block = + to_predict_program_->Block(block_id); + for (int j = 0; j < ops_of_block_[*to_predict_block.get()].size(); + ++j) { + auto op = ops_of_block_[*to_predict_block.get()][j]; + // std::cout << "开始run" << std::endl; + op->Run(); + } + } -template class Executor; + template class Executor; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/executor.h b/src/framework/executor.h index 0e6d9a566e8e52ccfac1576cc6dbc1832f769760..dad580f02df746aa1a037daed2a660283148d3f5 100644 --- a/src/framework/executor.h +++ b/src/framework/executor.h @@ -32,22 +32,22 @@ SOFTWARE. #include "variable.h" namespace paddle_mobile { -namespace framework { + namespace framework { -template class Executor { -public: - Executor(const Program p); - std::shared_ptr predict(Tensor &t); + template class Executor { + public: + Executor(const Program p); + std::shared_ptr predict(Tensor &t); -private: - const framework::Program program_; - std::shared_ptr to_predict_program_; - void predict(const Tensor &t, int block_id); - std::map>>> - ops_of_block_; - bool use_optimize_ = false; -}; + private: + const framework::Program program_; + std::shared_ptr to_predict_program_; + void predict(const Tensor &t, int block_id); + std::map>>> + ops_of_block_; + bool use_optimize_ = false; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/framework.pb.cpp b/src/framework/framework.pb.cpp index 0039b030c1d751d6e905be574507f78d2229ee40..d2c68a7f0bf9c136684865416d7c99139201c153 100644 --- a/src/framework/framework.pb.cpp +++ b/src/framework/framework.pb.cpp @@ -15,7937 +15,8722 @@ // @@protoc_insertion_point(includes) namespace paddle_mobile { -namespace framework { -namespace proto { -class OpDesc_AttrDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _OpDesc_Attr_default_instance_; -class OpDesc_VarDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _OpDesc_Var_default_instance_; -class OpDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _OpDesc_default_instance_; -class OpProto_VarDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _OpProto_Var_default_instance_; -class OpProto_AttrDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _OpProto_Attr_default_instance_; -class OpProtoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _OpProto_default_instance_; -class VarType_TensorDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _VarType_TensorDesc_default_instance_; -class VarType_LoDTensorDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _VarType_LoDTensorDesc_default_instance_; -class VarType_LoDTensorArrayDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed< - VarType_LoDTensorArrayDesc> - _instance; -} _VarType_LoDTensorArrayDesc_default_instance_; -class VarType_ReaderDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _VarType_ReaderDesc_default_instance_; -class VarType_ChannelDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; -} _VarType_ChannelDesc_default_instance_; -class VarType_TupleDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _VarType_Tuple_default_instance_; -class VarTypeDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _VarType_default_instance_; -class VarDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _VarDesc_default_instance_; -class BlockDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _BlockDesc_default_instance_; -class ProgramDescDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed _instance; -} _ProgramDesc_default_instance_; - -namespace protobuf_framework_2eproto { - -PROTOBUF_CONSTEXPR_VAR::google::protobuf::internal::ParseTableField const - TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; - -PROTOBUF_CONSTEXPR_VAR::google::protobuf::internal:: - AuxillaryParseTableField const - TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, - {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, -}; - -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _OpDesc_Attr_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OpDesc_Attr_default_instance_); - _OpDesc_Var_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OpDesc_Var_default_instance_); - _OpDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OpDesc_default_instance_); - _OpProto_Var_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OpProto_Var_default_instance_); - _OpProto_Attr_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OpProto_Attr_default_instance_); - _OpProto_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_OpProto_default_instance_); - _VarType_TensorDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_TensorDesc_default_instance_); - _VarType_LoDTensorDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_LoDTensorDesc_default_instance_); - _VarType_LoDTensorArrayDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_LoDTensorArrayDesc_default_instance_); - _VarType_ReaderDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_ReaderDesc_default_instance_); - _VarType_ChannelDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_ChannelDesc_default_instance_); - _VarType_Tuple_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_Tuple_default_instance_); - _VarType_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarType_default_instance_); - _VarDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_VarDesc_default_instance_); - _BlockDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_BlockDesc_default_instance_); - _ProgramDesc_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ProgramDesc_default_instance_); - _VarType_LoDTensorDesc_default_instance_._instance.get_mutable()->tensor_ = - const_cast<::paddle_mobile::framework::proto::VarType_TensorDesc *>( - ::paddle_mobile::framework::proto::VarType_TensorDesc:: - internal_default_instance()); - _VarType_LoDTensorArrayDesc_default_instance_._instance.get_mutable() - ->tensor_ = - const_cast<::paddle_mobile::framework::proto::VarType_TensorDesc *>( - ::paddle_mobile::framework::proto::VarType_TensorDesc:: - internal_default_instance()); - _VarType_default_instance_._instance.get_mutable()->selected_rows_ = - const_cast<::paddle_mobile::framework::proto::VarType_TensorDesc *>( - ::paddle_mobile::framework::proto::VarType_TensorDesc:: - internal_default_instance()); - _VarType_default_instance_._instance.get_mutable()->lod_tensor_ = - const_cast<::paddle_mobile::framework::proto::VarType_LoDTensorDesc *>( - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc:: - internal_default_instance()); - _VarType_default_instance_._instance.get_mutable()->tensor_array_ = - const_cast< - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc *>( - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc:: - internal_default_instance()); - _VarType_default_instance_._instance.get_mutable()->reader_ = - const_cast<::paddle_mobile::framework::proto::VarType_ReaderDesc *>( - ::paddle_mobile::framework::proto::VarType_ReaderDesc:: - internal_default_instance()); - _VarType_default_instance_._instance.get_mutable()->channel_ = - const_cast<::paddle_mobile::framework::proto::VarType_ChannelDesc *>( - ::paddle_mobile::framework::proto::VarType_ChannelDesc:: - internal_default_instance()); - _VarType_default_instance_._instance.get_mutable()->tuple_ = - const_cast<::paddle_mobile::framework::proto::VarType_Tuple *>( - ::paddle_mobile::framework::proto::VarType_Tuple:: - internal_default_instance()); - _VarDesc_default_instance_._instance.get_mutable() - ->type_ = const_cast<::paddle_mobile::framework::proto::VarType *>( - ::paddle_mobile::framework::proto::VarType::internal_default_instance()); -} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { -void AddDescriptorsImpl() { InitDefaults(); } -} // anonymous namespace - -void AddDescriptors() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl); -} - -} // namespace protobuf_framework_2eproto - -bool VarType_Type_IsValid(int value) { - switch (value) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - return true; - default: - return false; - } -} + namespace framework { + namespace proto { + class OpDesc_AttrDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _OpDesc_Attr_default_instance_; + class OpDesc_VarDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _OpDesc_Var_default_instance_; + class OpDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _OpDesc_default_instance_; + class OpProto_VarDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _OpProto_Var_default_instance_; + class OpProto_AttrDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + OpProto_Attr> + _instance; + } _OpProto_Attr_default_instance_; + class OpProtoDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _OpProto_default_instance_; + class VarType_TensorDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + VarType_TensorDesc> + _instance; + } _VarType_TensorDesc_default_instance_; + class VarType_LoDTensorDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + VarType_LoDTensorDesc> + _instance; + } _VarType_LoDTensorDesc_default_instance_; + class VarType_LoDTensorArrayDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + VarType_LoDTensorArrayDesc> + _instance; + } _VarType_LoDTensorArrayDesc_default_instance_; + class VarType_ReaderDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + VarType_ReaderDesc> + _instance; + } _VarType_ReaderDesc_default_instance_; + class VarType_ChannelDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + VarType_ChannelDesc> + _instance; + } _VarType_ChannelDesc_default_instance_; + class VarType_TupleDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed< + VarType_Tuple> + _instance; + } _VarType_Tuple_default_instance_; + class VarTypeDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _VarType_default_instance_; + class VarDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _VarDesc_default_instance_; + class BlockDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _BlockDesc_default_instance_; + class ProgramDescDefaultTypeInternal { + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; + } _ProgramDesc_default_instance_; + + namespace protobuf_framework_2eproto { + + PROTOBUF_CONSTEXPR_VAR::google::protobuf::internal:: + ParseTableField const TableStruct::entries + [] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + {0, 0, 0, + ::google::protobuf::internal::kInvalidMask, 0, 0}, + }; + + PROTOBUF_CONSTEXPR_VAR::google::protobuf::internal:: + AuxillaryParseTableField const + TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + ::google::protobuf::internal:: + AuxillaryParseTableField(), + }; + PROTOBUF_CONSTEXPR_VAR::google::protobuf::internal:: + ParseTable const + TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE( + protodesc_cold) = { + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + {NULL, NULL, 0, -1, -1, -1, -1, NULL, false}, + }; + + void TableStruct::InitDefaultsImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::internal::InitProtobufDefaults(); + _OpDesc_Attr_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_OpDesc_Attr_default_instance_); + _OpDesc_Var_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_OpDesc_Var_default_instance_); + _OpDesc_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_OpDesc_default_instance_); + _OpProto_Var_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_OpProto_Var_default_instance_); + _OpProto_Attr_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_OpProto_Attr_default_instance_); + _OpProto_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_OpProto_default_instance_); + _VarType_TensorDesc_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_TensorDesc_default_instance_); + _VarType_LoDTensorDesc_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_LoDTensorDesc_default_instance_); + _VarType_LoDTensorArrayDesc_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_LoDTensorArrayDesc_default_instance_); + _VarType_ReaderDesc_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_ReaderDesc_default_instance_); + _VarType_ChannelDesc_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_ChannelDesc_default_instance_); + _VarType_Tuple_default_instance_._instance + .DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_Tuple_default_instance_); + _VarType_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarType_default_instance_); + _VarDesc_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_VarDesc_default_instance_); + _BlockDesc_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_BlockDesc_default_instance_); + _ProgramDesc_default_instance_._instance.DefaultConstruct(); + ::google::protobuf::internal::OnShutdownDestroyMessage( + &_ProgramDesc_default_instance_); + _VarType_LoDTensorDesc_default_instance_._instance + .get_mutable() + ->tensor_ = const_cast<::paddle_mobile::framework:: + proto::VarType_TensorDesc *>( + ::paddle_mobile::framework::proto::VarType_TensorDesc:: + internal_default_instance()); + _VarType_LoDTensorArrayDesc_default_instance_._instance + .get_mutable() + ->tensor_ = const_cast<::paddle_mobile::framework:: + proto::VarType_TensorDesc *>( + ::paddle_mobile::framework::proto::VarType_TensorDesc:: + internal_default_instance()); + _VarType_default_instance_._instance.get_mutable() + ->selected_rows_ = const_cast< + ::paddle_mobile::framework::proto::VarType_TensorDesc + *>( + ::paddle_mobile::framework::proto::VarType_TensorDesc:: + internal_default_instance()); + _VarType_default_instance_._instance.get_mutable() + ->lod_tensor_ = const_cast< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *>( + ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc::internal_default_instance()); + _VarType_default_instance_._instance.get_mutable() + ->tensor_array_ = + const_cast<::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc *>( + ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc:: + internal_default_instance()); + _VarType_default_instance_._instance.get_mutable() + ->reader_ = const_cast<::paddle_mobile::framework:: + proto::VarType_ReaderDesc *>( + ::paddle_mobile::framework::proto::VarType_ReaderDesc:: + internal_default_instance()); + _VarType_default_instance_._instance.get_mutable() + ->channel_ = const_cast< + ::paddle_mobile::framework::proto::VarType_ChannelDesc + *>( + ::paddle_mobile::framework::proto::VarType_ChannelDesc:: + internal_default_instance()); + _VarType_default_instance_._instance.get_mutable()->tuple_ = + const_cast< + ::paddle_mobile::framework::proto::VarType_Tuple *>( + ::paddle_mobile::framework::proto::VarType_Tuple:: + internal_default_instance()); + _VarDesc_default_instance_._instance.get_mutable()->type_ = + const_cast< + ::paddle_mobile::framework::proto::VarType *>( + ::paddle_mobile::framework::proto::VarType:: + internal_default_instance()); + } + + void InitDefaults() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit( + &once, &TableStruct::InitDefaultsImpl); + } + namespace { + void AddDescriptorsImpl() { InitDefaults(); } + } // anonymous namespace + + void AddDescriptors() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, + &AddDescriptorsImpl); + } + + } // namespace protobuf_framework_2eproto + + bool VarType_Type_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + return true; + default: + return false; + } + } #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const VarType_Type VarType::BOOL; -const VarType_Type VarType::INT16; -const VarType_Type VarType::INT32; -const VarType_Type VarType::INT64; -const VarType_Type VarType::FP16; -const VarType_Type VarType::FP32; -const VarType_Type VarType::FP64; -const VarType_Type VarType::LOD_TENSOR; -const VarType_Type VarType::SELECTED_ROWS; -const VarType_Type VarType::FEED_MINIBATCH; -const VarType_Type VarType::FETCH_LIST; -const VarType_Type VarType::STEP_SCOPES; -const VarType_Type VarType::LOD_RANK_TABLE; -const VarType_Type VarType::LOD_TENSOR_ARRAY; -const VarType_Type VarType::PLACE_LIST; -const VarType_Type VarType::READER; -const VarType_Type VarType::CHANNEL; -const VarType_Type VarType::RAW; -const VarType_Type VarType::TUPLE; -const VarType_Type VarType::Type_MIN; -const VarType_Type VarType::Type_MAX; -const int VarType::Type_ARRAYSIZE; + const VarType_Type VarType::BOOL; + const VarType_Type VarType::INT16; + const VarType_Type VarType::INT32; + const VarType_Type VarType::INT64; + const VarType_Type VarType::FP16; + const VarType_Type VarType::FP32; + const VarType_Type VarType::FP64; + const VarType_Type VarType::LOD_TENSOR; + const VarType_Type VarType::SELECTED_ROWS; + const VarType_Type VarType::FEED_MINIBATCH; + const VarType_Type VarType::FETCH_LIST; + const VarType_Type VarType::STEP_SCOPES; + const VarType_Type VarType::LOD_RANK_TABLE; + const VarType_Type VarType::LOD_TENSOR_ARRAY; + const VarType_Type VarType::PLACE_LIST; + const VarType_Type VarType::READER; + const VarType_Type VarType::CHANNEL; + const VarType_Type VarType::RAW; + const VarType_Type VarType::TUPLE; + const VarType_Type VarType::Type_MIN; + const VarType_Type VarType::Type_MAX; + const int VarType::Type_ARRAYSIZE; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -bool AttrType_IsValid(int value) { - switch (value) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - return true; - default: - return false; - } -} + bool AttrType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + return true; + default: + return false; + } + } // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int OpDesc_Attr::kNameFieldNumber; -const int OpDesc_Attr::kTypeFieldNumber; -const int OpDesc_Attr::kIFieldNumber; -const int OpDesc_Attr::kFFieldNumber; -const int OpDesc_Attr::kSFieldNumber; -const int OpDesc_Attr::kIntsFieldNumber; -const int OpDesc_Attr::kFloatsFieldNumber; -const int OpDesc_Attr::kStringsFieldNumber; -const int OpDesc_Attr::kBFieldNumber; -const int OpDesc_Attr::kBoolsFieldNumber; -const int OpDesc_Attr::kBlockIdxFieldNumber; -const int OpDesc_Attr::kLFieldNumber; + const int OpDesc_Attr::kNameFieldNumber; + const int OpDesc_Attr::kTypeFieldNumber; + const int OpDesc_Attr::kIFieldNumber; + const int OpDesc_Attr::kFFieldNumber; + const int OpDesc_Attr::kSFieldNumber; + const int OpDesc_Attr::kIntsFieldNumber; + const int OpDesc_Attr::kFloatsFieldNumber; + const int OpDesc_Attr::kStringsFieldNumber; + const int OpDesc_Attr::kBFieldNumber; + const int OpDesc_Attr::kBoolsFieldNumber; + const int OpDesc_Attr::kBlockIdxFieldNumber; + const int OpDesc_Attr::kLFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -OpDesc_Attr::OpDesc_Attr() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpDesc.Attr) -} -OpDesc_Attr::OpDesc_Attr(const OpDesc_Attr &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), ints_(from.ints_), - floats_(from.floats_), strings_(from.strings_), bools_(from.bools_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_name()) { - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - s_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_s()) { - s_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.s_); - } - ::memcpy(&type_, &from.type_, - static_cast(reinterpret_cast(&block_idx_) - - reinterpret_cast(&type_)) + - sizeof(block_idx_)); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpDesc.Attr) -} - -void OpDesc_Attr::SharedCtor() { - _cached_size_ = 0; - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - s_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&type_, 0, - static_cast(reinterpret_cast(&block_idx_) - - reinterpret_cast(&type_)) + - sizeof(block_idx_)); -} - -OpDesc_Attr::~OpDesc_Attr() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpDesc.Attr) - SharedDtor(); -} - -void OpDesc_Attr::SharedDtor() { - name_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - s_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void OpDesc_Attr::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const OpDesc_Attr &OpDesc_Attr::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -OpDesc_Attr *OpDesc_Attr::New(::google::protobuf::Arena *arena) const { - OpDesc_Attr *n = new OpDesc_Attr; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void OpDesc_Attr::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpDesc.Attr) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - ints_.Clear(); - floats_.Clear(); - strings_.Clear(); - bools_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - GOOGLE_DCHECK(!name_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(!s_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*s_.UnsafeRawStringPointer())->clear(); - } - } - if (cached_has_bits & 252u) { - ::memset(&type_, 0, - static_cast(reinterpret_cast(&block_idx_) - + OpDesc_Attr::OpDesc_Attr() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpDesc.Attr) + } + OpDesc_Attr::OpDesc_Attr(const OpDesc_Attr &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + ints_(from.ints_), floats_(from.floats_), + strings_(from.strings_), bools_(from.bools_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_name()) { + name_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + s_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_s()) { + s_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.s_); + } + ::memcpy( + &type_, &from.type_, + static_cast(reinterpret_cast(&block_idx_) - + reinterpret_cast(&type_)) + + sizeof(block_idx_)); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpDesc.Attr) + } + + void OpDesc_Attr::SharedCtor() { + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + s_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + ::memset(&type_, 0, static_cast( + reinterpret_cast(&block_idx_) - + reinterpret_cast(&type_)) + + sizeof(block_idx_)); + } + + OpDesc_Attr::~OpDesc_Attr() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpDesc.Attr) + SharedDtor(); + } + + void OpDesc_Attr::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + s_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + void OpDesc_Attr::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const OpDesc_Attr &OpDesc_Attr::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + OpDesc_Attr * + OpDesc_Attr::New(::google::protobuf::Arena *arena) const { + OpDesc_Attr *n = new OpDesc_Attr; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void OpDesc_Attr::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpDesc.Attr) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + ints_.Clear(); + floats_.Clear(); + strings_.Clear(); + bools_.Clear(); + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(!name_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*name_.UnsafeRawStringPointer())->clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK( + !s_.IsDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*s_.UnsafeRawStringPointer())->clear(); + } + } + if (cached_has_bits & 252u) { + ::memset(&type_, 0, + static_cast( + reinterpret_cast(&block_idx_) - reinterpret_cast(&type_)) + - sizeof(block_idx_)); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool OpDesc_Attr::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + sizeof(block_idx_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool OpDesc_Attr::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpDesc.Attr) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - } else { - goto handle_unusual; - } - break; - } - - // required .paddle_mobile.framework.proto.AttrType type = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::paddle_mobile::framework::proto::AttrType_IsValid(value)) { - set_type( - static_cast<::paddle_mobile::framework::proto::AttrType>(value)); - } else { - unknown_fields_stream.WriteVarint32(16u); - unknown_fields_stream.WriteVarint32( - static_cast<::google::protobuf::uint32>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional int32 i = 3; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { - set_has_i(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(input, - &i_))); - } else { - goto handle_unusual; - } - break; - } - - // optional float f = 4; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(37u /* 37 & 0xFF */)) { - set_has_f(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - input, &f_))); - } else { - goto handle_unusual; - } - break; - } - - // optional string s = 5; - case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_s())); - } else { - goto handle_unusual; - } - break; - } - - // repeated int32 ints = 6; - case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(48u /* 48 & 0xFF */)) { - DO_(( - ::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - 1, 48u, input, this->mutable_ints()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite:: - ReadPackedPrimitiveNoInline< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, this->mutable_ints()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated float floats = 7; - case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(61u /* 61 & 0xFF */)) { - DO_(( - ::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< - float, - ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - 1, 61u, input, this->mutable_floats()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(58u /* 58 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite:: - ReadPackedPrimitiveNoInline< - float, - ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( - input, this->mutable_floats()))); - } else { - goto handle_unusual; - } - break; - } - - // repeated string strings = 8; - case 8: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(66u /* 66 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_strings())); - } else { - goto handle_unusual; - } - break; - } - - // optional bool b = 10; - case 10: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(80u /* 80 & 0xFF */)) { - set_has_b(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &b_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated bool bools = 11; - case 11: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(88u /* 88 & 0xFF */)) { - DO_(( - ::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - 1, 88u, input, this->mutable_bools()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(90u /* 90 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite:: - ReadPackedPrimitiveNoInline< - bool, - ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, this->mutable_bools()))); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 block_idx = 12; - case 12: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(96u /* 96 & 0xFF */)) { - set_has_block_idx(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &block_idx_))); - } else { - goto handle_unusual; - } - break; - } - - // optional int64 l = 13; - case 13: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(104u /* 104 & 0xFF */)) { - set_has_l(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, - ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(input, - &l_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpDesc.Attr) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpDesc.Attr) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpDesc.Attr) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_name())); + } else { + goto handle_unusual; + } + break; + } + + // required .paddle_mobile.framework.proto.AttrType type = + // 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + int, ::google::protobuf::internal:: + WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::paddle_mobile::framework::proto:: + AttrType_IsValid(value)) { + set_type( + static_cast<::paddle_mobile::framework:: + proto::AttrType>(value)); + } else { + unknown_fields_stream.WriteVarint32(16u); + unknown_fields_stream.WriteVarint32( + static_cast<::google::protobuf::uint32>( + value)); + } + } else { + goto handle_unusual; + } + break; + } + + // optional int32 i = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 24u /* 24 & 0xFF */)) { + set_has_i(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>(input, + &i_))); + } else { + goto handle_unusual; + } + break; + } + + // optional float f = 4; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 37u /* 37 & 0xFF */)) { + set_has_f(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + float, ::google::protobuf::internal:: + WireFormatLite::TYPE_FLOAT>( + input, &f_))); + } else { + goto handle_unusual; + } + break; + } + + // optional string s = 5; + case 5: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 42u /* 42 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_s())); + } else { + goto handle_unusual; + } + break; + } + + // repeated int32 ints = 6; + case 6: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 48u /* 48 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadRepeatedPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + 1, 48u, input, this->mutable_ints()))); + } else if (static_cast<::google::protobuf::uint8>( + tag) == + static_cast<::google::protobuf::uint8>( + 50u /* 50 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPackedPrimitiveNoInline< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, this->mutable_ints()))); + } else { + goto handle_unusual; + } + break; + } + + // repeated float floats = 7; + case 7: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 61u /* 61 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadRepeatedPrimitive< + float, ::google::protobuf::internal:: + WireFormatLite::TYPE_FLOAT>( + 1, 61u, input, + this->mutable_floats()))); + } else if (static_cast<::google::protobuf::uint8>( + tag) == + static_cast<::google::protobuf::uint8>( + 58u /* 58 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPackedPrimitiveNoInline< + float, ::google::protobuf::internal:: + WireFormatLite::TYPE_FLOAT>( + input, this->mutable_floats()))); + } else { + goto handle_unusual; + } + break; + } + + // repeated string strings = 8; + case 8: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 66u /* 66 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->add_strings())); + } else { + goto handle_unusual; + } + break; + } + + // optional bool b = 10; + case 10: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 80u /* 80 & 0xFF */)) { + set_has_b(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &b_))); + } else { + goto handle_unusual; + } + break; + } + + // repeated bool bools = 11; + case 11: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 88u /* 88 & 0xFF */)) { + DO_(( + ::google::protobuf::internal::WireFormatLite:: + ReadRepeatedPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + 1, 88u, input, this->mutable_bools()))); + } else if (static_cast<::google::protobuf::uint8>( + tag) == + static_cast<::google::protobuf::uint8>( + 90u /* 90 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPackedPrimitiveNoInline< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, this->mutable_bools()))); + } else { + goto handle_unusual; + } + break; + } + + // optional int32 block_idx = 12; + case 12: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 96u /* 96 & 0xFF */)) { + set_has_block_idx(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, &block_idx_))); + } else { + goto handle_unusual; + } + break; + } + + // optional int64 l = 13; + case 13: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 104u /* 104 & 0xFF */)) { + set_has_l(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int64, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT64>(input, + &l_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpDesc.Attr) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpDesc.Attr) + return false; #undef DO_ -} - -void OpDesc_Attr::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpDesc.Attr) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required string name = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->name(), output); - } - - // required .paddle_mobile.framework.proto.AttrType type = 2; - if (cached_has_bits & 0x00000004u) { - ::google::protobuf::internal::WireFormatLite::WriteEnum(2, this->type(), - output); - } - - // optional int32 i = 3; - if (cached_has_bits & 0x00000008u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->i(), - output); - } - - // optional float f = 4; - if (cached_has_bits & 0x00000010u) { - ::google::protobuf::internal::WireFormatLite::WriteFloat(4, this->f(), - output); - } - - // optional string s = 5; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 5, this->s(), output); - } - - // repeated int32 ints = 6; - for (int i = 0, n = this->ints_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->ints(i), - output); - } - - // repeated float floats = 7; - for (int i = 0, n = this->floats_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteFloat(7, this->floats(i), - output); - } - - // repeated string strings = 8; - for (int i = 0, n = this->strings_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 8, this->strings(i), output); - } - - // optional bool b = 10; - if (cached_has_bits & 0x00000020u) { - ::google::protobuf::internal::WireFormatLite::WriteBool(10, this->b(), - output); - } - - // repeated bool bools = 11; - for (int i = 0, n = this->bools_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteBool(11, this->bools(i), - output); - } - - // optional int32 block_idx = 12; - if (cached_has_bits & 0x00000080u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32( - 12, this->block_idx(), output); - } - - // optional int64 l = 13; - if (cached_has_bits & 0x00000040u) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(13, this->l(), - output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpDesc.Attr) -} - -size_t OpDesc_Attr::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpDesc.Attr) - size_t total_size = 0; - - if (has_name()) { - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - if (has_type()) { - // required .paddle_mobile.framework.proto.AttrType type = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->type()); - } - - return total_size; -} -size_t OpDesc_Attr::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpDesc.Attr) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000005) ^ 0x00000005) == - 0) { // All required fields are present. - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - - // required .paddle_mobile.framework.proto.AttrType type = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->type()); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - // repeated int32 ints = 6; - { - size_t data_size = - ::google::protobuf::internal::WireFormatLite::Int32Size(this->ints_); - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this->ints_size()); - total_size += data_size; - } - - // repeated float floats = 7; - { - unsigned int count = static_cast(this->floats_size()); - size_t data_size = 4UL * count; - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this->floats_size()); - total_size += data_size; - } - - // repeated string strings = 8; - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this->strings_size()); - for (int i = 0, n = this->strings_size(); i < n; i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->strings(i)); - } - - // repeated bool bools = 11; - { - unsigned int count = static_cast(this->bools_size()); - size_t data_size = 1UL * count; - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this->bools_size()); - total_size += data_size; - } - - // optional string s = 5; - if (has_s()) { - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::StringSize(this->s()); - } - - if (_has_bits_[0 / 32] & 248u) { - // optional int32 i = 3; - if (has_i()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->i()); - } - - // optional float f = 4; - if (has_f()) { - total_size += 1 + 4; - } - - // optional bool b = 10; - if (has_b()) { - total_size += 1 + 1; - } - - // optional int64 l = 13; - if (has_l()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int64Size( - this->l()); - } - - // optional int32 block_idx = 12; - if (has_block_idx()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->block_idx()); - } - } - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void OpDesc_Attr::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void OpDesc_Attr::MergeFrom(const OpDesc_Attr &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpDesc.Attr) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - ints_.MergeFrom(from.ints_); - floats_.MergeFrom(from.floats_); - strings_.MergeFrom(from.strings_); - bools_.MergeFrom(from.bools_); - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 255u) { - if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - if (cached_has_bits & 0x00000002u) { - set_has_s(); - s_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.s_); - } - if (cached_has_bits & 0x00000004u) { - type_ = from.type_; - } - if (cached_has_bits & 0x00000008u) { - i_ = from.i_; - } - if (cached_has_bits & 0x00000010u) { - f_ = from.f_; - } - if (cached_has_bits & 0x00000020u) { - b_ = from.b_; - } - if (cached_has_bits & 0x00000040u) { - l_ = from.l_; - } - if (cached_has_bits & 0x00000080u) { - block_idx_ = from.block_idx_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void OpDesc_Attr::CopyFrom(const OpDesc_Attr &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpDesc.Attr) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool OpDesc_Attr::IsInitialized() const { - if ((_has_bits_[0] & 0x00000005) != 0x00000005) - return false; - return true; -} - -void OpDesc_Attr::Swap(OpDesc_Attr *other) { - if (other == this) - return; - InternalSwap(other); -} -void OpDesc_Attr::InternalSwap(OpDesc_Attr *other) { - using std::swap; - ints_.InternalSwap(&other->ints_); - floats_.InternalSwap(&other->floats_); - strings_.InternalSwap(&other->strings_); - bools_.InternalSwap(&other->bools_); - name_.Swap(&other->name_); - s_.Swap(&other->s_); - swap(type_, other->type_); - swap(i_, other->i_); - swap(f_, other->f_); - swap(b_, other->b_); - swap(l_, other->l_); - swap(block_idx_, other->block_idx_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string OpDesc_Attr::GetTypeName() const { - return "paddle_mobile.framework.proto.OpDesc.Attr"; -} + } + + void OpDesc_Attr::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpDesc.Attr) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required string name = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(1, this->name(), output); + } + + // required .paddle_mobile.framework.proto.AttrType type = 2; + if (cached_has_bits & 0x00000004u) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 2, this->type(), output); + } + + // optional int32 i = 3; + if (cached_has_bits & 0x00000008u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 3, this->i(), output); + } + + // optional float f = 4; + if (cached_has_bits & 0x00000010u) { + ::google::protobuf::internal::WireFormatLite::WriteFloat( + 4, this->f(), output); + } + + // optional string s = 5; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(5, this->s(), output); + } + + // repeated int32 ints = 6; + for (int i = 0, n = this->ints_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 6, this->ints(i), output); + } + + // repeated float floats = 7; + for (int i = 0, n = this->floats_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteFloat( + 7, this->floats(i), output); + } + + // repeated string strings = 8; + for (int i = 0, n = this->strings_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 8, this->strings(i), output); + } + + // optional bool b = 10; + if (cached_has_bits & 0x00000020u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 10, this->b(), output); + } + + // repeated bool bools = 11; + for (int i = 0, n = this->bools_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 11, this->bools(i), output); + } + + // optional int32 block_idx = 12; + if (cached_has_bits & 0x00000080u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 12, this->block_idx(), output); + } + + // optional int64 l = 13; + if (cached_has_bits & 0x00000040u) { + ::google::protobuf::internal::WireFormatLite::WriteInt64( + 13, this->l(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpDesc.Attr) + } + + size_t OpDesc_Attr::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpDesc.Attr) + size_t total_size = 0; + + if (has_name()) { + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + } + + if (has_type()) { + // required .paddle_mobile.framework.proto.AttrType type = + // 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->type()); + } + + return total_size; + } + size_t OpDesc_Attr::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpDesc.Attr) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000005) ^ 0x00000005) == + 0) { // All required fields are present. + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + + // required .paddle_mobile.framework.proto.AttrType type = + // 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->type()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + // repeated int32 ints = 6; + { + size_t data_size = + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->ints_); + total_size += 1 * ::google::protobuf::internal::FromIntSize( + this->ints_size()); + total_size += data_size; + } + + // repeated float floats = 7; + { + unsigned int count = + static_cast(this->floats_size()); + size_t data_size = 4UL * count; + total_size += 1 * ::google::protobuf::internal::FromIntSize( + this->floats_size()); + total_size += data_size; + } + + // repeated string strings = 8; + total_size += 1 * ::google::protobuf::internal::FromIntSize( + this->strings_size()); + for (int i = 0, n = this->strings_size(); i < n; i++) { + total_size += ::google::protobuf::internal::WireFormatLite:: + StringSize(this->strings(i)); + } + + // repeated bool bools = 11; + { + unsigned int count = + static_cast(this->bools_size()); + size_t data_size = 1UL * count; + total_size += 1 * ::google::protobuf::internal::FromIntSize( + this->bools_size()); + total_size += data_size; + } + + // optional string s = 5; + if (has_s()) { + total_size += 1 + ::google::protobuf::internal:: + WireFormatLite::StringSize(this->s()); + } + + if (_has_bits_[0 / 32] & 248u) { + // optional int32 i = 3; + if (has_i()) { + total_size += 1 + + ::google::protobuf::internal:: + WireFormatLite::Int32Size(this->i()); + } + + // optional float f = 4; + if (has_f()) { + total_size += 1 + 4; + } + + // optional bool b = 10; + if (has_b()) { + total_size += 1 + 1; + } + + // optional int64 l = 13; + if (has_l()) { + total_size += 1 + + ::google::protobuf::internal:: + WireFormatLite::Int64Size(this->l()); + } + + // optional int32 block_idx = 12; + if (has_block_idx()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->block_idx()); + } + } + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void OpDesc_Attr::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void OpDesc_Attr::MergeFrom(const OpDesc_Attr &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpDesc.Attr) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + ints_.MergeFrom(from.ints_); + floats_.MergeFrom(from.floats_); + strings_.MergeFrom(from.strings_); + bools_.MergeFrom(from.bools_); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 255u) { + if (cached_has_bits & 0x00000001u) { + set_has_name(); + name_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + if (cached_has_bits & 0x00000002u) { + set_has_s(); + s_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.s_); + } + if (cached_has_bits & 0x00000004u) { + type_ = from.type_; + } + if (cached_has_bits & 0x00000008u) { + i_ = from.i_; + } + if (cached_has_bits & 0x00000010u) { + f_ = from.f_; + } + if (cached_has_bits & 0x00000020u) { + b_ = from.b_; + } + if (cached_has_bits & 0x00000040u) { + l_ = from.l_; + } + if (cached_has_bits & 0x00000080u) { + block_idx_ = from.block_idx_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void OpDesc_Attr::CopyFrom(const OpDesc_Attr &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpDesc.Attr) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool OpDesc_Attr::IsInitialized() const { + if ((_has_bits_[0] & 0x00000005) != 0x00000005) + return false; + return true; + } + + void OpDesc_Attr::Swap(OpDesc_Attr *other) { + if (other == this) + return; + InternalSwap(other); + } + void OpDesc_Attr::InternalSwap(OpDesc_Attr *other) { + using std::swap; + ints_.InternalSwap(&other->ints_); + floats_.InternalSwap(&other->floats_); + strings_.InternalSwap(&other->strings_); + bools_.InternalSwap(&other->bools_); + name_.Swap(&other->name_); + s_.Swap(&other->s_); + swap(type_, other->type_); + swap(i_, other->i_); + swap(f_, other->f_); + swap(b_, other->b_); + swap(l_, other->l_); + swap(block_idx_, other->block_idx_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string OpDesc_Attr::GetTypeName() const { + return "paddle_mobile.framework.proto.OpDesc.Attr"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// OpDesc_Attr - -// required string name = 1; -bool OpDesc_Attr::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void OpDesc_Attr::set_has_name() { _has_bits_[0] |= 0x00000001u; } -void OpDesc_Attr::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -void OpDesc_Attr::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string &OpDesc_Attr::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.name) - return name_.GetNoArena(); -} -void OpDesc_Attr::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.name) -} + // OpDesc_Attr + + // required string name = 1; + bool OpDesc_Attr::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void OpDesc_Attr::set_has_name() { _has_bits_[0] |= 0x00000001u; } + void OpDesc_Attr::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + void OpDesc_Attr::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + const ::std::string &OpDesc_Attr::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.name) + return name_.GetNoArena(); + } + void OpDesc_Attr::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.name) + } #if LANG_CXX11 -void OpDesc_Attr::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.name) -} + void OpDesc_Attr::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.name) + } #endif -void OpDesc_Attr::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.name) -} -void OpDesc_Attr::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.name) -} -::std::string *OpDesc_Attr::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpDesc_Attr::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpDesc_Attr::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.name) -} - -// required .paddle_mobile.framework.proto.AttrType type = 2; -bool OpDesc_Attr::has_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void OpDesc_Attr::set_has_type() { _has_bits_[0] |= 0x00000004u; } -void OpDesc_Attr::clear_has_type() { _has_bits_[0] &= ~0x00000004u; } -void OpDesc_Attr::clear_type() { - type_ = 0; - clear_has_type(); -} -::paddle_mobile::framework::proto::AttrType OpDesc_Attr::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.type) - return static_cast<::paddle_mobile::framework::proto::AttrType>(type_); -} -void OpDesc_Attr::set_type(::paddle_mobile::framework::proto::AttrType value) { - assert(::paddle_mobile::framework::proto::AttrType_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.type) -} - -// optional int32 i = 3; -bool OpDesc_Attr::has_i() const { return (_has_bits_[0] & 0x00000008u) != 0; } -void OpDesc_Attr::set_has_i() { _has_bits_[0] |= 0x00000008u; } -void OpDesc_Attr::clear_has_i() { _has_bits_[0] &= ~0x00000008u; } -void OpDesc_Attr::clear_i() { - i_ = 0; - clear_has_i(); -} -::google::protobuf::int32 OpDesc_Attr::i() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.i) - return i_; -} -void OpDesc_Attr::set_i(::google::protobuf::int32 value) { - set_has_i(); - i_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.i) -} - -// optional float f = 4; -bool OpDesc_Attr::has_f() const { return (_has_bits_[0] & 0x00000010u) != 0; } -void OpDesc_Attr::set_has_f() { _has_bits_[0] |= 0x00000010u; } -void OpDesc_Attr::clear_has_f() { _has_bits_[0] &= ~0x00000010u; } -void OpDesc_Attr::clear_f() { - f_ = 0; - clear_has_f(); -} -float OpDesc_Attr::f() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.f) - return f_; -} -void OpDesc_Attr::set_f(float value) { - set_has_f(); - f_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.f) -} - -// optional string s = 5; -bool OpDesc_Attr::has_s() const { return (_has_bits_[0] & 0x00000002u) != 0; } -void OpDesc_Attr::set_has_s() { _has_bits_[0] |= 0x00000002u; } -void OpDesc_Attr::clear_has_s() { _has_bits_[0] &= ~0x00000002u; } -void OpDesc_Attr::clear_s() { - s_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_s(); -} -const ::std::string &OpDesc_Attr::s() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.s) - return s_.GetNoArena(); -} -void OpDesc_Attr::set_s(const ::std::string &value) { - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.s) -} + void OpDesc_Attr::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.name) + } + void OpDesc_Attr::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.name) + } + ::std::string *OpDesc_Attr::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpDesc_Attr::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpDesc_Attr::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.name) + } + + // required .paddle_mobile.framework.proto.AttrType type = 2; + bool OpDesc_Attr::has_type() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + void OpDesc_Attr::set_has_type() { _has_bits_[0] |= 0x00000004u; } + void OpDesc_Attr::clear_has_type() { + _has_bits_[0] &= ~0x00000004u; + } + void OpDesc_Attr::clear_type() { + type_ = 0; + clear_has_type(); + } + ::paddle_mobile::framework::proto::AttrType + OpDesc_Attr::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.type) + return static_cast<::paddle_mobile::framework::proto::AttrType>( + type_); + } + void OpDesc_Attr::set_type( + ::paddle_mobile::framework::proto::AttrType value) { + assert( + ::paddle_mobile::framework::proto::AttrType_IsValid(value)); + set_has_type(); + type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.type) + } + + // optional int32 i = 3; + bool OpDesc_Attr::has_i() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + void OpDesc_Attr::set_has_i() { _has_bits_[0] |= 0x00000008u; } + void OpDesc_Attr::clear_has_i() { _has_bits_[0] &= ~0x00000008u; } + void OpDesc_Attr::clear_i() { + i_ = 0; + clear_has_i(); + } + ::google::protobuf::int32 OpDesc_Attr::i() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.i) + return i_; + } + void OpDesc_Attr::set_i(::google::protobuf::int32 value) { + set_has_i(); + i_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.i) + } + + // optional float f = 4; + bool OpDesc_Attr::has_f() const { + return (_has_bits_[0] & 0x00000010u) != 0; + } + void OpDesc_Attr::set_has_f() { _has_bits_[0] |= 0x00000010u; } + void OpDesc_Attr::clear_has_f() { _has_bits_[0] &= ~0x00000010u; } + void OpDesc_Attr::clear_f() { + f_ = 0; + clear_has_f(); + } + float OpDesc_Attr::f() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.f) + return f_; + } + void OpDesc_Attr::set_f(float value) { + set_has_f(); + f_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.f) + } + + // optional string s = 5; + bool OpDesc_Attr::has_s() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void OpDesc_Attr::set_has_s() { _has_bits_[0] |= 0x00000002u; } + void OpDesc_Attr::clear_has_s() { _has_bits_[0] &= ~0x00000002u; } + void OpDesc_Attr::clear_s() { + s_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_s(); + } + const ::std::string &OpDesc_Attr::s() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.s) + return s_.GetNoArena(); + } + void OpDesc_Attr::set_s(const ::std::string &value) { + set_has_s(); + s_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.s) + } #if LANG_CXX11 -void OpDesc_Attr::set_s(::std::string &&value) { - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.s) -} + void OpDesc_Attr::set_s(::std::string &&value) { + set_has_s(); + s_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.s) + } #endif -void OpDesc_Attr::set_s(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.s) -} -void OpDesc_Attr::set_s(const char *value, size_t size) { - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.s) -} -::std::string *OpDesc_Attr::mutable_s() { - set_has_s(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.s) - return s_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpDesc_Attr::release_s() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.s) - clear_has_s(); - return s_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpDesc_Attr::set_allocated_s(::std::string *s) { - if (s != NULL) { - set_has_s(); - } else { - clear_has_s(); - } - s_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), s); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.s) -} - -// repeated int32 ints = 6; -int OpDesc_Attr::ints_size() const { return ints_.size(); } -void OpDesc_Attr::clear_ints() { ints_.Clear(); } -::google::protobuf::int32 OpDesc_Attr::ints(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.ints) - return ints_.Get(index); -} -void OpDesc_Attr::set_ints(int index, ::google::protobuf::int32 value) { - ints_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.ints) -} -void OpDesc_Attr::add_ints(::google::protobuf::int32 value) { - ints_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.ints) -} -const ::google::protobuf::RepeatedField<::google::protobuf::int32> & -OpDesc_Attr::ints() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) - return ints_; -} -::google::protobuf::RepeatedField<::google::protobuf::int32> * -OpDesc_Attr::mutable_ints() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) - return &ints_; -} - -// repeated float floats = 7; -int OpDesc_Attr::floats_size() const { return floats_.size(); } -void OpDesc_Attr::clear_floats() { floats_.Clear(); } -float OpDesc_Attr::floats(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.floats) - return floats_.Get(index); -} -void OpDesc_Attr::set_floats(int index, float value) { - floats_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.floats) -} -void OpDesc_Attr::add_floats(float value) { - floats_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.floats) -} -const ::google::protobuf::RepeatedField &OpDesc_Attr::floats() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) - return floats_; -} -::google::protobuf::RepeatedField *OpDesc_Attr::mutable_floats() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) - return &floats_; -} - -// repeated string strings = 8; -int OpDesc_Attr::strings_size() const { return strings_.size(); } -void OpDesc_Attr::clear_strings() { strings_.Clear(); } -const ::std::string &OpDesc_Attr::strings(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_.Get(index); -} -::std::string *OpDesc_Attr::mutable_strings(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_.Mutable(index); -} -void OpDesc_Attr::set_strings(int index, const ::std::string &value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) - strings_.Mutable(index)->assign(value); -} + void OpDesc_Attr::set_s(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_s(); + s_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.s) + } + void OpDesc_Attr::set_s(const char *value, size_t size) { + set_has_s(); + s_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.s) + } + ::std::string *OpDesc_Attr::mutable_s() { + set_has_s(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.s) + return s_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpDesc_Attr::release_s() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.s) + clear_has_s(); + return s_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpDesc_Attr::set_allocated_s(::std::string *s) { + if (s != NULL) { + set_has_s(); + } else { + clear_has_s(); + } + s_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + s); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.s) + } + + // repeated int32 ints = 6; + int OpDesc_Attr::ints_size() const { return ints_.size(); } + void OpDesc_Attr::clear_ints() { ints_.Clear(); } + ::google::protobuf::int32 OpDesc_Attr::ints(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.ints) + return ints_.Get(index); + } + void OpDesc_Attr::set_ints(int index, + ::google::protobuf::int32 value) { + ints_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.ints) + } + void OpDesc_Attr::add_ints(::google::protobuf::int32 value) { + ints_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.ints) + } + const ::google::protobuf::RepeatedField<::google::protobuf::int32> & + OpDesc_Attr::ints() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) + return ints_; + } + ::google::protobuf::RepeatedField<::google::protobuf::int32> * + OpDesc_Attr::mutable_ints() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) + return &ints_; + } + + // repeated float floats = 7; + int OpDesc_Attr::floats_size() const { return floats_.size(); } + void OpDesc_Attr::clear_floats() { floats_.Clear(); } + float OpDesc_Attr::floats(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.floats) + return floats_.Get(index); + } + void OpDesc_Attr::set_floats(int index, float value) { + floats_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.floats) + } + void OpDesc_Attr::add_floats(float value) { + floats_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.floats) + } + const ::google::protobuf::RepeatedField & + OpDesc_Attr::floats() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) + return floats_; + } + ::google::protobuf::RepeatedField * + OpDesc_Attr::mutable_floats() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) + return &floats_; + } + + // repeated string strings = 8; + int OpDesc_Attr::strings_size() const { return strings_.size(); } + void OpDesc_Attr::clear_strings() { strings_.Clear(); } + const ::std::string &OpDesc_Attr::strings(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_.Get(index); + } + ::std::string *OpDesc_Attr::mutable_strings(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_.Mutable(index); + } + void OpDesc_Attr::set_strings(int index, + const ::std::string &value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) + strings_.Mutable(index)->assign(value); + } #if LANG_CXX11 -void OpDesc_Attr::set_strings(int index, ::std::string &&value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) - strings_.Mutable(index)->assign(std::move(value)); -} + void OpDesc_Attr::set_strings(int index, ::std::string &&value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) + strings_.Mutable(index)->assign(std::move(value)); + } #endif -void OpDesc_Attr::set_strings(int index, const char *value) { - GOOGLE_DCHECK(value != NULL); - strings_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -void OpDesc_Attr::set_strings(int index, const char *value, size_t size) { - strings_.Mutable(index)->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -::std::string *OpDesc_Attr::add_strings() { - // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_.Add(); -} -void OpDesc_Attr::add_strings(const ::std::string &value) { - strings_.Add()->assign(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} + void OpDesc_Attr::set_strings(int index, const char *value) { + GOOGLE_DCHECK(value != NULL); + strings_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + void OpDesc_Attr::set_strings(int index, const char *value, + size_t size) { + strings_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + ::std::string *OpDesc_Attr::add_strings() { + // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_.Add(); + } + void OpDesc_Attr::add_strings(const ::std::string &value) { + strings_.Add()->assign(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } #if LANG_CXX11 -void OpDesc_Attr::add_strings(::std::string &&value) { - strings_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} + void OpDesc_Attr::add_strings(::std::string &&value) { + strings_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } #endif -void OpDesc_Attr::add_strings(const char *value) { - GOOGLE_DCHECK(value != NULL); - strings_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -void OpDesc_Attr::add_strings(const char *value, size_t size) { - strings_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -const ::google::protobuf::RepeatedPtrField<::std::string> & -OpDesc_Attr::strings() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_; -} -::google::protobuf::RepeatedPtrField<::std::string> * -OpDesc_Attr::mutable_strings() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return &strings_; -} - -// optional bool b = 10; -bool OpDesc_Attr::has_b() const { return (_has_bits_[0] & 0x00000020u) != 0; } -void OpDesc_Attr::set_has_b() { _has_bits_[0] |= 0x00000020u; } -void OpDesc_Attr::clear_has_b() { _has_bits_[0] &= ~0x00000020u; } -void OpDesc_Attr::clear_b() { - b_ = false; - clear_has_b(); -} -bool OpDesc_Attr::b() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.b) - return b_; -} -void OpDesc_Attr::set_b(bool value) { - set_has_b(); - b_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.b) -} - -// repeated bool bools = 11; -int OpDesc_Attr::bools_size() const { return bools_.size(); } -void OpDesc_Attr::clear_bools() { bools_.Clear(); } -bool OpDesc_Attr::bools(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.bools) - return bools_.Get(index); -} -void OpDesc_Attr::set_bools(int index, bool value) { - bools_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.bools) -} -void OpDesc_Attr::add_bools(bool value) { - bools_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.bools) -} -const ::google::protobuf::RepeatedField &OpDesc_Attr::bools() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) - return bools_; -} -::google::protobuf::RepeatedField *OpDesc_Attr::mutable_bools() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) - return &bools_; -} - -// optional int32 block_idx = 12; -bool OpDesc_Attr::has_block_idx() const { - return (_has_bits_[0] & 0x00000080u) != 0; -} -void OpDesc_Attr::set_has_block_idx() { _has_bits_[0] |= 0x00000080u; } -void OpDesc_Attr::clear_has_block_idx() { _has_bits_[0] &= ~0x00000080u; } -void OpDesc_Attr::clear_block_idx() { - block_idx_ = 0; - clear_has_block_idx(); -} -::google::protobuf::int32 OpDesc_Attr::block_idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) - return block_idx_; -} -void OpDesc_Attr::set_block_idx(::google::protobuf::int32 value) { - set_has_block_idx(); - block_idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) -} - -// optional int64 l = 13; -bool OpDesc_Attr::has_l() const { return (_has_bits_[0] & 0x00000040u) != 0; } -void OpDesc_Attr::set_has_l() { _has_bits_[0] |= 0x00000040u; } -void OpDesc_Attr::clear_has_l() { _has_bits_[0] &= ~0x00000040u; } -void OpDesc_Attr::clear_l() { - l_ = GOOGLE_LONGLONG(0); - clear_has_l(); -} -::google::protobuf::int64 OpDesc_Attr::l() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.l) - return l_; -} -void OpDesc_Attr::set_l(::google::protobuf::int64 value) { - set_has_l(); - l_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.l) -} + void OpDesc_Attr::add_strings(const char *value) { + GOOGLE_DCHECK(value != NULL); + strings_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + void OpDesc_Attr::add_strings(const char *value, size_t size) { + strings_.Add()->assign(reinterpret_cast(value), + size); + // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + const ::google::protobuf::RepeatedPtrField<::std::string> & + OpDesc_Attr::strings() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_; + } + ::google::protobuf::RepeatedPtrField<::std::string> * + OpDesc_Attr::mutable_strings() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return &strings_; + } + + // optional bool b = 10; + bool OpDesc_Attr::has_b() const { + return (_has_bits_[0] & 0x00000020u) != 0; + } + void OpDesc_Attr::set_has_b() { _has_bits_[0] |= 0x00000020u; } + void OpDesc_Attr::clear_has_b() { _has_bits_[0] &= ~0x00000020u; } + void OpDesc_Attr::clear_b() { + b_ = false; + clear_has_b(); + } + bool OpDesc_Attr::b() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.b) + return b_; + } + void OpDesc_Attr::set_b(bool value) { + set_has_b(); + b_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.b) + } + + // repeated bool bools = 11; + int OpDesc_Attr::bools_size() const { return bools_.size(); } + void OpDesc_Attr::clear_bools() { bools_.Clear(); } + bool OpDesc_Attr::bools(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.bools) + return bools_.Get(index); + } + void OpDesc_Attr::set_bools(int index, bool value) { + bools_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.bools) + } + void OpDesc_Attr::add_bools(bool value) { + bools_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.bools) + } + const ::google::protobuf::RepeatedField & + OpDesc_Attr::bools() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) + return bools_; + } + ::google::protobuf::RepeatedField * + OpDesc_Attr::mutable_bools() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) + return &bools_; + } + + // optional int32 block_idx = 12; + bool OpDesc_Attr::has_block_idx() const { + return (_has_bits_[0] & 0x00000080u) != 0; + } + void OpDesc_Attr::set_has_block_idx() { + _has_bits_[0] |= 0x00000080u; + } + void OpDesc_Attr::clear_has_block_idx() { + _has_bits_[0] &= ~0x00000080u; + } + void OpDesc_Attr::clear_block_idx() { + block_idx_ = 0; + clear_has_block_idx(); + } + ::google::protobuf::int32 OpDesc_Attr::block_idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) + return block_idx_; + } + void OpDesc_Attr::set_block_idx(::google::protobuf::int32 value) { + set_has_block_idx(); + block_idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) + } + + // optional int64 l = 13; + bool OpDesc_Attr::has_l() const { + return (_has_bits_[0] & 0x00000040u) != 0; + } + void OpDesc_Attr::set_has_l() { _has_bits_[0] |= 0x00000040u; } + void OpDesc_Attr::clear_has_l() { _has_bits_[0] &= ~0x00000040u; } + void OpDesc_Attr::clear_l() { + l_ = GOOGLE_LONGLONG(0); + clear_has_l(); + } + ::google::protobuf::int64 OpDesc_Attr::l() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.l) + return l_; + } + void OpDesc_Attr::set_l(::google::protobuf::int64 value) { + set_has_l(); + l_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.l) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int OpDesc_Var::kParameterFieldNumber; -const int OpDesc_Var::kArgumentsFieldNumber; + const int OpDesc_Var::kParameterFieldNumber; + const int OpDesc_Var::kArgumentsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -OpDesc_Var::OpDesc_Var() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpDesc.Var) -} -OpDesc_Var::OpDesc_Var(const OpDesc_Var &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), - arguments_(from.arguments_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - parameter_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_parameter()) { - parameter_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.parameter_); - } - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpDesc.Var) -} - -void OpDesc_Var::SharedCtor() { - _cached_size_ = 0; - parameter_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -OpDesc_Var::~OpDesc_Var() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpDesc.Var) - SharedDtor(); -} - -void OpDesc_Var::SharedDtor() { - parameter_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void OpDesc_Var::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const OpDesc_Var &OpDesc_Var::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -OpDesc_Var *OpDesc_Var::New(::google::protobuf::Arena *arena) const { - OpDesc_Var *n = new OpDesc_Var; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void OpDesc_Var::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpDesc.Var) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - arguments_.Clear(); - if (has_parameter()) { - GOOGLE_DCHECK(!parameter_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*parameter_.UnsafeRawStringPointer())->clear(); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool OpDesc_Var::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + OpDesc_Var::OpDesc_Var() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpDesc.Var) + } + OpDesc_Var::OpDesc_Var(const OpDesc_Var &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + arguments_(from.arguments_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + parameter_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_parameter()) { + parameter_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.parameter_); + } + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpDesc.Var) + } + + void OpDesc_Var::SharedCtor() { + _cached_size_ = 0; + parameter_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + OpDesc_Var::~OpDesc_Var() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpDesc.Var) + SharedDtor(); + } + + void OpDesc_Var::SharedDtor() { + parameter_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + void OpDesc_Var::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const OpDesc_Var &OpDesc_Var::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + OpDesc_Var * + OpDesc_Var::New(::google::protobuf::Arena *arena) const { + OpDesc_Var *n = new OpDesc_Var; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void OpDesc_Var::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpDesc.Var) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + arguments_.Clear(); + if (has_parameter()) { + GOOGLE_DCHECK(!parameter_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*parameter_.UnsafeRawStringPointer())->clear(); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool OpDesc_Var::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpDesc.Var) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string parameter = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_parameter())); - } else { - goto handle_unusual; - } - break; - } - - // repeated string arguments = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->add_arguments())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpDesc.Var) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpDesc.Var) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpDesc.Var) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required string parameter = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, + this->mutable_parameter())); + } else { + goto handle_unusual; + } + break; + } + + // repeated string arguments = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->add_arguments())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpDesc.Var) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpDesc.Var) + return false; #undef DO_ -} - -void OpDesc_Var::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpDesc.Var) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required string parameter = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->parameter(), output); - } - - // repeated string arguments = 2; - for (int i = 0, n = this->arguments_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteString( - 2, this->arguments(i), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpDesc.Var) -} - -size_t OpDesc_Var::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpDesc.Var) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // required string parameter = 1; - if (has_parameter()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->parameter()); - } - // repeated string arguments = 2; - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this->arguments_size()); - for (int i = 0, n = this->arguments_size(); i < n; i++) { - total_size += ::google::protobuf::internal::WireFormatLite::StringSize( - this->arguments(i)); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void OpDesc_Var::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void OpDesc_Var::MergeFrom(const OpDesc_Var &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpDesc.Var) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - arguments_.MergeFrom(from.arguments_); - if (from.has_parameter()) { - set_has_parameter(); - parameter_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.parameter_); - } -} - -void OpDesc_Var::CopyFrom(const OpDesc_Var &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpDesc.Var) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool OpDesc_Var::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) - return false; - return true; -} - -void OpDesc_Var::Swap(OpDesc_Var *other) { - if (other == this) - return; - InternalSwap(other); -} -void OpDesc_Var::InternalSwap(OpDesc_Var *other) { - using std::swap; - arguments_.InternalSwap(&other->arguments_); - parameter_.Swap(&other->parameter_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string OpDesc_Var::GetTypeName() const { - return "paddle_mobile.framework.proto.OpDesc.Var"; -} + } + + void OpDesc_Var::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpDesc.Var) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required string parameter = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(1, this->parameter(), output); + } + + // repeated string arguments = 2; + for (int i = 0, n = this->arguments_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->arguments(i), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpDesc.Var) + } + + size_t OpDesc_Var::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpDesc.Var) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // required string parameter = 1; + if (has_parameter()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->parameter()); + } + // repeated string arguments = 2; + total_size += 1 * ::google::protobuf::internal::FromIntSize( + this->arguments_size()); + for (int i = 0, n = this->arguments_size(); i < n; i++) { + total_size += ::google::protobuf::internal::WireFormatLite:: + StringSize(this->arguments(i)); + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void OpDesc_Var::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void OpDesc_Var::MergeFrom(const OpDesc_Var &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpDesc.Var) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + arguments_.MergeFrom(from.arguments_); + if (from.has_parameter()) { + set_has_parameter(); + parameter_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.parameter_); + } + } + + void OpDesc_Var::CopyFrom(const OpDesc_Var &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpDesc.Var) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool OpDesc_Var::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) + return false; + return true; + } + + void OpDesc_Var::Swap(OpDesc_Var *other) { + if (other == this) + return; + InternalSwap(other); + } + void OpDesc_Var::InternalSwap(OpDesc_Var *other) { + using std::swap; + arguments_.InternalSwap(&other->arguments_); + parameter_.Swap(&other->parameter_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string OpDesc_Var::GetTypeName() const { + return "paddle_mobile.framework.proto.OpDesc.Var"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// OpDesc_Var - -// required string parameter = 1; -bool OpDesc_Var::has_parameter() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void OpDesc_Var::set_has_parameter() { _has_bits_[0] |= 0x00000001u; } -void OpDesc_Var::clear_has_parameter() { _has_bits_[0] &= ~0x00000001u; } -void OpDesc_Var::clear_parameter() { - parameter_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_parameter(); -} -const ::std::string &OpDesc_Var::parameter() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.parameter) - return parameter_.GetNoArena(); -} -void OpDesc_Var::set_parameter(const ::std::string &value) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} + // OpDesc_Var + + // required string parameter = 1; + bool OpDesc_Var::has_parameter() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void OpDesc_Var::set_has_parameter() { + _has_bits_[0] |= 0x00000001u; + } + void OpDesc_Var::clear_has_parameter() { + _has_bits_[0] &= ~0x00000001u; + } + void OpDesc_Var::clear_parameter() { + parameter_.ClearToEmptyNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_parameter(); + } + const ::std::string &OpDesc_Var::parameter() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.parameter) + return parameter_.GetNoArena(); + } + void OpDesc_Var::set_parameter(const ::std::string &value) { + set_has_parameter(); + parameter_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } #if LANG_CXX11 -void OpDesc_Var::set_parameter(::std::string &&value) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} + void OpDesc_Var::set_parameter(::std::string &&value) { + set_has_parameter(); + parameter_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } #endif -void OpDesc_Var::set_parameter(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} -void OpDesc_Var::set_parameter(const char *value, size_t size) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} -::std::string *OpDesc_Var::mutable_parameter() { - set_has_parameter(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.parameter) - return parameter_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpDesc_Var::release_parameter() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Var.parameter) - clear_has_parameter(); - return parameter_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpDesc_Var::set_allocated_parameter(::std::string *parameter) { - if (parameter != NULL) { - set_has_parameter(); - } else { - clear_has_parameter(); - } - parameter_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), parameter); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} - -// repeated string arguments = 2; -int OpDesc_Var::arguments_size() const { return arguments_.size(); } -void OpDesc_Var::clear_arguments() { arguments_.Clear(); } -const ::std::string &OpDesc_Var::arguments(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_.Get(index); -} -::std::string *OpDesc_Var::mutable_arguments(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_.Mutable(index); -} -void OpDesc_Var::set_arguments(int index, const ::std::string &value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) - arguments_.Mutable(index)->assign(value); -} + void OpDesc_Var::set_parameter(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_parameter(); + parameter_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } + void OpDesc_Var::set_parameter(const char *value, size_t size) { + set_has_parameter(); + parameter_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } + ::std::string *OpDesc_Var::mutable_parameter() { + set_has_parameter(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.parameter) + return parameter_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpDesc_Var::release_parameter() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Var.parameter) + clear_has_parameter(); + return parameter_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpDesc_Var::set_allocated_parameter(::std::string *parameter) { + if (parameter != NULL) { + set_has_parameter(); + } else { + clear_has_parameter(); + } + parameter_.SetAllocatedNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + parameter); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } + + // repeated string arguments = 2; + int OpDesc_Var::arguments_size() const { return arguments_.size(); } + void OpDesc_Var::clear_arguments() { arguments_.Clear(); } + const ::std::string &OpDesc_Var::arguments(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_.Get(index); + } + ::std::string *OpDesc_Var::mutable_arguments(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_.Mutable(index); + } + void OpDesc_Var::set_arguments(int index, + const ::std::string &value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) + arguments_.Mutable(index)->assign(value); + } #if LANG_CXX11 -void OpDesc_Var::set_arguments(int index, ::std::string &&value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) - arguments_.Mutable(index)->assign(std::move(value)); -} + void OpDesc_Var::set_arguments(int index, ::std::string &&value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) + arguments_.Mutable(index)->assign(std::move(value)); + } #endif -void OpDesc_Var::set_arguments(int index, const char *value) { - GOOGLE_DCHECK(value != NULL); - arguments_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -void OpDesc_Var::set_arguments(int index, const char *value, size_t size) { - arguments_.Mutable(index)->assign(reinterpret_cast(value), - size); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -::std::string *OpDesc_Var::add_arguments() { - // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_.Add(); -} -void OpDesc_Var::add_arguments(const ::std::string &value) { - arguments_.Add()->assign(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} + void OpDesc_Var::set_arguments(int index, const char *value) { + GOOGLE_DCHECK(value != NULL); + arguments_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + void OpDesc_Var::set_arguments(int index, const char *value, + size_t size) { + arguments_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + ::std::string *OpDesc_Var::add_arguments() { + // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_.Add(); + } + void OpDesc_Var::add_arguments(const ::std::string &value) { + arguments_.Add()->assign(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } #if LANG_CXX11 -void OpDesc_Var::add_arguments(::std::string &&value) { - arguments_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} + void OpDesc_Var::add_arguments(::std::string &&value) { + arguments_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } #endif -void OpDesc_Var::add_arguments(const char *value) { - GOOGLE_DCHECK(value != NULL); - arguments_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -void OpDesc_Var::add_arguments(const char *value, size_t size) { - arguments_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -const ::google::protobuf::RepeatedPtrField<::std::string> & -OpDesc_Var::arguments() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_; -} -::google::protobuf::RepeatedPtrField<::std::string> * -OpDesc_Var::mutable_arguments() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return &arguments_; -} + void OpDesc_Var::add_arguments(const char *value) { + GOOGLE_DCHECK(value != NULL); + arguments_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + void OpDesc_Var::add_arguments(const char *value, size_t size) { + arguments_.Add()->assign(reinterpret_cast(value), + size); + // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + const ::google::protobuf::RepeatedPtrField<::std::string> & + OpDesc_Var::arguments() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_; + } + ::google::protobuf::RepeatedPtrField<::std::string> * + OpDesc_Var::mutable_arguments() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return &arguments_; + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int OpDesc::kTypeFieldNumber; -const int OpDesc::kInputsFieldNumber; -const int OpDesc::kOutputsFieldNumber; -const int OpDesc::kAttrsFieldNumber; -const int OpDesc::kIsTargetFieldNumber; + const int OpDesc::kTypeFieldNumber; + const int OpDesc::kInputsFieldNumber; + const int OpDesc::kOutputsFieldNumber; + const int OpDesc::kAttrsFieldNumber; + const int OpDesc::kIsTargetFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -OpDesc::OpDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpDesc) -} -OpDesc::OpDesc(const OpDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), inputs_(from.inputs_), - outputs_(from.outputs_), attrs_(from.attrs_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - type_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_type()) { - type_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.type_); - } - is_target_ = from.is_target_; - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpDesc) -} - -void OpDesc::SharedCtor() { - _cached_size_ = 0; - type_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - is_target_ = false; -} - -OpDesc::~OpDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpDesc) - SharedDtor(); -} - -void OpDesc::SharedDtor() { - type_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void OpDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const OpDesc &OpDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -OpDesc *OpDesc::New(::google::protobuf::Arena *arena) const { - OpDesc *n = new OpDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void OpDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - inputs_.Clear(); - outputs_.Clear(); - attrs_.Clear(); - if (has_type()) { - GOOGLE_DCHECK(!type_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*type_.UnsafeRawStringPointer())->clear(); - } - is_target_ = false; - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool OpDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + OpDesc::OpDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpDesc) + } + OpDesc::OpDesc(const OpDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + inputs_(from.inputs_), outputs_(from.outputs_), + attrs_(from.attrs_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + type_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_type()) { + type_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.type_); + } + is_target_ = from.is_target_; + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpDesc) + } + + void OpDesc::SharedCtor() { + _cached_size_ = 0; + type_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + is_target_ = false; + } + + OpDesc::~OpDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpDesc) + SharedDtor(); + } + + void OpDesc::SharedDtor() { + type_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + void OpDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const OpDesc &OpDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + OpDesc *OpDesc::New(::google::protobuf::Arena *arena) const { + OpDesc *n = new OpDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void OpDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + inputs_.Clear(); + outputs_.Clear(); + attrs_.Clear(); + if (has_type()) { + GOOGLE_DCHECK( + !type_.IsDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*type_.UnsafeRawStringPointer())->clear(); + } + is_target_ = false; + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool OpDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_inputs())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_outputs())); - } else { - goto handle_unusual; - } - break; - } - - // required string type = 3; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_type())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_attrs())); - } else { - goto handle_unusual; - } - break; - } - - // optional bool is_target = 5 [default = false]; - case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { - set_has_is_target(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &is_target_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs + // = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_inputs())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var + // outputs = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_outputs())); + } else { + goto handle_unusual; + } + break; + } + + // required string type = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_type())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs + // = 4; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 34u /* 34 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_attrs())); + } else { + goto handle_unusual; + } + break; + } + + // optional bool is_target = 5 [default = false]; + case 5: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 40u /* 40 & 0xFF */)) { + set_has_is_target(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &is_target_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpDesc) + return false; #undef DO_ -} - -void OpDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; - for (unsigned int i = 0, n = static_cast(this->inputs_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, this->inputs(static_cast(i)), output); - } - - // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; - for (unsigned int i = 0, n = static_cast(this->outputs_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 2, this->outputs(static_cast(i)), output); - } - - cached_has_bits = _has_bits_[0]; - // required string type = 3; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 3, this->type(), output); - } - - // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; - for (unsigned int i = 0, n = static_cast(this->attrs_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 4, this->attrs(static_cast(i)), output); - } - - // optional bool is_target = 5 [default = false]; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteBool( - 5, this->is_target(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpDesc) -} - -size_t OpDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // required string type = 3; - if (has_type()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->type()); - } - // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; - { - unsigned int count = static_cast(this->inputs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->inputs(static_cast(i))); - } - } - - // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; - { - unsigned int count = static_cast(this->outputs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->outputs(static_cast(i))); - } - } - - // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; - { - unsigned int count = static_cast(this->attrs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->attrs(static_cast(i))); - } - } - - // optional bool is_target = 5 [default = false]; - if (has_is_target()) { - total_size += 1 + 1; - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void OpDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void OpDesc::MergeFrom(const OpDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - inputs_.MergeFrom(from.inputs_); - outputs_.MergeFrom(from.outputs_); - attrs_.MergeFrom(from.attrs_); - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - set_has_type(); - type_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.type_); - } - if (cached_has_bits & 0x00000002u) { - is_target_ = from.is_target_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void OpDesc::CopyFrom(const OpDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool OpDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->inputs())) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->outputs())) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->attrs())) - return false; - return true; -} - -void OpDesc::Swap(OpDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void OpDesc::InternalSwap(OpDesc *other) { - using std::swap; - inputs_.InternalSwap(&other->inputs_); - outputs_.InternalSwap(&other->outputs_); - attrs_.InternalSwap(&other->attrs_); - type_.Swap(&other->type_); - swap(is_target_, other->is_target_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string OpDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.OpDesc"; -} + } + + void OpDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = + // 1; + for (unsigned int i = 0, n = static_cast( + this->inputs_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->inputs(static_cast(i)), output); + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = + // 2; + for (unsigned int i = 0, n = static_cast( + this->outputs_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->outputs(static_cast(i)), output); + } + + cached_has_bits = _has_bits_[0]; + // required string type = 3; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(3, this->type(), output); + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = + // 4; + for (unsigned int i = 0, n = static_cast( + this->attrs_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 4, this->attrs(static_cast(i)), output); + } + + // optional bool is_target = 5 [default = false]; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 5, this->is_target(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpDesc) + } + + size_t OpDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // required string type = 3; + if (has_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->type()); + } + // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = + // 1; + { + unsigned int count = + static_cast(this->inputs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->inputs(static_cast(i))); + } + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = + // 2; + { + unsigned int count = + static_cast(this->outputs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->outputs(static_cast(i))); + } + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = + // 4; + { + unsigned int count = + static_cast(this->attrs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->attrs(static_cast(i))); + } + } + + // optional bool is_target = 5 [default = false]; + if (has_is_target()) { + total_size += 1 + 1; + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void OpDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void OpDesc::MergeFrom(const OpDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + inputs_.MergeFrom(from.inputs_); + outputs_.MergeFrom(from.outputs_); + attrs_.MergeFrom(from.attrs_); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + set_has_type(); + type_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.type_); + } + if (cached_has_bits & 0x00000002u) { + is_target_ = from.is_target_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void OpDesc::CopyFrom(const OpDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool OpDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->inputs())) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->outputs())) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->attrs())) + return false; + return true; + } + + void OpDesc::Swap(OpDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void OpDesc::InternalSwap(OpDesc *other) { + using std::swap; + inputs_.InternalSwap(&other->inputs_); + outputs_.InternalSwap(&other->outputs_); + attrs_.InternalSwap(&other->attrs_); + type_.Swap(&other->type_); + swap(is_target_, other->is_target_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string OpDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.OpDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// OpDesc - -// required string type = 3; -bool OpDesc::has_type() const { return (_has_bits_[0] & 0x00000001u) != 0; } -void OpDesc::set_has_type() { _has_bits_[0] |= 0x00000001u; } -void OpDesc::clear_has_type() { _has_bits_[0] &= ~0x00000001u; } -void OpDesc::clear_type() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_type(); -} -const ::std::string &OpDesc::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.type) - return type_.GetNoArena(); -} -void OpDesc::set_type(const ::std::string &value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.type) -} + // OpDesc + + // required string type = 3; + bool OpDesc::has_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void OpDesc::set_has_type() { _has_bits_[0] |= 0x00000001u; } + void OpDesc::clear_has_type() { _has_bits_[0] &= ~0x00000001u; } + void OpDesc::clear_type() { + type_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_type(); + } + const ::std::string &OpDesc::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.type) + return type_.GetNoArena(); + } + void OpDesc::set_type(const ::std::string &value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.type) + } #if LANG_CXX11 -void OpDesc::set_type(::std::string &&value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.type) -} + void OpDesc::set_type(::std::string &&value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.type) + } #endif -void OpDesc::set_type(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.type) -} -void OpDesc::set_type(const char *value, size_t size) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.type) -} -::std::string *OpDesc::mutable_type() { - set_has_type(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.type) - return type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpDesc::release_type() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.type) - clear_has_type(); - return type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpDesc::set_allocated_type(::std::string *type) { - if (type != NULL) { - set_has_type(); - } else { - clear_has_type(); - } - type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.type) -} - -// repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; -int OpDesc::inputs_size() const { return inputs_.size(); } -void OpDesc::clear_inputs() { inputs_.Clear(); } -const ::paddle_mobile::framework::proto::OpDesc_Var & -OpDesc::inputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_.Get(index); -} -::paddle_mobile::framework::proto::OpDesc_Var * -OpDesc::mutable_inputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_.Mutable(index); -} -::paddle_mobile::framework::proto::OpDesc_Var *OpDesc::add_inputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> * -OpDesc::mutable_inputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.inputs) - return &inputs_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> & -OpDesc::inputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_; -} - -// repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; -int OpDesc::outputs_size() const { return outputs_.size(); } -void OpDesc::clear_outputs() { outputs_.Clear(); } -const ::paddle_mobile::framework::proto::OpDesc_Var & -OpDesc::outputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_.Get(index); -} -::paddle_mobile::framework::proto::OpDesc_Var * -OpDesc::mutable_outputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_.Mutable(index); -} -::paddle_mobile::framework::proto::OpDesc_Var *OpDesc::add_outputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> * -OpDesc::mutable_outputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.outputs) - return &outputs_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> & -OpDesc::outputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_; -} - -// repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; -int OpDesc::attrs_size() const { return attrs_.size(); } -void OpDesc::clear_attrs() { attrs_.Clear(); } -const ::paddle_mobile::framework::proto::OpDesc_Attr & -OpDesc::attrs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_.Get(index); -} -::paddle_mobile::framework::proto::OpDesc_Attr * -OpDesc::mutable_attrs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_.Mutable(index); -} -::paddle_mobile::framework::proto::OpDesc_Attr *OpDesc::add_attrs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> * -OpDesc::mutable_attrs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.attrs) - return &attrs_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> & -OpDesc::attrs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_; -} - -// optional bool is_target = 5 [default = false]; -bool OpDesc::has_is_target() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void OpDesc::set_has_is_target() { _has_bits_[0] |= 0x00000002u; } -void OpDesc::clear_has_is_target() { _has_bits_[0] &= ~0x00000002u; } -void OpDesc::clear_is_target() { - is_target_ = false; - clear_has_is_target(); -} -bool OpDesc::is_target() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.is_target) - return is_target_; -} -void OpDesc::set_is_target(bool value) { - set_has_is_target(); - is_target_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.is_target) -} + void OpDesc::set_type(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.type) + } + void OpDesc::set_type(const char *value, size_t size) { + set_has_type(); + type_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.type) + } + ::std::string *OpDesc::mutable_type() { + set_has_type(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.type) + return type_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpDesc::release_type() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.type) + clear_has_type(); + return type_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpDesc::set_allocated_type(::std::string *type) { + if (type != NULL) { + set_has_type(); + } else { + clear_has_type(); + } + type_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + type); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.type) + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; + int OpDesc::inputs_size() const { return inputs_.size(); } + void OpDesc::clear_inputs() { inputs_.Clear(); } + const ::paddle_mobile::framework::proto::OpDesc_Var & + OpDesc::inputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_.Get(index); + } + ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::add_inputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> * + OpDesc::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.inputs) + return &inputs_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> & + OpDesc::inputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_; + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; + int OpDesc::outputs_size() const { return outputs_.size(); } + void OpDesc::clear_outputs() { outputs_.Clear(); } + const ::paddle_mobile::framework::proto::OpDesc_Var & + OpDesc::outputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_.Get(index); + } + ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::add_outputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> * + OpDesc::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.outputs) + return &outputs_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> & + OpDesc::outputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_; + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; + int OpDesc::attrs_size() const { return attrs_.size(); } + void OpDesc::clear_attrs() { attrs_.Clear(); } + const ::paddle_mobile::framework::proto::OpDesc_Attr & + OpDesc::attrs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_.Get(index); + } + ::paddle_mobile::framework::proto::OpDesc_Attr * + OpDesc::mutable_attrs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpDesc_Attr * + OpDesc::add_attrs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> * + OpDesc::mutable_attrs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.attrs) + return &attrs_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> & + OpDesc::attrs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_; + } + + // optional bool is_target = 5 [default = false]; + bool OpDesc::has_is_target() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void OpDesc::set_has_is_target() { _has_bits_[0] |= 0x00000002u; } + void OpDesc::clear_has_is_target() { + _has_bits_[0] &= ~0x00000002u; + } + void OpDesc::clear_is_target() { + is_target_ = false; + clear_has_is_target(); + } + bool OpDesc::is_target() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.is_target) + return is_target_; + } + void OpDesc::set_is_target(bool value) { + set_has_is_target(); + is_target_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.is_target) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int OpProto_Var::kNameFieldNumber; -const int OpProto_Var::kCommentFieldNumber; -const int OpProto_Var::kDuplicableFieldNumber; -const int OpProto_Var::kIntermediateFieldNumber; -const int OpProto_Var::kDispensableFieldNumber; + const int OpProto_Var::kNameFieldNumber; + const int OpProto_Var::kCommentFieldNumber; + const int OpProto_Var::kDuplicableFieldNumber; + const int OpProto_Var::kIntermediateFieldNumber; + const int OpProto_Var::kDispensableFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -OpProto_Var::OpProto_Var() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpProto.Var) -} -OpProto_Var::OpProto_Var(const OpProto_Var &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_name()) { - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - comment_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_comment()) { - comment_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.comment_); - } - ::memcpy(&duplicable_, &from.duplicable_, - static_cast(reinterpret_cast(&dispensable_) - - reinterpret_cast(&duplicable_)) + - sizeof(dispensable_)); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpProto.Var) -} - -void OpProto_Var::SharedCtor() { - _cached_size_ = 0; - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - comment_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&duplicable_, 0, - static_cast(reinterpret_cast(&dispensable_) - - reinterpret_cast(&duplicable_)) + - sizeof(dispensable_)); -} - -OpProto_Var::~OpProto_Var() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpProto.Var) - SharedDtor(); -} - -void OpProto_Var::SharedDtor() { - name_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - comment_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void OpProto_Var::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const OpProto_Var &OpProto_Var::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -OpProto_Var *OpProto_Var::New(::google::protobuf::Arena *arena) const { - OpProto_Var *n = new OpProto_Var; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void OpProto_Var::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpProto.Var) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - GOOGLE_DCHECK(!name_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(!comment_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*comment_.UnsafeRawStringPointer())->clear(); - } - } - if (cached_has_bits & 28u) { - ::memset(&duplicable_, 0, - static_cast(reinterpret_cast(&dispensable_) - + OpProto_Var::OpProto_Var() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpProto.Var) + } + OpProto_Var::OpProto_Var(const OpProto_Var &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_name()) { + name_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + comment_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_comment()) { + comment_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.comment_); + } + ::memcpy(&duplicable_, &from.duplicable_, + static_cast( + reinterpret_cast(&dispensable_) - + reinterpret_cast(&duplicable_)) + + sizeof(dispensable_)); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpProto.Var) + } + + void OpProto_Var::SharedCtor() { + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + comment_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + ::memset(&duplicable_, 0, + static_cast( + reinterpret_cast(&dispensable_) - + reinterpret_cast(&duplicable_)) + + sizeof(dispensable_)); + } + + OpProto_Var::~OpProto_Var() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpProto.Var) + SharedDtor(); + } + + void OpProto_Var::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + comment_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + void OpProto_Var::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const OpProto_Var &OpProto_Var::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + OpProto_Var * + OpProto_Var::New(::google::protobuf::Arena *arena) const { + OpProto_Var *n = new OpProto_Var; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void OpProto_Var::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpProto.Var) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(!name_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*name_.UnsafeRawStringPointer())->clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(!comment_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*comment_.UnsafeRawStringPointer())->clear(); + } + } + if (cached_has_bits & 28u) { + ::memset(&duplicable_, 0, + static_cast( + reinterpret_cast(&dispensable_) - reinterpret_cast(&duplicable_)) + - sizeof(dispensable_)); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool OpProto_Var::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + sizeof(dispensable_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool OpProto_Var::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpProto.Var) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - } else { - goto handle_unusual; - } - break; - } - - // required string comment = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_comment())); - } else { - goto handle_unusual; - } - break; - } - - // optional bool duplicable = 3 [default = false]; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { - set_has_duplicable(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &duplicable_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool intermediate = 4 [default = false]; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { - set_has_intermediate(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &intermediate_))); - } else { - goto handle_unusual; - } - break; - } - - // optional bool dispensable = 5 [default = false]; - case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { - set_has_dispensable(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &dispensable_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpProto.Var) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpProto.Var) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpProto.Var) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_name())); + } else { + goto handle_unusual; + } + break; + } + + // required string comment = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_comment())); + } else { + goto handle_unusual; + } + break; + } + + // optional bool duplicable = 3 [default = false]; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 24u /* 24 & 0xFF */)) { + set_has_duplicable(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &duplicable_))); + } else { + goto handle_unusual; + } + break; + } + + // optional bool intermediate = 4 [default = false]; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 32u /* 32 & 0xFF */)) { + set_has_intermediate(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &intermediate_))); + } else { + goto handle_unusual; + } + break; + } + + // optional bool dispensable = 5 [default = false]; + case 5: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 40u /* 40 & 0xFF */)) { + set_has_dispensable(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &dispensable_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpProto.Var) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpProto.Var) + return false; #undef DO_ -} - -void OpProto_Var::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpProto.Var) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required string name = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->name(), output); - } - - // required string comment = 2; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 2, this->comment(), output); - } - - // optional bool duplicable = 3 [default = false]; - if (cached_has_bits & 0x00000004u) { - ::google::protobuf::internal::WireFormatLite::WriteBool( - 3, this->duplicable(), output); - } - - // optional bool intermediate = 4 [default = false]; - if (cached_has_bits & 0x00000008u) { - ::google::protobuf::internal::WireFormatLite::WriteBool( - 4, this->intermediate(), output); - } - - // optional bool dispensable = 5 [default = false]; - if (cached_has_bits & 0x00000010u) { - ::google::protobuf::internal::WireFormatLite::WriteBool( - 5, this->dispensable(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpProto.Var) -} - -size_t OpProto_Var::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpProto.Var) - size_t total_size = 0; - - if (has_name()) { - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - if (has_comment()) { - // required string comment = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->comment()); - } - - return total_size; -} -size_t OpProto_Var::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpProto.Var) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == - 0) { // All required fields are present. - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - - // required string comment = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->comment()); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - if (_has_bits_[0 / 32] & 28u) { - // optional bool duplicable = 3 [default = false]; - if (has_duplicable()) { - total_size += 1 + 1; - } - - // optional bool intermediate = 4 [default = false]; - if (has_intermediate()) { - total_size += 1 + 1; - } - - // optional bool dispensable = 5 [default = false]; - if (has_dispensable()) { - total_size += 1 + 1; - } - } - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void OpProto_Var::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void OpProto_Var::MergeFrom(const OpProto_Var &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpProto.Var) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 31u) { - if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - if (cached_has_bits & 0x00000002u) { - set_has_comment(); - comment_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.comment_); - } - if (cached_has_bits & 0x00000004u) { - duplicable_ = from.duplicable_; - } - if (cached_has_bits & 0x00000008u) { - intermediate_ = from.intermediate_; - } - if (cached_has_bits & 0x00000010u) { - dispensable_ = from.dispensable_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void OpProto_Var::CopyFrom(const OpProto_Var &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpProto.Var) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool OpProto_Var::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) - return false; - return true; -} - -void OpProto_Var::Swap(OpProto_Var *other) { - if (other == this) - return; - InternalSwap(other); -} -void OpProto_Var::InternalSwap(OpProto_Var *other) { - using std::swap; - name_.Swap(&other->name_); - comment_.Swap(&other->comment_); - swap(duplicable_, other->duplicable_); - swap(intermediate_, other->intermediate_); - swap(dispensable_, other->dispensable_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string OpProto_Var::GetTypeName() const { - return "paddle_mobile.framework.proto.OpProto.Var"; -} + } + + void OpProto_Var::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpProto.Var) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required string name = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(1, this->name(), output); + } + + // required string comment = 2; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(2, this->comment(), output); + } + + // optional bool duplicable = 3 [default = false]; + if (cached_has_bits & 0x00000004u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 3, this->duplicable(), output); + } + + // optional bool intermediate = 4 [default = false]; + if (cached_has_bits & 0x00000008u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 4, this->intermediate(), output); + } + + // optional bool dispensable = 5 [default = false]; + if (cached_has_bits & 0x00000010u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 5, this->dispensable(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpProto.Var) + } + + size_t OpProto_Var::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpProto.Var) + size_t total_size = 0; + + if (has_name()) { + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + } + + if (has_comment()) { + // required string comment = 2; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->comment()); + } + + return total_size; + } + size_t OpProto_Var::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpProto.Var) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == + 0) { // All required fields are present. + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + + // required string comment = 2; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->comment()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + if (_has_bits_[0 / 32] & 28u) { + // optional bool duplicable = 3 [default = false]; + if (has_duplicable()) { + total_size += 1 + 1; + } + + // optional bool intermediate = 4 [default = false]; + if (has_intermediate()) { + total_size += 1 + 1; + } + + // optional bool dispensable = 5 [default = false]; + if (has_dispensable()) { + total_size += 1 + 1; + } + } + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void OpProto_Var::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void OpProto_Var::MergeFrom(const OpProto_Var &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpProto.Var) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 31u) { + if (cached_has_bits & 0x00000001u) { + set_has_name(); + name_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + if (cached_has_bits & 0x00000002u) { + set_has_comment(); + comment_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.comment_); + } + if (cached_has_bits & 0x00000004u) { + duplicable_ = from.duplicable_; + } + if (cached_has_bits & 0x00000008u) { + intermediate_ = from.intermediate_; + } + if (cached_has_bits & 0x00000010u) { + dispensable_ = from.dispensable_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void OpProto_Var::CopyFrom(const OpProto_Var &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpProto.Var) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool OpProto_Var::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) + return false; + return true; + } + + void OpProto_Var::Swap(OpProto_Var *other) { + if (other == this) + return; + InternalSwap(other); + } + void OpProto_Var::InternalSwap(OpProto_Var *other) { + using std::swap; + name_.Swap(&other->name_); + comment_.Swap(&other->comment_); + swap(duplicable_, other->duplicable_); + swap(intermediate_, other->intermediate_); + swap(dispensable_, other->dispensable_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string OpProto_Var::GetTypeName() const { + return "paddle_mobile.framework.proto.OpProto.Var"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// OpProto_Var - -// required string name = 1; -bool OpProto_Var::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void OpProto_Var::set_has_name() { _has_bits_[0] |= 0x00000001u; } -void OpProto_Var::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -void OpProto_Var::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string &OpProto_Var::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.name) - return name_.GetNoArena(); -} -void OpProto_Var::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.name) -} + // OpProto_Var + + // required string name = 1; + bool OpProto_Var::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void OpProto_Var::set_has_name() { _has_bits_[0] |= 0x00000001u; } + void OpProto_Var::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + void OpProto_Var::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + const ::std::string &OpProto_Var::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.name) + return name_.GetNoArena(); + } + void OpProto_Var::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.name) + } #if LANG_CXX11 -void OpProto_Var::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.name) -} + void OpProto_Var::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.name) + } #endif -void OpProto_Var::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.name) -} -void OpProto_Var::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.name) -} -::std::string *OpProto_Var::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpProto_Var::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpProto_Var::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.name) -} - -// required string comment = 2; -bool OpProto_Var::has_comment() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void OpProto_Var::set_has_comment() { _has_bits_[0] |= 0x00000002u; } -void OpProto_Var::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } -void OpProto_Var::clear_comment() { - comment_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_comment(); -} -const ::std::string &OpProto_Var::comment() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.comment) - return comment_.GetNoArena(); -} -void OpProto_Var::set_comment(const ::std::string &value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.comment) -} + void OpProto_Var::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.name) + } + void OpProto_Var::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.name) + } + ::std::string *OpProto_Var::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpProto_Var::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpProto_Var::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.name) + } + + // required string comment = 2; + bool OpProto_Var::has_comment() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void OpProto_Var::set_has_comment() { + _has_bits_[0] |= 0x00000002u; + } + void OpProto_Var::clear_has_comment() { + _has_bits_[0] &= ~0x00000002u; + } + void OpProto_Var::clear_comment() { + comment_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_comment(); + } + const ::std::string &OpProto_Var::comment() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.comment) + return comment_.GetNoArena(); + } + void OpProto_Var::set_comment(const ::std::string &value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.comment) + } #if LANG_CXX11 -void OpProto_Var::set_comment(::std::string &&value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.comment) -} + void OpProto_Var::set_comment(::std::string &&value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.comment) + } #endif -void OpProto_Var::set_comment(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.comment) -} -void OpProto_Var::set_comment(const char *value, size_t size) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.comment) -} -::std::string *OpProto_Var::mutable_comment() { - set_has_comment(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.comment) - return comment_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpProto_Var::release_comment() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.comment) - clear_has_comment(); - return comment_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpProto_Var::set_allocated_comment(::std::string *comment) { - if (comment != NULL) { - set_has_comment(); - } else { - clear_has_comment(); - } - comment_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), comment); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.comment) -} - -// optional bool duplicable = 3 [default = false]; -bool OpProto_Var::has_duplicable() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void OpProto_Var::set_has_duplicable() { _has_bits_[0] |= 0x00000004u; } -void OpProto_Var::clear_has_duplicable() { _has_bits_[0] &= ~0x00000004u; } -void OpProto_Var::clear_duplicable() { - duplicable_ = false; - clear_has_duplicable(); -} -bool OpProto_Var::duplicable() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.duplicable) - return duplicable_; -} -void OpProto_Var::set_duplicable(bool value) { - set_has_duplicable(); - duplicable_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.duplicable) -} - -// optional bool intermediate = 4 [default = false]; -bool OpProto_Var::has_intermediate() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void OpProto_Var::set_has_intermediate() { _has_bits_[0] |= 0x00000008u; } -void OpProto_Var::clear_has_intermediate() { _has_bits_[0] &= ~0x00000008u; } -void OpProto_Var::clear_intermediate() { - intermediate_ = false; - clear_has_intermediate(); -} -bool OpProto_Var::intermediate() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.intermediate) - return intermediate_; -} -void OpProto_Var::set_intermediate(bool value) { - set_has_intermediate(); - intermediate_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.intermediate) -} - -// optional bool dispensable = 5 [default = false]; -bool OpProto_Var::has_dispensable() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -void OpProto_Var::set_has_dispensable() { _has_bits_[0] |= 0x00000010u; } -void OpProto_Var::clear_has_dispensable() { _has_bits_[0] &= ~0x00000010u; } -void OpProto_Var::clear_dispensable() { - dispensable_ = false; - clear_has_dispensable(); -} -bool OpProto_Var::dispensable() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.dispensable) - return dispensable_; -} -void OpProto_Var::set_dispensable(bool value) { - set_has_dispensable(); - dispensable_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.dispensable) -} + void OpProto_Var::set_comment(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.comment) + } + void OpProto_Var::set_comment(const char *value, size_t size) { + set_has_comment(); + comment_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.comment) + } + ::std::string *OpProto_Var::mutable_comment() { + set_has_comment(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.comment) + return comment_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpProto_Var::release_comment() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.comment) + clear_has_comment(); + return comment_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpProto_Var::set_allocated_comment(::std::string *comment) { + if (comment != NULL) { + set_has_comment(); + } else { + clear_has_comment(); + } + comment_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + comment); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.comment) + } + + // optional bool duplicable = 3 [default = false]; + bool OpProto_Var::has_duplicable() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + void OpProto_Var::set_has_duplicable() { + _has_bits_[0] |= 0x00000004u; + } + void OpProto_Var::clear_has_duplicable() { + _has_bits_[0] &= ~0x00000004u; + } + void OpProto_Var::clear_duplicable() { + duplicable_ = false; + clear_has_duplicable(); + } + bool OpProto_Var::duplicable() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.duplicable) + return duplicable_; + } + void OpProto_Var::set_duplicable(bool value) { + set_has_duplicable(); + duplicable_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.duplicable) + } + + // optional bool intermediate = 4 [default = false]; + bool OpProto_Var::has_intermediate() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + void OpProto_Var::set_has_intermediate() { + _has_bits_[0] |= 0x00000008u; + } + void OpProto_Var::clear_has_intermediate() { + _has_bits_[0] &= ~0x00000008u; + } + void OpProto_Var::clear_intermediate() { + intermediate_ = false; + clear_has_intermediate(); + } + bool OpProto_Var::intermediate() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.intermediate) + return intermediate_; + } + void OpProto_Var::set_intermediate(bool value) { + set_has_intermediate(); + intermediate_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.intermediate) + } + + // optional bool dispensable = 5 [default = false]; + bool OpProto_Var::has_dispensable() const { + return (_has_bits_[0] & 0x00000010u) != 0; + } + void OpProto_Var::set_has_dispensable() { + _has_bits_[0] |= 0x00000010u; + } + void OpProto_Var::clear_has_dispensable() { + _has_bits_[0] &= ~0x00000010u; + } + void OpProto_Var::clear_dispensable() { + dispensable_ = false; + clear_has_dispensable(); + } + bool OpProto_Var::dispensable() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.dispensable) + return dispensable_; + } + void OpProto_Var::set_dispensable(bool value) { + set_has_dispensable(); + dispensable_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.dispensable) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int OpProto_Attr::kNameFieldNumber; -const int OpProto_Attr::kTypeFieldNumber; -const int OpProto_Attr::kCommentFieldNumber; -const int OpProto_Attr::kGeneratedFieldNumber; + const int OpProto_Attr::kNameFieldNumber; + const int OpProto_Attr::kTypeFieldNumber; + const int OpProto_Attr::kCommentFieldNumber; + const int OpProto_Attr::kGeneratedFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -OpProto_Attr::OpProto_Attr() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpProto.Attr) -} -OpProto_Attr::OpProto_Attr(const OpProto_Attr &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_name()) { - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - comment_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_comment()) { - comment_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.comment_); - } - ::memcpy(&type_, &from.type_, - static_cast(reinterpret_cast(&generated_) - - reinterpret_cast(&type_)) + - sizeof(generated_)); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpProto.Attr) -} - -void OpProto_Attr::SharedCtor() { - _cached_size_ = 0; - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - comment_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&type_, 0, - static_cast(reinterpret_cast(&generated_) - - reinterpret_cast(&type_)) + - sizeof(generated_)); -} - -OpProto_Attr::~OpProto_Attr() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpProto.Attr) - SharedDtor(); -} - -void OpProto_Attr::SharedDtor() { - name_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - comment_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void OpProto_Attr::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const OpProto_Attr &OpProto_Attr::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -OpProto_Attr *OpProto_Attr::New(::google::protobuf::Arena *arena) const { - OpProto_Attr *n = new OpProto_Attr; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void OpProto_Attr::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpProto.Attr) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - GOOGLE_DCHECK(!name_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(!comment_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*comment_.UnsafeRawStringPointer())->clear(); - } - } - if (cached_has_bits & 12u) { - ::memset(&type_, 0, - static_cast(reinterpret_cast(&generated_) - + OpProto_Attr::OpProto_Attr() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpProto.Attr) + } + OpProto_Attr::OpProto_Attr(const OpProto_Attr &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_name()) { + name_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + comment_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_comment()) { + comment_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.comment_); + } + ::memcpy( + &type_, &from.type_, + static_cast(reinterpret_cast(&generated_) - + reinterpret_cast(&type_)) + + sizeof(generated_)); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpProto.Attr) + } + + void OpProto_Attr::SharedCtor() { + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + comment_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + ::memset(&type_, 0, static_cast( + reinterpret_cast(&generated_) - + reinterpret_cast(&type_)) + + sizeof(generated_)); + } + + OpProto_Attr::~OpProto_Attr() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpProto.Attr) + SharedDtor(); + } + + void OpProto_Attr::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + comment_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + void OpProto_Attr::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const OpProto_Attr &OpProto_Attr::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + OpProto_Attr * + OpProto_Attr::New(::google::protobuf::Arena *arena) const { + OpProto_Attr *n = new OpProto_Attr; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void OpProto_Attr::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpProto.Attr) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(!name_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*name_.UnsafeRawStringPointer())->clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(!comment_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*comment_.UnsafeRawStringPointer())->clear(); + } + } + if (cached_has_bits & 12u) { + ::memset(&type_, 0, + static_cast( + reinterpret_cast(&generated_) - reinterpret_cast(&type_)) + - sizeof(generated_)); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool OpProto_Attr::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + sizeof(generated_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool OpProto_Attr::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpProto.Attr) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - } else { - goto handle_unusual; - } - break; - } - - // required .paddle_mobile.framework.proto.AttrType type = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::paddle_mobile::framework::proto::AttrType_IsValid(value)) { - set_type( - static_cast<::paddle_mobile::framework::proto::AttrType>(value)); - } else { - unknown_fields_stream.WriteVarint32(16u); - unknown_fields_stream.WriteVarint32( - static_cast<::google::protobuf::uint32>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // required string comment = 3; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_comment())); - } else { - goto handle_unusual; - } - break; - } - - // optional bool generated = 4 [default = false]; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { - set_has_generated(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &generated_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpProto.Attr) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpProto.Attr) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpProto.Attr) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_name())); + } else { + goto handle_unusual; + } + break; + } + + // required .paddle_mobile.framework.proto.AttrType type = + // 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + int, ::google::protobuf::internal:: + WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::paddle_mobile::framework::proto:: + AttrType_IsValid(value)) { + set_type( + static_cast<::paddle_mobile::framework:: + proto::AttrType>(value)); + } else { + unknown_fields_stream.WriteVarint32(16u); + unknown_fields_stream.WriteVarint32( + static_cast<::google::protobuf::uint32>( + value)); + } + } else { + goto handle_unusual; + } + break; + } + + // required string comment = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_comment())); + } else { + goto handle_unusual; + } + break; + } + + // optional bool generated = 4 [default = false]; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 32u /* 32 & 0xFF */)) { + set_has_generated(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &generated_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpProto.Attr) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpProto.Attr) + return false; #undef DO_ -} - -void OpProto_Attr::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpProto.Attr) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required string name = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->name(), output); - } - - // required .paddle_mobile.framework.proto.AttrType type = 2; - if (cached_has_bits & 0x00000004u) { - ::google::protobuf::internal::WireFormatLite::WriteEnum(2, this->type(), - output); - } - - // required string comment = 3; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 3, this->comment(), output); - } - - // optional bool generated = 4 [default = false]; - if (cached_has_bits & 0x00000008u) { - ::google::protobuf::internal::WireFormatLite::WriteBool( - 4, this->generated(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpProto.Attr) -} - -size_t OpProto_Attr::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpProto.Attr) - size_t total_size = 0; - - if (has_name()) { - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - if (has_comment()) { - // required string comment = 3; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->comment()); - } - - if (has_type()) { - // required .paddle_mobile.framework.proto.AttrType type = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->type()); - } - - return total_size; -} -size_t OpProto_Attr::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpProto.Attr) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000007) ^ 0x00000007) == - 0) { // All required fields are present. - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - - // required string comment = 3; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->comment()); - - // required .paddle_mobile.framework.proto.AttrType type = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->type()); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - // optional bool generated = 4 [default = false]; - if (has_generated()) { - total_size += 1 + 1; - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void OpProto_Attr::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void OpProto_Attr::MergeFrom(const OpProto_Attr &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpProto.Attr) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 15u) { - if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - if (cached_has_bits & 0x00000002u) { - set_has_comment(); - comment_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.comment_); - } - if (cached_has_bits & 0x00000004u) { - type_ = from.type_; - } - if (cached_has_bits & 0x00000008u) { - generated_ = from.generated_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void OpProto_Attr::CopyFrom(const OpProto_Attr &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpProto.Attr) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool OpProto_Attr::IsInitialized() const { - if ((_has_bits_[0] & 0x00000007) != 0x00000007) - return false; - return true; -} - -void OpProto_Attr::Swap(OpProto_Attr *other) { - if (other == this) - return; - InternalSwap(other); -} -void OpProto_Attr::InternalSwap(OpProto_Attr *other) { - using std::swap; - name_.Swap(&other->name_); - comment_.Swap(&other->comment_); - swap(type_, other->type_); - swap(generated_, other->generated_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string OpProto_Attr::GetTypeName() const { - return "paddle_mobile.framework.proto.OpProto.Attr"; -} + } + + void OpProto_Attr::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpProto.Attr) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required string name = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(1, this->name(), output); + } + + // required .paddle_mobile.framework.proto.AttrType type = 2; + if (cached_has_bits & 0x00000004u) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 2, this->type(), output); + } + + // required string comment = 3; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(3, this->comment(), output); + } + + // optional bool generated = 4 [default = false]; + if (cached_has_bits & 0x00000008u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 4, this->generated(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpProto.Attr) + } + + size_t OpProto_Attr::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpProto.Attr) + size_t total_size = 0; + + if (has_name()) { + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + } + + if (has_comment()) { + // required string comment = 3; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->comment()); + } + + if (has_type()) { + // required .paddle_mobile.framework.proto.AttrType type = + // 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->type()); + } + + return total_size; + } + size_t OpProto_Attr::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpProto.Attr) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000007) ^ 0x00000007) == + 0) { // All required fields are present. + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + + // required string comment = 3; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->comment()); + + // required .paddle_mobile.framework.proto.AttrType type = + // 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->type()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + // optional bool generated = 4 [default = false]; + if (has_generated()) { + total_size += 1 + 1; + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void OpProto_Attr::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom(*::google::protobuf::down_cast( + &from)); + } + + void OpProto_Attr::MergeFrom(const OpProto_Attr &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpProto.Attr) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 15u) { + if (cached_has_bits & 0x00000001u) { + set_has_name(); + name_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + if (cached_has_bits & 0x00000002u) { + set_has_comment(); + comment_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.comment_); + } + if (cached_has_bits & 0x00000004u) { + type_ = from.type_; + } + if (cached_has_bits & 0x00000008u) { + generated_ = from.generated_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void OpProto_Attr::CopyFrom(const OpProto_Attr &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpProto.Attr) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool OpProto_Attr::IsInitialized() const { + if ((_has_bits_[0] & 0x00000007) != 0x00000007) + return false; + return true; + } + + void OpProto_Attr::Swap(OpProto_Attr *other) { + if (other == this) + return; + InternalSwap(other); + } + void OpProto_Attr::InternalSwap(OpProto_Attr *other) { + using std::swap; + name_.Swap(&other->name_); + comment_.Swap(&other->comment_); + swap(type_, other->type_); + swap(generated_, other->generated_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string OpProto_Attr::GetTypeName() const { + return "paddle_mobile.framework.proto.OpProto.Attr"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// OpProto_Attr - -// required string name = 1; -bool OpProto_Attr::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void OpProto_Attr::set_has_name() { _has_bits_[0] |= 0x00000001u; } -void OpProto_Attr::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -void OpProto_Attr::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string &OpProto_Attr::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.name) - return name_.GetNoArena(); -} -void OpProto_Attr::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.name) -} + // OpProto_Attr + + // required string name = 1; + bool OpProto_Attr::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void OpProto_Attr::set_has_name() { _has_bits_[0] |= 0x00000001u; } + void OpProto_Attr::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + void OpProto_Attr::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + const ::std::string &OpProto_Attr::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.name) + return name_.GetNoArena(); + } + void OpProto_Attr::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.name) + } #if LANG_CXX11 -void OpProto_Attr::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.name) -} + void OpProto_Attr::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.name) + } #endif -void OpProto_Attr::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.name) -} -void OpProto_Attr::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.name) -} -::std::string *OpProto_Attr::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpProto_Attr::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpProto_Attr::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.name) -} - -// required .paddle_mobile.framework.proto.AttrType type = 2; -bool OpProto_Attr::has_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void OpProto_Attr::set_has_type() { _has_bits_[0] |= 0x00000004u; } -void OpProto_Attr::clear_has_type() { _has_bits_[0] &= ~0x00000004u; } -void OpProto_Attr::clear_type() { - type_ = 0; - clear_has_type(); -} -::paddle_mobile::framework::proto::AttrType OpProto_Attr::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.type) - return static_cast<::paddle_mobile::framework::proto::AttrType>(type_); -} -void OpProto_Attr::set_type(::paddle_mobile::framework::proto::AttrType value) { - assert(::paddle_mobile::framework::proto::AttrType_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.type) -} - -// required string comment = 3; -bool OpProto_Attr::has_comment() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void OpProto_Attr::set_has_comment() { _has_bits_[0] |= 0x00000002u; } -void OpProto_Attr::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } -void OpProto_Attr::clear_comment() { - comment_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_comment(); -} -const ::std::string &OpProto_Attr::comment() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.comment) - return comment_.GetNoArena(); -} -void OpProto_Attr::set_comment(const ::std::string &value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.comment) -} + void OpProto_Attr::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.name) + } + void OpProto_Attr::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.name) + } + ::std::string *OpProto_Attr::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpProto_Attr::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpProto_Attr::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.name) + } + + // required .paddle_mobile.framework.proto.AttrType type = 2; + bool OpProto_Attr::has_type() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + void OpProto_Attr::set_has_type() { _has_bits_[0] |= 0x00000004u; } + void OpProto_Attr::clear_has_type() { + _has_bits_[0] &= ~0x00000004u; + } + void OpProto_Attr::clear_type() { + type_ = 0; + clear_has_type(); + } + ::paddle_mobile::framework::proto::AttrType + OpProto_Attr::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.type) + return static_cast<::paddle_mobile::framework::proto::AttrType>( + type_); + } + void OpProto_Attr::set_type( + ::paddle_mobile::framework::proto::AttrType value) { + assert( + ::paddle_mobile::framework::proto::AttrType_IsValid(value)); + set_has_type(); + type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.type) + } + + // required string comment = 3; + bool OpProto_Attr::has_comment() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void OpProto_Attr::set_has_comment() { + _has_bits_[0] |= 0x00000002u; + } + void OpProto_Attr::clear_has_comment() { + _has_bits_[0] &= ~0x00000002u; + } + void OpProto_Attr::clear_comment() { + comment_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_comment(); + } + const ::std::string &OpProto_Attr::comment() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.comment) + return comment_.GetNoArena(); + } + void OpProto_Attr::set_comment(const ::std::string &value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.comment) + } #if LANG_CXX11 -void OpProto_Attr::set_comment(::std::string &&value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.comment) -} + void OpProto_Attr::set_comment(::std::string &&value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.comment) + } #endif -void OpProto_Attr::set_comment(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.comment) -} -void OpProto_Attr::set_comment(const char *value, size_t size) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.comment) -} -::std::string *OpProto_Attr::mutable_comment() { - set_has_comment(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.comment) - return comment_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpProto_Attr::release_comment() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.comment) - clear_has_comment(); - return comment_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpProto_Attr::set_allocated_comment(::std::string *comment) { - if (comment != NULL) { - set_has_comment(); - } else { - clear_has_comment(); - } - comment_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), comment); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.comment) -} - -// optional bool generated = 4 [default = false]; -bool OpProto_Attr::has_generated() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void OpProto_Attr::set_has_generated() { _has_bits_[0] |= 0x00000008u; } -void OpProto_Attr::clear_has_generated() { _has_bits_[0] &= ~0x00000008u; } -void OpProto_Attr::clear_generated() { - generated_ = false; - clear_has_generated(); -} -bool OpProto_Attr::generated() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.generated) - return generated_; -} -void OpProto_Attr::set_generated(bool value) { - set_has_generated(); - generated_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.generated) -} + void OpProto_Attr::set_comment(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.comment) + } + void OpProto_Attr::set_comment(const char *value, size_t size) { + set_has_comment(); + comment_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.comment) + } + ::std::string *OpProto_Attr::mutable_comment() { + set_has_comment(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.comment) + return comment_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpProto_Attr::release_comment() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.comment) + clear_has_comment(); + return comment_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpProto_Attr::set_allocated_comment(::std::string *comment) { + if (comment != NULL) { + set_has_comment(); + } else { + clear_has_comment(); + } + comment_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + comment); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.comment) + } + + // optional bool generated = 4 [default = false]; + bool OpProto_Attr::has_generated() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + void OpProto_Attr::set_has_generated() { + _has_bits_[0] |= 0x00000008u; + } + void OpProto_Attr::clear_has_generated() { + _has_bits_[0] &= ~0x00000008u; + } + void OpProto_Attr::clear_generated() { + generated_ = false; + clear_has_generated(); + } + bool OpProto_Attr::generated() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.generated) + return generated_; + } + void OpProto_Attr::set_generated(bool value) { + set_has_generated(); + generated_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.generated) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int OpProto::kTypeFieldNumber; -const int OpProto::kInputsFieldNumber; -const int OpProto::kOutputsFieldNumber; -const int OpProto::kAttrsFieldNumber; -const int OpProto::kCommentFieldNumber; + const int OpProto::kTypeFieldNumber; + const int OpProto::kInputsFieldNumber; + const int OpProto::kOutputsFieldNumber; + const int OpProto::kAttrsFieldNumber; + const int OpProto::kCommentFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -OpProto::OpProto() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpProto) -} -OpProto::OpProto(const OpProto &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), inputs_(from.inputs_), - outputs_(from.outputs_), attrs_(from.attrs_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - type_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_type()) { - type_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.type_); - } - comment_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_comment()) { - comment_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.comment_); - } - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpProto) -} - -void OpProto::SharedCtor() { - _cached_size_ = 0; - type_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - comment_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -OpProto::~OpProto() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpProto) - SharedDtor(); -} - -void OpProto::SharedDtor() { - type_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - comment_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} - -void OpProto::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const OpProto &OpProto::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -OpProto *OpProto::New(::google::protobuf::Arena *arena) const { - OpProto *n = new OpProto; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void OpProto::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpProto) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - inputs_.Clear(); - outputs_.Clear(); - attrs_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - GOOGLE_DCHECK(!type_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*type_.UnsafeRawStringPointer())->clear(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(!comment_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*comment_.UnsafeRawStringPointer())->clear(); - } - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool OpProto::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + OpProto::OpProto() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.OpProto) + } + OpProto::OpProto(const OpProto &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + inputs_(from.inputs_), outputs_(from.outputs_), + attrs_(from.attrs_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + type_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_type()) { + type_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.type_); + } + comment_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_comment()) { + comment_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.comment_); + } + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.OpProto) + } + + void OpProto::SharedCtor() { + _cached_size_ = 0; + type_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + comment_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + OpProto::~OpProto() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.OpProto) + SharedDtor(); + } + + void OpProto::SharedDtor() { + type_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + comment_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + + void OpProto::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const OpProto &OpProto::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + OpProto *OpProto::New(::google::protobuf::Arena *arena) const { + OpProto *n = new OpProto; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void OpProto::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.OpProto) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + inputs_.Clear(); + outputs_.Clear(); + attrs_.Clear(); + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(!type_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*type_.UnsafeRawStringPointer())->clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(!comment_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*comment_.UnsafeRawStringPointer())->clear(); + } + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool OpProto::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpProto) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string type = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_type())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_inputs())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_outputs())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_attrs())); - } else { - goto handle_unusual; - } - break; - } - - // required string comment = 5; - case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_comment())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpProto) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpProto) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.OpProto) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required string type = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_type())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var + // inputs = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_inputs())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var + // outputs = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_outputs())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Attr + // attrs = 4; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 34u /* 34 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_attrs())); + } else { + goto handle_unusual; + } + break; + } + + // required string comment = 5; + case 5: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 42u /* 42 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_comment())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.OpProto) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.OpProto) + return false; #undef DO_ -} - -void OpProto::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpProto) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required string type = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->type(), output); - } - - // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; - for (unsigned int i = 0, n = static_cast(this->inputs_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 2, this->inputs(static_cast(i)), output); - } - - // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; - for (unsigned int i = 0, n = static_cast(this->outputs_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 3, this->outputs(static_cast(i)), output); - } - - // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; - for (unsigned int i = 0, n = static_cast(this->attrs_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 4, this->attrs(static_cast(i)), output); - } - - // required string comment = 5; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 5, this->comment(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpProto) -} - -size_t OpProto::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpProto) - size_t total_size = 0; - - if (has_type()) { - // required string type = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->type()); - } - - if (has_comment()) { - // required string comment = 5; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->comment()); - } - - return total_size; -} -size_t OpProto::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpProto) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == - 0) { // All required fields are present. - // required string type = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->type()); - - // required string comment = 5; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->comment()); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; - { - unsigned int count = static_cast(this->inputs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->inputs(static_cast(i))); - } - } - - // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; - { - unsigned int count = static_cast(this->outputs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->outputs(static_cast(i))); - } - } - - // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; - { - unsigned int count = static_cast(this->attrs_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->attrs(static_cast(i))); - } - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void OpProto::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void OpProto::MergeFrom(const OpProto &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpProto) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - inputs_.MergeFrom(from.inputs_); - outputs_.MergeFrom(from.outputs_); - attrs_.MergeFrom(from.attrs_); - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - set_has_type(); - type_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.type_); - } - if (cached_has_bits & 0x00000002u) { - set_has_comment(); - comment_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.comment_); - } - } -} - -void OpProto::CopyFrom(const OpProto &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpProto) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool OpProto::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->inputs())) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->outputs())) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->attrs())) - return false; - return true; -} - -void OpProto::Swap(OpProto *other) { - if (other == this) - return; - InternalSwap(other); -} -void OpProto::InternalSwap(OpProto *other) { - using std::swap; - inputs_.InternalSwap(&other->inputs_); - outputs_.InternalSwap(&other->outputs_); - attrs_.InternalSwap(&other->attrs_); - type_.Swap(&other->type_); - comment_.Swap(&other->comment_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string OpProto::GetTypeName() const { - return "paddle_mobile.framework.proto.OpProto"; -} + } + + void OpProto::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.OpProto) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required string type = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(1, this->type(), output); + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = + // 2; + for (unsigned int i = 0, n = static_cast( + this->inputs_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->inputs(static_cast(i)), output); + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = + // 3; + for (unsigned int i = 0, n = static_cast( + this->outputs_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 3, this->outputs(static_cast(i)), output); + } + + // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = + // 4; + for (unsigned int i = 0, n = static_cast( + this->attrs_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 4, this->attrs(static_cast(i)), output); + } + + // required string comment = 5; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(5, this->comment(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.OpProto) + } + + size_t OpProto::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.OpProto) + size_t total_size = 0; + + if (has_type()) { + // required string type = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->type()); + } + + if (has_comment()) { + // required string comment = 5; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->comment()); + } + + return total_size; + } + size_t OpProto::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.OpProto) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == + 0) { // All required fields are present. + // required string type = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->type()); + + // required string comment = 5; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->comment()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = + // 2; + { + unsigned int count = + static_cast(this->inputs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->inputs(static_cast(i))); + } + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = + // 3; + { + unsigned int count = + static_cast(this->outputs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->outputs(static_cast(i))); + } + } + + // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = + // 4; + { + unsigned int count = + static_cast(this->attrs_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->attrs(static_cast(i))); + } + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void OpProto::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void OpProto::MergeFrom(const OpProto &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.OpProto) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + inputs_.MergeFrom(from.inputs_); + outputs_.MergeFrom(from.outputs_); + attrs_.MergeFrom(from.attrs_); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + set_has_type(); + type_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.type_); + } + if (cached_has_bits & 0x00000002u) { + set_has_comment(); + comment_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.comment_); + } + } + } + + void OpProto::CopyFrom(const OpProto &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.OpProto) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool OpProto::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->inputs())) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->outputs())) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->attrs())) + return false; + return true; + } + + void OpProto::Swap(OpProto *other) { + if (other == this) + return; + InternalSwap(other); + } + void OpProto::InternalSwap(OpProto *other) { + using std::swap; + inputs_.InternalSwap(&other->inputs_); + outputs_.InternalSwap(&other->outputs_); + attrs_.InternalSwap(&other->attrs_); + type_.Swap(&other->type_); + comment_.Swap(&other->comment_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string OpProto::GetTypeName() const { + return "paddle_mobile.framework.proto.OpProto"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// OpProto - -// required string type = 1; -bool OpProto::has_type() const { return (_has_bits_[0] & 0x00000001u) != 0; } -void OpProto::set_has_type() { _has_bits_[0] |= 0x00000001u; } -void OpProto::clear_has_type() { _has_bits_[0] &= ~0x00000001u; } -void OpProto::clear_type() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_type(); -} -const ::std::string &OpProto::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.type) - return type_.GetNoArena(); -} -void OpProto::set_type(const ::std::string &value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.type) -} + // OpProto + + // required string type = 1; + bool OpProto::has_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void OpProto::set_has_type() { _has_bits_[0] |= 0x00000001u; } + void OpProto::clear_has_type() { _has_bits_[0] &= ~0x00000001u; } + void OpProto::clear_type() { + type_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_type(); + } + const ::std::string &OpProto::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.type) + return type_.GetNoArena(); + } + void OpProto::set_type(const ::std::string &value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.type) + } #if LANG_CXX11 -void OpProto::set_type(::std::string &&value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.type) -} + void OpProto::set_type(::std::string &&value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.type) + } #endif -void OpProto::set_type(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.type) -} -void OpProto::set_type(const char *value, size_t size) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.type) -} -::std::string *OpProto::mutable_type() { - set_has_type(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.type) - return type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpProto::release_type() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.type) - clear_has_type(); - return type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpProto::set_allocated_type(::std::string *type) { - if (type != NULL) { - set_has_type(); - } else { - clear_has_type(); - } - type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.type) -} - -// repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; -int OpProto::inputs_size() const { return inputs_.size(); } -void OpProto::clear_inputs() { inputs_.Clear(); } -const ::paddle_mobile::framework::proto::OpProto_Var & -OpProto::inputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_.Get(index); -} -::paddle_mobile::framework::proto::OpProto_Var * -OpProto::mutable_inputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_.Mutable(index); -} -::paddle_mobile::framework::proto::OpProto_Var *OpProto::add_inputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> * -OpProto::mutable_inputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.inputs) - return &inputs_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> & -OpProto::inputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_; -} - -// repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; -int OpProto::outputs_size() const { return outputs_.size(); } -void OpProto::clear_outputs() { outputs_.Clear(); } -const ::paddle_mobile::framework::proto::OpProto_Var & -OpProto::outputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_.Get(index); -} -::paddle_mobile::framework::proto::OpProto_Var * -OpProto::mutable_outputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_.Mutable(index); -} -::paddle_mobile::framework::proto::OpProto_Var *OpProto::add_outputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> * -OpProto::mutable_outputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.outputs) - return &outputs_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> & -OpProto::outputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_; -} - -// repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; -int OpProto::attrs_size() const { return attrs_.size(); } -void OpProto::clear_attrs() { attrs_.Clear(); } -const ::paddle_mobile::framework::proto::OpProto_Attr & -OpProto::attrs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_.Get(index); -} -::paddle_mobile::framework::proto::OpProto_Attr * -OpProto::mutable_attrs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_.Mutable(index); -} -::paddle_mobile::framework::proto::OpProto_Attr *OpProto::add_attrs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> * -OpProto::mutable_attrs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.attrs) - return &attrs_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> & -OpProto::attrs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_; -} - -// required string comment = 5; -bool OpProto::has_comment() const { return (_has_bits_[0] & 0x00000002u) != 0; } -void OpProto::set_has_comment() { _has_bits_[0] |= 0x00000002u; } -void OpProto::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } -void OpProto::clear_comment() { - comment_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_comment(); -} -const ::std::string &OpProto::comment() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.comment) - return comment_.GetNoArena(); -} -void OpProto::set_comment(const ::std::string &value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.comment) -} + void OpProto::set_type(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.type) + } + void OpProto::set_type(const char *value, size_t size) { + set_has_type(); + type_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.type) + } + ::std::string *OpProto::mutable_type() { + set_has_type(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.type) + return type_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpProto::release_type() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.type) + clear_has_type(); + return type_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpProto::set_allocated_type(::std::string *type) { + if (type != NULL) { + set_has_type(); + } else { + clear_has_type(); + } + type_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + type); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.type) + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; + int OpProto::inputs_size() const { return inputs_.size(); } + void OpProto::clear_inputs() { inputs_.Clear(); } + const ::paddle_mobile::framework::proto::OpProto_Var & + OpProto::inputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_.Get(index); + } + ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::add_inputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> * + OpProto::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.inputs) + return &inputs_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> & + OpProto::inputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; + int OpProto::outputs_size() const { return outputs_.size(); } + void OpProto::clear_outputs() { outputs_.Clear(); } + const ::paddle_mobile::framework::proto::OpProto_Var & + OpProto::outputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_.Get(index); + } + ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::add_outputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> * + OpProto::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.outputs) + return &outputs_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> & + OpProto::outputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; + int OpProto::attrs_size() const { return attrs_.size(); } + void OpProto::clear_attrs() { attrs_.Clear(); } + const ::paddle_mobile::framework::proto::OpProto_Attr & + OpProto::attrs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_.Get(index); + } + ::paddle_mobile::framework::proto::OpProto_Attr * + OpProto::mutable_attrs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpProto_Attr * + OpProto::add_attrs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> * + OpProto::mutable_attrs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.attrs) + return &attrs_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> & + OpProto::attrs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_; + } + + // required string comment = 5; + bool OpProto::has_comment() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void OpProto::set_has_comment() { _has_bits_[0] |= 0x00000002u; } + void OpProto::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } + void OpProto::clear_comment() { + comment_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_comment(); + } + const ::std::string &OpProto::comment() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.comment) + return comment_.GetNoArena(); + } + void OpProto::set_comment(const ::std::string &value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.comment) + } #if LANG_CXX11 -void OpProto::set_comment(::std::string &&value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.comment) -} + void OpProto::set_comment(::std::string &&value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.comment) + } #endif -void OpProto::set_comment(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.comment) -} -void OpProto::set_comment(const char *value, size_t size) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.comment) -} -::std::string *OpProto::mutable_comment() { - set_has_comment(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.comment) - return comment_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *OpProto::release_comment() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.comment) - clear_has_comment(); - return comment_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void OpProto::set_allocated_comment(::std::string *comment) { - if (comment != NULL) { - set_has_comment(); - } else { - clear_has_comment(); - } - comment_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), comment); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.comment) -} + void OpProto::set_comment(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.comment) + } + void OpProto::set_comment(const char *value, size_t size) { + set_has_comment(); + comment_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.comment) + } + ::std::string *OpProto::mutable_comment() { + set_has_comment(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.comment) + return comment_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *OpProto::release_comment() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.comment) + clear_has_comment(); + return comment_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void OpProto::set_allocated_comment(::std::string *comment) { + if (comment != NULL) { + set_has_comment(); + } else { + clear_has_comment(); + } + comment_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + comment); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.comment) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType_TensorDesc::kDataTypeFieldNumber; -const int VarType_TensorDesc::kDimsFieldNumber; + const int VarType_TensorDesc::kDataTypeFieldNumber; + const int VarType_TensorDesc::kDimsFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType_TensorDesc::VarType_TensorDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.TensorDesc) -} -VarType_TensorDesc::VarType_TensorDesc(const VarType_TensorDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), dims_(from.dims_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - data_type_ = from.data_type_; - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.TensorDesc) -} - -void VarType_TensorDesc::SharedCtor() { - _cached_size_ = 0; - data_type_ = 0; -} - -VarType_TensorDesc::~VarType_TensorDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.TensorDesc) - SharedDtor(); -} - -void VarType_TensorDesc::SharedDtor() {} - -void VarType_TensorDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType_TensorDesc &VarType_TensorDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType_TensorDesc * -VarType_TensorDesc::New(::google::protobuf::Arena *arena) const { - VarType_TensorDesc *n = new VarType_TensorDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType_TensorDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.TensorDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - dims_.Clear(); - data_type_ = 0; - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType_TensorDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarType_TensorDesc::VarType_TensorDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.TensorDesc) + } + VarType_TensorDesc::VarType_TensorDesc( + const VarType_TensorDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + dims_(from.dims_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + data_type_ = from.data_type_; + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.TensorDesc) + } + + void VarType_TensorDesc::SharedCtor() { + _cached_size_ = 0; + data_type_ = 0; + } + + VarType_TensorDesc::~VarType_TensorDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.TensorDesc) + SharedDtor(); + } + + void VarType_TensorDesc::SharedDtor() {} + + void VarType_TensorDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType_TensorDesc &VarType_TensorDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType_TensorDesc * + VarType_TensorDesc::New(::google::protobuf::Arena *arena) const { + VarType_TensorDesc *n = new VarType_TensorDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType_TensorDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.TensorDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + dims_.Clear(); + data_type_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType_TensorDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.TensorDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::paddle_mobile::framework::proto::VarType_Type_IsValid(value)) { - set_data_type( - static_cast<::paddle_mobile::framework::proto::VarType_Type>( - value)); - } else { - unknown_fields_stream.WriteVarint32(8u); - unknown_fields_stream.WriteVarint32( - static_cast<::google::protobuf::uint32>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // repeated int64 dims = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - DO_(( - ::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< - ::google::protobuf::int64, - ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - 1, 16u, input, this->mutable_dims()))); - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite:: - ReadPackedPrimitiveNoInline< - ::google::protobuf::int64, - ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, this->mutable_dims()))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.TensorDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.TensorDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.TensorDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 8u /* 8 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + int, ::google::protobuf::internal:: + WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::paddle_mobile::framework::proto:: + VarType_Type_IsValid(value)) { + set_data_type( + static_cast<::paddle_mobile::framework:: + proto::VarType_Type>( + value)); + } else { + unknown_fields_stream.WriteVarint32(8u); + unknown_fields_stream.WriteVarint32( + static_cast<::google::protobuf::uint32>( + value)); + } + } else { + goto handle_unusual; + } + break; + } + + // repeated int64 dims = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadRepeatedPrimitive< + ::google::protobuf::int64, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT64>( + 1, 16u, input, this->mutable_dims()))); + } else if (static_cast<::google::protobuf::uint8>( + tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPackedPrimitiveNoInline< + ::google::protobuf::int64, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT64>( + input, this->mutable_dims()))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.TensorDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.TensorDesc) + return false; #undef DO_ -} - -void VarType_TensorDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.TensorDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 1, this->data_type(), output); - } - - // repeated int64 dims = 2; - for (int i = 0, n = this->dims_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->dims(i), - output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.TensorDesc) -} - -size_t VarType_TensorDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.TensorDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - if (has_data_type()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->data_type()); - } - // repeated int64 dims = 2; - { - size_t data_size = - ::google::protobuf::internal::WireFormatLite::Int64Size(this->dims_); - total_size += - 1 * ::google::protobuf::internal::FromIntSize(this->dims_size()); - total_size += data_size; - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType_TensorDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void VarType_TensorDesc::MergeFrom(const VarType_TensorDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.TensorDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - dims_.MergeFrom(from.dims_); - if (from.has_data_type()) { - set_data_type(from.data_type()); - } -} - -void VarType_TensorDesc::CopyFrom(const VarType_TensorDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.TensorDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType_TensorDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) - return false; - return true; -} - -void VarType_TensorDesc::Swap(VarType_TensorDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType_TensorDesc::InternalSwap(VarType_TensorDesc *other) { - using std::swap; - dims_.InternalSwap(&other->dims_); - swap(data_type_, other->data_type_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType_TensorDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType.TensorDesc"; -} + } + + void VarType_TensorDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.TensorDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->data_type(), output); + } + + // repeated int64 dims = 2; + for (int i = 0, n = this->dims_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt64( + 2, this->dims(i), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.TensorDesc) + } + + size_t VarType_TensorDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.TensorDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + if (has_data_type()) { + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->data_type()); + } + // repeated int64 dims = 2; + { + size_t data_size = + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->dims_); + total_size += 1 * ::google::protobuf::internal::FromIntSize( + this->dims_size()); + total_size += data_size; + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType_TensorDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast( + &from)); + } + + void VarType_TensorDesc::MergeFrom(const VarType_TensorDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.TensorDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + dims_.MergeFrom(from.dims_); + if (from.has_data_type()) { + set_data_type(from.data_type()); + } + } + + void VarType_TensorDesc::CopyFrom(const VarType_TensorDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.TensorDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType_TensorDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) + return false; + return true; + } + + void VarType_TensorDesc::Swap(VarType_TensorDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarType_TensorDesc::InternalSwap(VarType_TensorDesc *other) { + using std::swap; + dims_.InternalSwap(&other->dims_); + swap(data_type_, other->data_type_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType_TensorDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType.TensorDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType_TensorDesc - -// required .paddle_mobile.framework.proto.VarType.Type data_type = 1; -bool VarType_TensorDesc::has_data_type() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void VarType_TensorDesc::set_has_data_type() { _has_bits_[0] |= 0x00000001u; } -void VarType_TensorDesc::clear_has_data_type() { - _has_bits_[0] &= ~0x00000001u; -} -void VarType_TensorDesc::clear_data_type() { - data_type_ = 0; - clear_has_data_type(); -} -::paddle_mobile::framework::proto::VarType_Type -VarType_TensorDesc::data_type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>( - data_type_); -} -void VarType_TensorDesc::set_data_type( - ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - set_has_data_type(); - data_type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) -} - -// repeated int64 dims = 2; -int VarType_TensorDesc::dims_size() const { return dims_.size(); } -void VarType_TensorDesc::clear_dims() { dims_.Clear(); } -::google::protobuf::int64 VarType_TensorDesc::dims(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.dims) - return dims_.Get(index); -} -void VarType_TensorDesc::set_dims(int index, ::google::protobuf::int64 value) { - dims_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.dims) -} -void VarType_TensorDesc::add_dims(::google::protobuf::int64 value) { - dims_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.TensorDesc.dims) -} -const ::google::protobuf::RepeatedField<::google::protobuf::int64> & -VarType_TensorDesc::dims() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) - return dims_; -} -::google::protobuf::RepeatedField<::google::protobuf::int64> * -VarType_TensorDesc::mutable_dims() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) - return &dims_; -} + // VarType_TensorDesc + + // required .paddle_mobile.framework.proto.VarType.Type data_type = + // 1; + bool VarType_TensorDesc::has_data_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void VarType_TensorDesc::set_has_data_type() { + _has_bits_[0] |= 0x00000001u; + } + void VarType_TensorDesc::clear_has_data_type() { + _has_bits_[0] &= ~0x00000001u; + } + void VarType_TensorDesc::clear_data_type() { + data_type_ = 0; + clear_has_data_type(); + } + ::paddle_mobile::framework::proto::VarType_Type + VarType_TensorDesc::data_type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>( + data_type_); + } + void VarType_TensorDesc::set_data_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + set_has_data_type(); + data_type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) + } + + // repeated int64 dims = 2; + int VarType_TensorDesc::dims_size() const { return dims_.size(); } + void VarType_TensorDesc::clear_dims() { dims_.Clear(); } + ::google::protobuf::int64 + VarType_TensorDesc::dims(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + return dims_.Get(index); + } + void VarType_TensorDesc::set_dims(int index, + ::google::protobuf::int64 value) { + dims_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + } + void VarType_TensorDesc::add_dims(::google::protobuf::int64 value) { + dims_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + } + const ::google::protobuf::RepeatedField<::google::protobuf::int64> & + VarType_TensorDesc::dims() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + return dims_; + } + ::google::protobuf::RepeatedField<::google::protobuf::int64> * + VarType_TensorDesc::mutable_dims() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + return &dims_; + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType_LoDTensorDesc::kTensorFieldNumber; -const int VarType_LoDTensorDesc::kLodLevelFieldNumber; + const int VarType_LoDTensorDesc::kTensorFieldNumber; + const int VarType_LoDTensorDesc::kLodLevelFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType_LoDTensorDesc::VarType_LoDTensorDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.LoDTensorDesc) -} -VarType_LoDTensorDesc::VarType_LoDTensorDesc(const VarType_LoDTensorDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - if (from.has_tensor()) { - tensor_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc( - *from.tensor_); - } else { - tensor_ = NULL; - } - lod_level_ = from.lod_level_; - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.LoDTensorDesc) -} - -void VarType_LoDTensorDesc::SharedCtor() { - _cached_size_ = 0; - ::memset(&tensor_, 0, - static_cast(reinterpret_cast(&lod_level_) - - reinterpret_cast(&tensor_)) + - sizeof(lod_level_)); -} - -VarType_LoDTensorDesc::~VarType_LoDTensorDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - SharedDtor(); -} - -void VarType_LoDTensorDesc::SharedDtor() { - if (this != internal_default_instance()) - delete tensor_; -} - -void VarType_LoDTensorDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType_LoDTensorDesc &VarType_LoDTensorDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType_LoDTensorDesc * -VarType_LoDTensorDesc::New(::google::protobuf::Arena *arena) const { - VarType_LoDTensorDesc *n = new VarType_LoDTensorDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType_LoDTensorDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - if (has_tensor()) { - GOOGLE_DCHECK(tensor_ != NULL); - tensor_->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - } - lod_level_ = 0; - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType_LoDTensorDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarType_LoDTensorDesc::VarType_LoDTensorDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + } + VarType_LoDTensorDesc::VarType_LoDTensorDesc( + const VarType_LoDTensorDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from.has_tensor()) { + tensor_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc(*from.tensor_); + } else { + tensor_ = NULL; + } + lod_level_ = from.lod_level_; + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + } + + void VarType_LoDTensorDesc::SharedCtor() { + _cached_size_ = 0; + ::memset( + &tensor_, 0, + static_cast(reinterpret_cast(&lod_level_) - + reinterpret_cast(&tensor_)) + + sizeof(lod_level_)); + } + + VarType_LoDTensorDesc::~VarType_LoDTensorDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + SharedDtor(); + } + + void VarType_LoDTensorDesc::SharedDtor() { + if (this != internal_default_instance()) + delete tensor_; + } + + void VarType_LoDTensorDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType_LoDTensorDesc & + VarType_LoDTensorDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType_LoDTensorDesc * + VarType_LoDTensorDesc::New(::google::protobuf::Arena *arena) const { + VarType_LoDTensorDesc *n = new VarType_LoDTensorDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType_LoDTensorDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + if (has_tensor()) { + GOOGLE_DCHECK(tensor_ != NULL); + tensor_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + } + lod_level_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType_LoDTensorDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_tensor())); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 lod_level = 2 [default = 0]; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - set_has_lod_level(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &lod_level_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required + // .paddle_mobile.framework.proto.VarType.TensorDesc tensor + // = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_tensor())); + } else { + goto handle_unusual; + } + break; + } + + // optional int32 lod_level = 2 [default = 0]; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + set_has_lod_level(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, &lod_level_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + return false; #undef DO_ -} - -void VarType_LoDTensorDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, *this->tensor_, output); - } - - // optional int32 lod_level = 2 [default = 0]; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32( - 2, this->lod_level(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.LoDTensorDesc) -} - -size_t VarType_LoDTensorDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - if (has_tensor()) { - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->tensor_); - } - // optional int32 lod_level = 2 [default = 0]; - if (has_lod_level()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->lod_level()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType_LoDTensorDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom( - *::google::protobuf::down_cast(&from)); -} - -void VarType_LoDTensorDesc::MergeFrom(const VarType_LoDTensorDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - mutable_tensor() - ->::paddle_mobile::framework::proto::VarType_TensorDesc::MergeFrom( - from.tensor()); - } - if (cached_has_bits & 0x00000002u) { - lod_level_ = from.lod_level_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void VarType_LoDTensorDesc::CopyFrom(const VarType_LoDTensorDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType_LoDTensorDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) - return false; - if (has_tensor()) { - if (!this->tensor_->IsInitialized()) - return false; - } - return true; -} - -void VarType_LoDTensorDesc::Swap(VarType_LoDTensorDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType_LoDTensorDesc::InternalSwap(VarType_LoDTensorDesc *other) { - using std::swap; - swap(tensor_, other->tensor_); - swap(lod_level_, other->lod_level_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType_LoDTensorDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType.LoDTensorDesc"; -} + } + + void VarType_LoDTensorDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required .paddle_mobile.framework.proto.VarType.TensorDesc + // tensor = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, *this->tensor_, output); + } + + // optional int32 lod_level = 2 [default = 0]; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 2, this->lod_level(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + } + + size_t VarType_LoDTensorDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // required .paddle_mobile.framework.proto.VarType.TensorDesc + // tensor = 1; + if (has_tensor()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->tensor_); + } + // optional int32 lod_level = 2 [default = 0]; + if (has_lod_level()) { + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->lod_level()); + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType_LoDTensorDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom(*::google::protobuf::down_cast< + const VarType_LoDTensorDesc *>(&from)); + } + + void VarType_LoDTensorDesc::MergeFrom( + const VarType_LoDTensorDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + mutable_tensor()->::paddle_mobile::framework::proto:: + VarType_TensorDesc::MergeFrom(from.tensor()); + } + if (cached_has_bits & 0x00000002u) { + lod_level_ = from.lod_level_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void + VarType_LoDTensorDesc::CopyFrom(const VarType_LoDTensorDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType_LoDTensorDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) + return false; + if (has_tensor()) { + if (!this->tensor_->IsInitialized()) + return false; + } + return true; + } + + void VarType_LoDTensorDesc::Swap(VarType_LoDTensorDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void + VarType_LoDTensorDesc::InternalSwap(VarType_LoDTensorDesc *other) { + using std::swap; + swap(tensor_, other->tensor_); + swap(lod_level_, other->lod_level_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType_LoDTensorDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType.LoDTensorDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType_LoDTensorDesc - -// required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; -bool VarType_LoDTensorDesc::has_tensor() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void VarType_LoDTensorDesc::set_has_tensor() { _has_bits_[0] |= 0x00000001u; } -void VarType_LoDTensorDesc::clear_has_tensor() { - _has_bits_[0] &= ~0x00000001u; -} -void VarType_LoDTensorDesc::clear_tensor() { - if (tensor_ != NULL) - tensor_->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - clear_has_tensor(); -} -const ::paddle_mobile::framework::proto::VarType_TensorDesc & -VarType_LoDTensorDesc::tensor() const { - const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = tensor_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_TensorDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_TensorDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorDesc::mutable_tensor() { - set_has_tensor(); - if (tensor_ == NULL) { - tensor_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) - return tensor_; -} -::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorDesc::release_tensor() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) - clear_has_tensor(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = tensor_; - tensor_ = NULL; - return temp; -} -void VarType_LoDTensorDesc::set_allocated_tensor( - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { - delete tensor_; - tensor_ = tensor; - if (tensor) { - set_has_tensor(); - } else { - clear_has_tensor(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) -} - -// optional int32 lod_level = 2 [default = 0]; -bool VarType_LoDTensorDesc::has_lod_level() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void VarType_LoDTensorDesc::set_has_lod_level() { - _has_bits_[0] |= 0x00000002u; -} -void VarType_LoDTensorDesc::clear_has_lod_level() { - _has_bits_[0] &= ~0x00000002u; -} -void VarType_LoDTensorDesc::clear_lod_level() { - lod_level_ = 0; - clear_has_lod_level(); -} -::google::protobuf::int32 VarType_LoDTensorDesc::lod_level() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) - return lod_level_; -} -void VarType_LoDTensorDesc::set_lod_level(::google::protobuf::int32 value) { - set_has_lod_level(); - lod_level_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) -} + // VarType_LoDTensorDesc + + // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor + // = 1; + bool VarType_LoDTensorDesc::has_tensor() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void VarType_LoDTensorDesc::set_has_tensor() { + _has_bits_[0] |= 0x00000001u; + } + void VarType_LoDTensorDesc::clear_has_tensor() { + _has_bits_[0] &= ~0x00000001u; + } + void VarType_LoDTensorDesc::clear_tensor() { + if (tensor_ != NULL) + tensor_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + clear_has_tensor(); + } + const ::paddle_mobile::framework::proto::VarType_TensorDesc & + VarType_LoDTensorDesc::tensor() const { + const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = + tensor_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_TensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_TensorDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorDesc::mutable_tensor() { + set_has_tensor(); + if (tensor_ == NULL) { + tensor_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + return tensor_; + } + ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorDesc::release_tensor() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + clear_has_tensor(); + ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = + tensor_; + tensor_ = NULL; + return temp; + } + void VarType_LoDTensorDesc::set_allocated_tensor( + ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { + delete tensor_; + tensor_ = tensor; + if (tensor) { + set_has_tensor(); + } else { + clear_has_tensor(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + } + + // optional int32 lod_level = 2 [default = 0]; + bool VarType_LoDTensorDesc::has_lod_level() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void VarType_LoDTensorDesc::set_has_lod_level() { + _has_bits_[0] |= 0x00000002u; + } + void VarType_LoDTensorDesc::clear_has_lod_level() { + _has_bits_[0] &= ~0x00000002u; + } + void VarType_LoDTensorDesc::clear_lod_level() { + lod_level_ = 0; + clear_has_lod_level(); + } + ::google::protobuf::int32 VarType_LoDTensorDesc::lod_level() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) + return lod_level_; + } + void VarType_LoDTensorDesc::set_lod_level( + ::google::protobuf::int32 value) { + set_has_lod_level(); + lod_level_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType_LoDTensorArrayDesc::kTensorFieldNumber; -const int VarType_LoDTensorArrayDesc::kLodLevelFieldNumber; + const int VarType_LoDTensorArrayDesc::kTensorFieldNumber; + const int VarType_LoDTensorArrayDesc::kLodLevelFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType_LoDTensorArrayDesc::VarType_LoDTensorArrayDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) -} -VarType_LoDTensorArrayDesc::VarType_LoDTensorArrayDesc( - const VarType_LoDTensorArrayDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - if (from.has_tensor()) { - tensor_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc( - *from.tensor_); - } else { - tensor_ = NULL; - } - lod_level_ = from.lod_level_; - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) -} - -void VarType_LoDTensorArrayDesc::SharedCtor() { - _cached_size_ = 0; - ::memset(&tensor_, 0, - static_cast(reinterpret_cast(&lod_level_) - - reinterpret_cast(&tensor_)) + - sizeof(lod_level_)); -} - -VarType_LoDTensorArrayDesc::~VarType_LoDTensorArrayDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - SharedDtor(); -} - -void VarType_LoDTensorArrayDesc::SharedDtor() { - if (this != internal_default_instance()) - delete tensor_; -} - -void VarType_LoDTensorArrayDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType_LoDTensorArrayDesc & -VarType_LoDTensorArrayDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType_LoDTensorArrayDesc * -VarType_LoDTensorArrayDesc::New(::google::protobuf::Arena *arena) const { - VarType_LoDTensorArrayDesc *n = new VarType_LoDTensorArrayDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType_LoDTensorArrayDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - if (has_tensor()) { - GOOGLE_DCHECK(tensor_ != NULL); - tensor_->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - } - lod_level_ = 0; - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType_LoDTensorArrayDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarType_LoDTensorArrayDesc::VarType_LoDTensorArrayDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + } + VarType_LoDTensorArrayDesc::VarType_LoDTensorArrayDesc( + const VarType_LoDTensorArrayDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from.has_tensor()) { + tensor_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc(*from.tensor_); + } else { + tensor_ = NULL; + } + lod_level_ = from.lod_level_; + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + } + + void VarType_LoDTensorArrayDesc::SharedCtor() { + _cached_size_ = 0; + ::memset( + &tensor_, 0, + static_cast(reinterpret_cast(&lod_level_) - + reinterpret_cast(&tensor_)) + + sizeof(lod_level_)); + } + + VarType_LoDTensorArrayDesc::~VarType_LoDTensorArrayDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + SharedDtor(); + } + + void VarType_LoDTensorArrayDesc::SharedDtor() { + if (this != internal_default_instance()) + delete tensor_; + } + + void VarType_LoDTensorArrayDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType_LoDTensorArrayDesc & + VarType_LoDTensorArrayDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType_LoDTensorArrayDesc *VarType_LoDTensorArrayDesc::New( + ::google::protobuf::Arena *arena) const { + VarType_LoDTensorArrayDesc *n = new VarType_LoDTensorArrayDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType_LoDTensorArrayDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + if (has_tensor()) { + GOOGLE_DCHECK(tensor_ != NULL); + tensor_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + } + lod_level_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType_LoDTensorArrayDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_tensor())); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 lod_level = 2 [default = 0]; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - set_has_lod_level(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &lod_level_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required + // .paddle_mobile.framework.proto.VarType.TensorDesc tensor + // = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_tensor())); + } else { + goto handle_unusual; + } + break; + } + + // optional int32 lod_level = 2 [default = 0]; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + set_has_lod_level(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, &lod_level_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + return false; #undef DO_ -} - -void VarType_LoDTensorArrayDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, *this->tensor_, output); - } - - // optional int32 lod_level = 2 [default = 0]; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32( - 2, this->lod_level(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) -} - -size_t VarType_LoDTensorArrayDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - if (has_tensor()) { - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->tensor_); - } - // optional int32 lod_level = 2 [default = 0]; - if (has_lod_level()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->lod_level()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType_LoDTensorArrayDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast( - &from)); -} - -void VarType_LoDTensorArrayDesc::MergeFrom( - const VarType_LoDTensorArrayDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - mutable_tensor() - ->::paddle_mobile::framework::proto::VarType_TensorDesc::MergeFrom( - from.tensor()); - } - if (cached_has_bits & 0x00000002u) { - lod_level_ = from.lod_level_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void VarType_LoDTensorArrayDesc::CopyFrom( - const VarType_LoDTensorArrayDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType_LoDTensorArrayDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000001) != 0x00000001) - return false; - if (has_tensor()) { - if (!this->tensor_->IsInitialized()) - return false; - } - return true; -} - -void VarType_LoDTensorArrayDesc::Swap(VarType_LoDTensorArrayDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType_LoDTensorArrayDesc::InternalSwap( - VarType_LoDTensorArrayDesc *other) { - using std::swap; - swap(tensor_, other->tensor_); - swap(lod_level_, other->lod_level_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType_LoDTensorArrayDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc"; -} + } + + void VarType_LoDTensorArrayDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required .paddle_mobile.framework.proto.VarType.TensorDesc + // tensor = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, *this->tensor_, output); + } + + // optional int32 lod_level = 2 [default = 0]; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 2, this->lod_level(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + } + + size_t VarType_LoDTensorArrayDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // required .paddle_mobile.framework.proto.VarType.TensorDesc + // tensor = 1; + if (has_tensor()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->tensor_); + } + // optional int32 lod_level = 2 [default = 0]; + if (has_lod_level()) { + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->lod_level()); + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType_LoDTensorArrayDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom(*::google::protobuf::down_cast< + const VarType_LoDTensorArrayDesc *>(&from)); + } + + void VarType_LoDTensorArrayDesc::MergeFrom( + const VarType_LoDTensorArrayDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + mutable_tensor()->::paddle_mobile::framework::proto:: + VarType_TensorDesc::MergeFrom(from.tensor()); + } + if (cached_has_bits & 0x00000002u) { + lod_level_ = from.lod_level_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void VarType_LoDTensorArrayDesc::CopyFrom( + const VarType_LoDTensorArrayDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType_LoDTensorArrayDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) + return false; + if (has_tensor()) { + if (!this->tensor_->IsInitialized()) + return false; + } + return true; + } + + void VarType_LoDTensorArrayDesc::Swap( + VarType_LoDTensorArrayDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarType_LoDTensorArrayDesc::InternalSwap( + VarType_LoDTensorArrayDesc *other) { + using std::swap; + swap(tensor_, other->tensor_); + swap(lod_level_, other->lod_level_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType_LoDTensorArrayDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType." + "LoDTensorArrayDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType_LoDTensorArrayDesc - -// required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; -bool VarType_LoDTensorArrayDesc::has_tensor() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void VarType_LoDTensorArrayDesc::set_has_tensor() { - _has_bits_[0] |= 0x00000001u; -} -void VarType_LoDTensorArrayDesc::clear_has_tensor() { - _has_bits_[0] &= ~0x00000001u; -} -void VarType_LoDTensorArrayDesc::clear_tensor() { - if (tensor_ != NULL) - tensor_->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - clear_has_tensor(); -} -const ::paddle_mobile::framework::proto::VarType_TensorDesc & -VarType_LoDTensorArrayDesc::tensor() const { - const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = tensor_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_TensorDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_TensorDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorArrayDesc::mutable_tensor() { - set_has_tensor(); - if (tensor_ == NULL) { - tensor_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) - return tensor_; -} -::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorArrayDesc::release_tensor() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) - clear_has_tensor(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = tensor_; - tensor_ = NULL; - return temp; -} -void VarType_LoDTensorArrayDesc::set_allocated_tensor( - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { - delete tensor_; - tensor_ = tensor; - if (tensor) { - set_has_tensor(); - } else { - clear_has_tensor(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) -} - -// optional int32 lod_level = 2 [default = 0]; -bool VarType_LoDTensorArrayDesc::has_lod_level() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void VarType_LoDTensorArrayDesc::set_has_lod_level() { - _has_bits_[0] |= 0x00000002u; -} -void VarType_LoDTensorArrayDesc::clear_has_lod_level() { - _has_bits_[0] &= ~0x00000002u; -} -void VarType_LoDTensorArrayDesc::clear_lod_level() { - lod_level_ = 0; - clear_has_lod_level(); -} -::google::protobuf::int32 VarType_LoDTensorArrayDesc::lod_level() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) - return lod_level_; -} -void VarType_LoDTensorArrayDesc::set_lod_level( - ::google::protobuf::int32 value) { - set_has_lod_level(); - lod_level_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) -} + // VarType_LoDTensorArrayDesc + + // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor + // = 1; + bool VarType_LoDTensorArrayDesc::has_tensor() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void VarType_LoDTensorArrayDesc::set_has_tensor() { + _has_bits_[0] |= 0x00000001u; + } + void VarType_LoDTensorArrayDesc::clear_has_tensor() { + _has_bits_[0] &= ~0x00000001u; + } + void VarType_LoDTensorArrayDesc::clear_tensor() { + if (tensor_ != NULL) + tensor_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + clear_has_tensor(); + } + const ::paddle_mobile::framework::proto::VarType_TensorDesc & + VarType_LoDTensorArrayDesc::tensor() const { + const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = + tensor_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_TensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_TensorDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorArrayDesc::mutable_tensor() { + set_has_tensor(); + if (tensor_ == NULL) { + tensor_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + return tensor_; + } + ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorArrayDesc::release_tensor() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + clear_has_tensor(); + ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = + tensor_; + tensor_ = NULL; + return temp; + } + void VarType_LoDTensorArrayDesc::set_allocated_tensor( + ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { + delete tensor_; + tensor_ = tensor; + if (tensor) { + set_has_tensor(); + } else { + clear_has_tensor(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + } + + // optional int32 lod_level = 2 [default = 0]; + bool VarType_LoDTensorArrayDesc::has_lod_level() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void VarType_LoDTensorArrayDesc::set_has_lod_level() { + _has_bits_[0] |= 0x00000002u; + } + void VarType_LoDTensorArrayDesc::clear_has_lod_level() { + _has_bits_[0] &= ~0x00000002u; + } + void VarType_LoDTensorArrayDesc::clear_lod_level() { + lod_level_ = 0; + clear_has_lod_level(); + } + ::google::protobuf::int32 + VarType_LoDTensorArrayDesc::lod_level() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) + return lod_level_; + } + void VarType_LoDTensorArrayDesc::set_lod_level( + ::google::protobuf::int32 value) { + set_has_lod_level(); + lod_level_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType_ReaderDesc::kLodTensorFieldNumber; + const int VarType_ReaderDesc::kLodTensorFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType_ReaderDesc::VarType_ReaderDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.ReaderDesc) -} -VarType_ReaderDesc::VarType_ReaderDesc(const VarType_ReaderDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), - lod_tensor_(from.lod_tensor_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.ReaderDesc) -} - -void VarType_ReaderDesc::SharedCtor() { _cached_size_ = 0; } - -VarType_ReaderDesc::~VarType_ReaderDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.ReaderDesc) - SharedDtor(); -} - -void VarType_ReaderDesc::SharedDtor() {} - -void VarType_ReaderDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType_ReaderDesc &VarType_ReaderDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType_ReaderDesc * -VarType_ReaderDesc::New(::google::protobuf::Arena *arena) const { - VarType_ReaderDesc *n = new VarType_ReaderDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType_ReaderDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.ReaderDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - lod_tensor_.Clear(); - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType_ReaderDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarType_ReaderDesc::VarType_ReaderDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.ReaderDesc) + } + VarType_ReaderDesc::VarType_ReaderDesc( + const VarType_ReaderDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + lod_tensor_(from.lod_tensor_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.ReaderDesc) + } + + void VarType_ReaderDesc::SharedCtor() { _cached_size_ = 0; } + + VarType_ReaderDesc::~VarType_ReaderDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.ReaderDesc) + SharedDtor(); + } + + void VarType_ReaderDesc::SharedDtor() {} + + void VarType_ReaderDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType_ReaderDesc &VarType_ReaderDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType_ReaderDesc * + VarType_ReaderDesc::New(::google::protobuf::Arena *arena) const { + VarType_ReaderDesc *n = new VarType_ReaderDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType_ReaderDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.ReaderDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + lod_tensor_.Clear(); + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType_ReaderDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.ReaderDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc - // lod_tensor = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_lod_tensor())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.ReaderDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.ReaderDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.ReaderDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // repeated + // .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + add_lod_tensor())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.ReaderDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.ReaderDesc) + return false; #undef DO_ -} - -void VarType_ReaderDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.ReaderDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = - // 1; - for (unsigned int i = 0, - n = static_cast(this->lod_tensor_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, this->lod_tensor(static_cast(i)), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.ReaderDesc) -} - -size_t VarType_ReaderDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.ReaderDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = - // 1; - { - unsigned int count = static_cast(this->lod_tensor_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->lod_tensor(static_cast(i))); - } - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType_ReaderDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void VarType_ReaderDesc::MergeFrom(const VarType_ReaderDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.ReaderDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - lod_tensor_.MergeFrom(from.lod_tensor_); -} - -void VarType_ReaderDesc::CopyFrom(const VarType_ReaderDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.ReaderDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType_ReaderDesc::IsInitialized() const { - if (!::google::protobuf::internal::AllAreInitialized(this->lod_tensor())) - return false; - return true; -} - -void VarType_ReaderDesc::Swap(VarType_ReaderDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType_ReaderDesc::InternalSwap(VarType_ReaderDesc *other) { - using std::swap; - lod_tensor_.InternalSwap(&other->lod_tensor_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType_ReaderDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType.ReaderDesc"; -} + } + + void VarType_ReaderDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.ReaderDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = + // 1; + for (unsigned int i = 0, n = static_cast( + this->lod_tensor_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->lod_tensor(static_cast(i)), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.ReaderDesc) + } + + size_t VarType_ReaderDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.ReaderDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = + // 1; + { + unsigned int count = + static_cast(this->lod_tensor_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->lod_tensor(static_cast(i))); + } + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType_ReaderDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast( + &from)); + } + + void VarType_ReaderDesc::MergeFrom(const VarType_ReaderDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.ReaderDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + lod_tensor_.MergeFrom(from.lod_tensor_); + } + + void VarType_ReaderDesc::CopyFrom(const VarType_ReaderDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.ReaderDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType_ReaderDesc::IsInitialized() const { + if (!::google::protobuf::internal::AllAreInitialized( + this->lod_tensor())) + return false; + return true; + } + + void VarType_ReaderDesc::Swap(VarType_ReaderDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarType_ReaderDesc::InternalSwap(VarType_ReaderDesc *other) { + using std::swap; + lod_tensor_.InternalSwap(&other->lod_tensor_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType_ReaderDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType.ReaderDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType_ReaderDesc - -// repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = 1; -int VarType_ReaderDesc::lod_tensor_size() const { return lod_tensor_.size(); } -void VarType_ReaderDesc::clear_lod_tensor() { lod_tensor_.Clear(); } -const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & -VarType_ReaderDesc::lod_tensor(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_.Get(index); -} -::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType_ReaderDesc::mutable_lod_tensor(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_.Mutable(index); -} -::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType_ReaderDesc::add_lod_tensor() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> * -VarType_ReaderDesc::mutable_lod_tensor() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return &lod_tensor_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> & -VarType_ReaderDesc::lod_tensor() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_; -} + // VarType_ReaderDesc + + // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = 1; + int VarType_ReaderDesc::lod_tensor_size() const { + return lod_tensor_.size(); + } + void VarType_ReaderDesc::clear_lod_tensor() { lod_tensor_.Clear(); } + const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & + VarType_ReaderDesc::lod_tensor(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_.Get(index); + } + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType_ReaderDesc::mutable_lod_tensor(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_.Mutable(index); + } + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType_ReaderDesc::add_lod_tensor() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> * + VarType_ReaderDesc::mutable_lod_tensor() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return &lod_tensor_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> & + VarType_ReaderDesc::lod_tensor() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_; + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType_ChannelDesc::kDataTypeFieldNumber; -const int VarType_ChannelDesc::kCapacityFieldNumber; + const int VarType_ChannelDesc::kDataTypeFieldNumber; + const int VarType_ChannelDesc::kCapacityFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType_ChannelDesc::VarType_ChannelDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.ChannelDesc) -} -VarType_ChannelDesc::VarType_ChannelDesc(const VarType_ChannelDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::memcpy(&capacity_, &from.capacity_, - static_cast(reinterpret_cast(&data_type_) - - reinterpret_cast(&capacity_)) + - sizeof(data_type_)); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.ChannelDesc) -} - -void VarType_ChannelDesc::SharedCtor() { - _cached_size_ = 0; - ::memset(&capacity_, 0, - static_cast(reinterpret_cast(&data_type_) - - reinterpret_cast(&capacity_)) + - sizeof(data_type_)); -} - -VarType_ChannelDesc::~VarType_ChannelDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.ChannelDesc) - SharedDtor(); -} - -void VarType_ChannelDesc::SharedDtor() {} - -void VarType_ChannelDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType_ChannelDesc &VarType_ChannelDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType_ChannelDesc * -VarType_ChannelDesc::New(::google::protobuf::Arena *arena) const { - VarType_ChannelDesc *n = new VarType_ChannelDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType_ChannelDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - ::memset(&capacity_, 0, - static_cast(reinterpret_cast(&data_type_) - + VarType_ChannelDesc::VarType_ChannelDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.ChannelDesc) + } + VarType_ChannelDesc::VarType_ChannelDesc( + const VarType_ChannelDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy( + &capacity_, &from.capacity_, + static_cast(reinterpret_cast(&data_type_) - + reinterpret_cast(&capacity_)) + + sizeof(data_type_)); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.ChannelDesc) + } + + void VarType_ChannelDesc::SharedCtor() { + _cached_size_ = 0; + ::memset( + &capacity_, 0, + static_cast(reinterpret_cast(&data_type_) - + reinterpret_cast(&capacity_)) + + sizeof(data_type_)); + } + + VarType_ChannelDesc::~VarType_ChannelDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.ChannelDesc) + SharedDtor(); + } + + void VarType_ChannelDesc::SharedDtor() {} + + void VarType_ChannelDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType_ChannelDesc &VarType_ChannelDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType_ChannelDesc * + VarType_ChannelDesc::New(::google::protobuf::Arena *arena) const { + VarType_ChannelDesc *n = new VarType_ChannelDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType_ChannelDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + ::memset(&capacity_, 0, + static_cast( + reinterpret_cast(&data_type_) - reinterpret_cast(&capacity_)) + - sizeof(data_type_)); - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType_ChannelDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + sizeof(data_type_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType_ChannelDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::paddle_mobile::framework::proto::VarType_Type_IsValid(value)) { - set_data_type( - static_cast<::paddle_mobile::framework::proto::VarType_Type>( - value)); - } else { - unknown_fields_stream.WriteVarint32(8u); - unknown_fields_stream.WriteVarint32( - static_cast<::google::protobuf::uint32>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // required int64 capacity = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - set_has_capacity(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int64, - ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( - input, &capacity_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.ChannelDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.ChannelDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 8u /* 8 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + int, ::google::protobuf::internal:: + WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::paddle_mobile::framework::proto:: + VarType_Type_IsValid(value)) { + set_data_type( + static_cast<::paddle_mobile::framework:: + proto::VarType_Type>( + value)); + } else { + unknown_fields_stream.WriteVarint32(8u); + unknown_fields_stream.WriteVarint32( + static_cast<::google::protobuf::uint32>( + value)); + } + } else { + goto handle_unusual; + } + break; + } + + // required int64 capacity = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + set_has_capacity(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int64, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT64>( + input, &capacity_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.ChannelDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.ChannelDesc) + return false; #undef DO_ -} - -void VarType_ChannelDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 1, this->data_type(), output); - } - - // required int64 capacity = 2; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteInt64( - 2, this->capacity(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.ChannelDesc) -} - -size_t VarType_ChannelDesc::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - size_t total_size = 0; - - if (has_capacity()) { - // required int64 capacity = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int64Size( - this->capacity()); - } - - if (has_data_type()) { - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->data_type()); - } - - return total_size; -} -size_t VarType_ChannelDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == - 0) { // All required fields are present. - // required int64 capacity = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int64Size( - this->capacity()); - - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->data_type()); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType_ChannelDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void VarType_ChannelDesc::MergeFrom(const VarType_ChannelDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - capacity_ = from.capacity_; - } - if (cached_has_bits & 0x00000002u) { - data_type_ = from.data_type_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void VarType_ChannelDesc::CopyFrom(const VarType_ChannelDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.ChannelDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType_ChannelDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) - return false; - return true; -} - -void VarType_ChannelDesc::Swap(VarType_ChannelDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType_ChannelDesc::InternalSwap(VarType_ChannelDesc *other) { - using std::swap; - swap(capacity_, other->capacity_); - swap(data_type_, other->data_type_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType_ChannelDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType.ChannelDesc"; -} + } + + void VarType_ChannelDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->data_type(), output); + } + + // required int64 capacity = 2; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteInt64( + 2, this->capacity(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.ChannelDesc) + } + + size_t VarType_ChannelDesc::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + size_t total_size = 0; + + if (has_capacity()) { + // required int64 capacity = 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->capacity()); + } + + if (has_data_type()) { + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->data_type()); + } + + return total_size; + } + size_t VarType_ChannelDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == + 0) { // All required fields are present. + // required int64 capacity = 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->capacity()); + + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->data_type()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType_ChannelDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast( + &from)); + } + + void + VarType_ChannelDesc::MergeFrom(const VarType_ChannelDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + capacity_ = from.capacity_; + } + if (cached_has_bits & 0x00000002u) { + data_type_ = from.data_type_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void + VarType_ChannelDesc::CopyFrom(const VarType_ChannelDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.ChannelDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType_ChannelDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) + return false; + return true; + } + + void VarType_ChannelDesc::Swap(VarType_ChannelDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarType_ChannelDesc::InternalSwap(VarType_ChannelDesc *other) { + using std::swap; + swap(capacity_, other->capacity_); + swap(data_type_, other->data_type_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType_ChannelDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType.ChannelDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType_ChannelDesc - -// required .paddle_mobile.framework.proto.VarType.Type data_type = 1; -bool VarType_ChannelDesc::has_data_type() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void VarType_ChannelDesc::set_has_data_type() { _has_bits_[0] |= 0x00000002u; } -void VarType_ChannelDesc::clear_has_data_type() { - _has_bits_[0] &= ~0x00000002u; -} -void VarType_ChannelDesc::clear_data_type() { - data_type_ = 0; - clear_has_data_type(); -} -::paddle_mobile::framework::proto::VarType_Type -VarType_ChannelDesc::data_type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>( - data_type_); -} -void VarType_ChannelDesc::set_data_type( - ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - set_has_data_type(); - data_type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) -} - -// required int64 capacity = 2; -bool VarType_ChannelDesc::has_capacity() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void VarType_ChannelDesc::set_has_capacity() { _has_bits_[0] |= 0x00000001u; } -void VarType_ChannelDesc::clear_has_capacity() { - _has_bits_[0] &= ~0x00000001u; -} -void VarType_ChannelDesc::clear_capacity() { - capacity_ = GOOGLE_LONGLONG(0); - clear_has_capacity(); -} -::google::protobuf::int64 VarType_ChannelDesc::capacity() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) - return capacity_; -} -void VarType_ChannelDesc::set_capacity(::google::protobuf::int64 value) { - set_has_capacity(); - capacity_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) -} + // VarType_ChannelDesc + + // required .paddle_mobile.framework.proto.VarType.Type data_type = + // 1; + bool VarType_ChannelDesc::has_data_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void VarType_ChannelDesc::set_has_data_type() { + _has_bits_[0] |= 0x00000002u; + } + void VarType_ChannelDesc::clear_has_data_type() { + _has_bits_[0] &= ~0x00000002u; + } + void VarType_ChannelDesc::clear_data_type() { + data_type_ = 0; + clear_has_data_type(); + } + ::paddle_mobile::framework::proto::VarType_Type + VarType_ChannelDesc::data_type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>( + data_type_); + } + void VarType_ChannelDesc::set_data_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + set_has_data_type(); + data_type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) + } + + // required int64 capacity = 2; + bool VarType_ChannelDesc::has_capacity() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void VarType_ChannelDesc::set_has_capacity() { + _has_bits_[0] |= 0x00000001u; + } + void VarType_ChannelDesc::clear_has_capacity() { + _has_bits_[0] &= ~0x00000001u; + } + void VarType_ChannelDesc::clear_capacity() { + capacity_ = GOOGLE_LONGLONG(0); + clear_has_capacity(); + } + ::google::protobuf::int64 VarType_ChannelDesc::capacity() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) + return capacity_; + } + void + VarType_ChannelDesc::set_capacity(::google::protobuf::int64 value) { + set_has_capacity(); + capacity_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType_Tuple::kElementTypeFieldNumber; + const int VarType_Tuple::kElementTypeFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType_Tuple::VarType_Tuple() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.Tuple) -} -VarType_Tuple::VarType_Tuple(const VarType_Tuple &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), - element_type_(from.element_type_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.Tuple) -} - -void VarType_Tuple::SharedCtor() { _cached_size_ = 0; } - -VarType_Tuple::~VarType_Tuple() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.Tuple) - SharedDtor(); -} - -void VarType_Tuple::SharedDtor() {} - -void VarType_Tuple::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType_Tuple &VarType_Tuple::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType_Tuple *VarType_Tuple::New(::google::protobuf::Arena *arena) const { - VarType_Tuple *n = new VarType_Tuple; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType_Tuple::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.Tuple) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - element_type_.Clear(); - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType_Tuple::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarType_Tuple::VarType_Tuple() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType.Tuple) + } + VarType_Tuple::VarType_Tuple(const VarType_Tuple &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + element_type_(from.element_type_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType.Tuple) + } + + void VarType_Tuple::SharedCtor() { _cached_size_ = 0; } + + VarType_Tuple::~VarType_Tuple() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType.Tuple) + SharedDtor(); + } + + void VarType_Tuple::SharedDtor() {} + + void VarType_Tuple::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType_Tuple &VarType_Tuple::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType_Tuple * + VarType_Tuple::New(::google::protobuf::Arena *arena) const { + VarType_Tuple *n = new VarType_Tuple; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType_Tuple::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType.Tuple) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + element_type_.Clear(); + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType_Tuple::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.Tuple) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .paddle_mobile.framework.proto.VarType.Type element_type = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::paddle_mobile::framework::proto::VarType_Type_IsValid(value)) { - add_element_type( - static_cast<::paddle_mobile::framework::proto::VarType_Type>( - value)); - } else { - unknown_fields_stream.WriteVarint32(tag); - unknown_fields_stream.WriteVarint32( - static_cast<::google::protobuf::uint32>(value)); - } - } else if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_((::google::protobuf::internal::WireFormatLite:: - ReadPackedEnumPreserveUnknowns( - input, 1, - ::paddle_mobile::framework::proto::VarType_Type_IsValid, - &unknown_fields_stream, this->mutable_element_type()))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.Tuple) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.Tuple) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType.Tuple) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // repeated .paddle_mobile.framework.proto.VarType.Type + // element_type = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 8u /* 8 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + int, ::google::protobuf::internal:: + WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::paddle_mobile::framework::proto:: + VarType_Type_IsValid(value)) { + add_element_type( + static_cast<::paddle_mobile::framework:: + proto::VarType_Type>( + value)); + } else { + unknown_fields_stream.WriteVarint32(tag); + unknown_fields_stream.WriteVarint32( + static_cast<::google::protobuf::uint32>( + value)); + } + } else if (static_cast<::google::protobuf::uint8>( + tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPackedEnumPreserveUnknowns( + input, 1, + ::paddle_mobile::framework::proto:: + VarType_Type_IsValid, + &unknown_fields_stream, + this->mutable_element_type()))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType.Tuple) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType.Tuple) + return false; #undef DO_ -} - -void VarType_Tuple::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.Tuple) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - // repeated .paddle_mobile.framework.proto.VarType.Type element_type = 1; - for (int i = 0, n = this->element_type_size(); i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteEnum( - 1, this->element_type(i), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.Tuple) -} - -size_t VarType_Tuple::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.Tuple) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // repeated .paddle_mobile.framework.proto.VarType.Type element_type = 1; - { - size_t data_size = 0; - unsigned int count = static_cast(this->element_type_size()); - for (unsigned int i = 0; i < count; i++) { - data_size += ::google::protobuf::internal::WireFormatLite::EnumSize( - this->element_type(static_cast(i))); - } - total_size += (1UL * count) + data_size; - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType_Tuple::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void VarType_Tuple::MergeFrom(const VarType_Tuple &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.Tuple) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - element_type_.MergeFrom(from.element_type_); -} - -void VarType_Tuple::CopyFrom(const VarType_Tuple &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.Tuple) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType_Tuple::IsInitialized() const { return true; } - -void VarType_Tuple::Swap(VarType_Tuple *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType_Tuple::InternalSwap(VarType_Tuple *other) { - using std::swap; - element_type_.InternalSwap(&other->element_type_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType_Tuple::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType.Tuple"; -} + } + + void VarType_Tuple::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType.Tuple) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + // repeated .paddle_mobile.framework.proto.VarType.Type + // element_type = 1; + for (int i = 0, n = this->element_type_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->element_type(i), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType.Tuple) + } + + size_t VarType_Tuple::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType.Tuple) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // repeated .paddle_mobile.framework.proto.VarType.Type + // element_type = 1; + { + size_t data_size = 0; + unsigned int count = + static_cast(this->element_type_size()); + for (unsigned int i = 0; i < count; i++) { + data_size += ::google::protobuf::internal:: + WireFormatLite::EnumSize( + this->element_type(static_cast(i))); + } + total_size += (1UL * count) + data_size; + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType_Tuple::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom(*::google::protobuf::down_cast( + &from)); + } + + void VarType_Tuple::MergeFrom(const VarType_Tuple &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType.Tuple) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + element_type_.MergeFrom(from.element_type_); + } + + void VarType_Tuple::CopyFrom(const VarType_Tuple &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType.Tuple) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType_Tuple::IsInitialized() const { return true; } + + void VarType_Tuple::Swap(VarType_Tuple *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarType_Tuple::InternalSwap(VarType_Tuple *other) { + using std::swap; + element_type_.InternalSwap(&other->element_type_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType_Tuple::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType.Tuple"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType_Tuple - -// repeated .paddle_mobile.framework.proto.VarType.Type element_type = 1; -int VarType_Tuple::element_type_size() const { return element_type_.size(); } -void VarType_Tuple::clear_element_type() { element_type_.Clear(); } -::paddle_mobile::framework::proto::VarType_Type -VarType_Tuple::element_type(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.Tuple.element_type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>( - element_type_.Get(index)); -} -void VarType_Tuple::set_element_type( - int index, ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - element_type_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.Tuple.element_type) -} -void VarType_Tuple::add_element_type( - ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - element_type_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.Tuple.element_type) -} -const ::google::protobuf::RepeatedField & -VarType_Tuple::element_type() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) - return element_type_; -} -::google::protobuf::RepeatedField *VarType_Tuple::mutable_element_type() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) - return &element_type_; -} + // VarType_Tuple + + // repeated .paddle_mobile.framework.proto.VarType.Type element_type + // = 1; + int VarType_Tuple::element_type_size() const { + return element_type_.size(); + } + void VarType_Tuple::clear_element_type() { element_type_.Clear(); } + ::paddle_mobile::framework::proto::VarType_Type + VarType_Tuple::element_type(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.Tuple.element_type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>( + element_type_.Get(index)); + } + void VarType_Tuple::set_element_type( + int index, + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + element_type_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.Tuple.element_type) + } + void VarType_Tuple::add_element_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + element_type_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.Tuple.element_type) + } + const ::google::protobuf::RepeatedField & + VarType_Tuple::element_type() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) + return element_type_; + } + ::google::protobuf::RepeatedField * + VarType_Tuple::mutable_element_type() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) + return &element_type_; + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarType::kTypeFieldNumber; -const int VarType::kSelectedRowsFieldNumber; -const int VarType::kLodTensorFieldNumber; -const int VarType::kTensorArrayFieldNumber; -const int VarType::kReaderFieldNumber; -const int VarType::kChannelFieldNumber; -const int VarType::kTupleFieldNumber; + const int VarType::kTypeFieldNumber; + const int VarType::kSelectedRowsFieldNumber; + const int VarType::kLodTensorFieldNumber; + const int VarType::kTensorArrayFieldNumber; + const int VarType::kReaderFieldNumber; + const int VarType::kChannelFieldNumber; + const int VarType::kTupleFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarType::VarType() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType) -} -VarType::VarType(const VarType &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - if (from.has_selected_rows()) { - selected_rows_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc( - *from.selected_rows_); - } else { - selected_rows_ = NULL; - } - if (from.has_lod_tensor()) { - lod_tensor_ = new ::paddle_mobile::framework::proto::VarType_LoDTensorDesc( - *from.lod_tensor_); - } else { - lod_tensor_ = NULL; - } - if (from.has_tensor_array()) { - tensor_array_ = - new ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc( - *from.tensor_array_); - } else { - tensor_array_ = NULL; - } - if (from.has_reader()) { - reader_ = new ::paddle_mobile::framework::proto::VarType_ReaderDesc( - *from.reader_); - } else { - reader_ = NULL; - } - if (from.has_channel()) { - channel_ = new ::paddle_mobile::framework::proto::VarType_ChannelDesc( - *from.channel_); - } else { - channel_ = NULL; - } - if (from.has_tuple()) { - tuple_ = new ::paddle_mobile::framework::proto::VarType_Tuple(*from.tuple_); - } else { - tuple_ = NULL; - } - type_ = from.type_; - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType) -} - -void VarType::SharedCtor() { - _cached_size_ = 0; - ::memset(&selected_rows_, 0, - static_cast(reinterpret_cast(&type_) - - reinterpret_cast(&selected_rows_)) + - sizeof(type_)); -} - -VarType::~VarType() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType) - SharedDtor(); -} - -void VarType::SharedDtor() { - if (this != internal_default_instance()) - delete selected_rows_; - if (this != internal_default_instance()) - delete lod_tensor_; - if (this != internal_default_instance()) - delete tensor_array_; - if (this != internal_default_instance()) - delete reader_; - if (this != internal_default_instance()) - delete channel_; - if (this != internal_default_instance()) - delete tuple_; -} - -void VarType::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarType &VarType::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarType *VarType::New(::google::protobuf::Arena *arena) const { - VarType *n = new VarType; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarType::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 63u) { - if (cached_has_bits & 0x00000001u) { - GOOGLE_DCHECK(selected_rows_ != NULL); - selected_rows_ - ->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(lod_tensor_ != NULL); - lod_tensor_ - ->::paddle_mobile::framework::proto::VarType_LoDTensorDesc::Clear(); - } - if (cached_has_bits & 0x00000004u) { - GOOGLE_DCHECK(tensor_array_ != NULL); - tensor_array_->::paddle_mobile::framework::proto:: - VarType_LoDTensorArrayDesc::Clear(); - } - if (cached_has_bits & 0x00000008u) { - GOOGLE_DCHECK(reader_ != NULL); - reader_->::paddle_mobile::framework::proto::VarType_ReaderDesc::Clear(); - } - if (cached_has_bits & 0x00000010u) { - GOOGLE_DCHECK(channel_ != NULL); - channel_->::paddle_mobile::framework::proto::VarType_ChannelDesc::Clear(); - } - if (cached_has_bits & 0x00000020u) { - GOOGLE_DCHECK(tuple_ != NULL); - tuple_->::paddle_mobile::framework::proto::VarType_Tuple::Clear(); - } - } - type_ = 0; - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarType::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarType::VarType() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarType) + } + VarType::VarType(const VarType &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from.has_selected_rows()) { + selected_rows_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc(*from.selected_rows_); + } else { + selected_rows_ = NULL; + } + if (from.has_lod_tensor()) { + lod_tensor_ = new ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc(*from.lod_tensor_); + } else { + lod_tensor_ = NULL; + } + if (from.has_tensor_array()) { + tensor_array_ = new ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc(*from.tensor_array_); + } else { + tensor_array_ = NULL; + } + if (from.has_reader()) { + reader_ = new ::paddle_mobile::framework::proto:: + VarType_ReaderDesc(*from.reader_); + } else { + reader_ = NULL; + } + if (from.has_channel()) { + channel_ = new ::paddle_mobile::framework::proto:: + VarType_ChannelDesc(*from.channel_); + } else { + channel_ = NULL; + } + if (from.has_tuple()) { + tuple_ = + new ::paddle_mobile::framework::proto::VarType_Tuple( + *from.tuple_); + } else { + tuple_ = NULL; + } + type_ = from.type_; + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarType) + } + + void VarType::SharedCtor() { + _cached_size_ = 0; + ::memset(&selected_rows_, 0, + static_cast( + reinterpret_cast(&type_) - + reinterpret_cast(&selected_rows_)) + + sizeof(type_)); + } + + VarType::~VarType() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarType) + SharedDtor(); + } + + void VarType::SharedDtor() { + if (this != internal_default_instance()) + delete selected_rows_; + if (this != internal_default_instance()) + delete lod_tensor_; + if (this != internal_default_instance()) + delete tensor_array_; + if (this != internal_default_instance()) + delete reader_; + if (this != internal_default_instance()) + delete channel_; + if (this != internal_default_instance()) + delete tuple_; + } + + void VarType::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarType &VarType::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarType *VarType::New(::google::protobuf::Arena *arena) const { + VarType *n = new VarType; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarType::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarType) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 63u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(selected_rows_ != NULL); + selected_rows_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(lod_tensor_ != NULL); + lod_tensor_->::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc::Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(tensor_array_ != NULL); + tensor_array_->::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc::Clear(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(reader_ != NULL); + reader_->::paddle_mobile::framework::proto:: + VarType_ReaderDesc::Clear(); + } + if (cached_has_bits & 0x00000010u) { + GOOGLE_DCHECK(channel_ != NULL); + channel_->::paddle_mobile::framework::proto:: + VarType_ChannelDesc::Clear(); + } + if (cached_has_bits & 0x00000020u) { + GOOGLE_DCHECK(tuple_ != NULL); + tuple_->::paddle_mobile::framework::proto:: + VarType_Tuple::Clear(); + } + } + type_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarType::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required .paddle_mobile.framework.proto.VarType.Type type = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - int value; - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( - input, &value))); - if (::paddle_mobile::framework::proto::VarType_Type_IsValid(value)) { - set_type(static_cast<::paddle_mobile::framework::proto::VarType_Type>( - value)); - } else { - unknown_fields_stream.WriteVarint32(8u); - unknown_fields_stream.WriteVarint32( - static_cast<::google::protobuf::uint32>(value)); - } - } else { - goto handle_unusual; - } - break; - } - - // optional .paddle_mobile.framework.proto.VarType.TensorDesc - // selected_rows = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_selected_rows())); - } else { - goto handle_unusual; - } - break; - } - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc - // lod_tensor = 3; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_lod_tensor())); - } else { - goto handle_unusual; - } - break; - } - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc - // tensor_array = 4; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_tensor_array())); - } else { - goto handle_unusual; - } - break; - } - - // optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader = 5; - case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_reader())); - } else { - goto handle_unusual; - } - break; - } - - // optional .paddle_mobile.framework.proto.VarType.ChannelDesc channel = - // 6; - case 6: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(50u /* 50 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_channel())); - } else { - goto handle_unusual; - } - break; - } - - // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; - case 7: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(58u /* 58 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_tuple())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarType) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required .paddle_mobile.framework.proto.VarType.Type type + // = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 8u /* 8 & 0xFF */)) { + int value; + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + int, ::google::protobuf::internal:: + WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::paddle_mobile::framework::proto:: + VarType_Type_IsValid(value)) { + set_type( + static_cast<::paddle_mobile::framework:: + proto::VarType_Type>( + value)); + } else { + unknown_fields_stream.WriteVarint32(8u); + unknown_fields_stream.WriteVarint32( + static_cast<::google::protobuf::uint32>( + value)); + } + } else { + goto handle_unusual; + } + break; + } + + // optional + // .paddle_mobile.framework.proto.VarType.TensorDesc + // selected_rows = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual( + input, mutable_selected_rows())); + } else { + goto handle_unusual; + } + break; + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_lod_tensor())); + } else { + goto handle_unusual; + } + break; + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc + // tensor_array = 4; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 34u /* 34 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual( + input, mutable_tensor_array())); + } else { + goto handle_unusual; + } + break; + } + + // optional + // .paddle_mobile.framework.proto.VarType.ReaderDesc reader + // = 5; + case 5: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 42u /* 42 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_reader())); + } else { + goto handle_unusual; + } + break; + } + + // optional + // .paddle_mobile.framework.proto.VarType.ChannelDesc + // channel = + // 6; + case 6: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 50u /* 50 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_channel())); + } else { + goto handle_unusual; + } + break; + } + + // optional .paddle_mobile.framework.proto.VarType.Tuple + // tuple = 7; + case 7: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 58u /* 58 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_tuple())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarType) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarType) + return false; #undef DO_ -} - -void VarType::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required .paddle_mobile.framework.proto.VarType.Type type = 1; - if (cached_has_bits & 0x00000040u) { - ::google::protobuf::internal::WireFormatLite::WriteEnum(1, this->type(), - output); - } - - // optional .paddle_mobile.framework.proto.VarType.TensorDesc selected_rows = - // 2; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 2, *this->selected_rows_, output); - } - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = - // 3; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 3, *this->lod_tensor_, output); - } - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc - // tensor_array = 4; - if (cached_has_bits & 0x00000004u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 4, *this->tensor_array_, output); - } - - // optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader = 5; - if (cached_has_bits & 0x00000008u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 5, *this->reader_, output); - } - - // optional .paddle_mobile.framework.proto.VarType.ChannelDesc channel = 6; - if (cached_has_bits & 0x00000010u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 6, *this->channel_, output); - } - - // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; - if (cached_has_bits & 0x00000020u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage(7, *this->tuple_, - output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType) -} - -size_t VarType::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // required .paddle_mobile.framework.proto.VarType.Type type = 1; - if (has_type()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize( - this->type()); - } - if (_has_bits_[0 / 32] & 63u) { - // optional .paddle_mobile.framework.proto.VarType.TensorDesc selected_rows - // = 2; - if (has_selected_rows()) { - total_size += - 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->selected_rows_); - } - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor - // = 3; - if (has_lod_tensor()) { - total_size += - 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->lod_tensor_); - } - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc - // tensor_array = 4; - if (has_tensor_array()) { - total_size += - 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->tensor_array_); - } - - // optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader = 5; - if (has_reader()) { - total_size += - 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->reader_); - } - - // optional .paddle_mobile.framework.proto.VarType.ChannelDesc channel = 6; - if (has_channel()) { - total_size += - 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->channel_); - } - - // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; - if (has_tuple()) { - total_size += - 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->tuple_); - } - } - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarType::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void VarType::MergeFrom(const VarType &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 127u) { - if (cached_has_bits & 0x00000001u) { - mutable_selected_rows() - ->::paddle_mobile::framework::proto::VarType_TensorDesc::MergeFrom( - from.selected_rows()); - } - if (cached_has_bits & 0x00000002u) { - mutable_lod_tensor() - ->::paddle_mobile::framework::proto::VarType_LoDTensorDesc::MergeFrom( - from.lod_tensor()); - } - if (cached_has_bits & 0x00000004u) { - mutable_tensor_array()->::paddle_mobile::framework::proto:: - VarType_LoDTensorArrayDesc::MergeFrom(from.tensor_array()); - } - if (cached_has_bits & 0x00000008u) { - mutable_reader() - ->::paddle_mobile::framework::proto::VarType_ReaderDesc::MergeFrom( - from.reader()); - } - if (cached_has_bits & 0x00000010u) { - mutable_channel() - ->::paddle_mobile::framework::proto::VarType_ChannelDesc::MergeFrom( - from.channel()); - } - if (cached_has_bits & 0x00000020u) { - mutable_tuple() - ->::paddle_mobile::framework::proto::VarType_Tuple::MergeFrom( - from.tuple()); - } - if (cached_has_bits & 0x00000040u) { - type_ = from.type_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void VarType::CopyFrom(const VarType &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarType::IsInitialized() const { - if ((_has_bits_[0] & 0x00000040) != 0x00000040) - return false; - if (has_selected_rows()) { - if (!this->selected_rows_->IsInitialized()) - return false; - } - if (has_lod_tensor()) { - if (!this->lod_tensor_->IsInitialized()) - return false; - } - if (has_tensor_array()) { - if (!this->tensor_array_->IsInitialized()) - return false; - } - if (has_reader()) { - if (!this->reader_->IsInitialized()) - return false; - } - if (has_channel()) { - if (!this->channel_->IsInitialized()) - return false; - } - return true; -} - -void VarType::Swap(VarType *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarType::InternalSwap(VarType *other) { - using std::swap; - swap(selected_rows_, other->selected_rows_); - swap(lod_tensor_, other->lod_tensor_); - swap(tensor_array_, other->tensor_array_); - swap(reader_, other->reader_); - swap(channel_, other->channel_); - swap(tuple_, other->tuple_); - swap(type_, other->type_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarType::GetTypeName() const { - return "paddle_mobile.framework.proto.VarType"; -} + } + + void VarType::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarType) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required .paddle_mobile.framework.proto.VarType.Type type = + // 1; + if (cached_has_bits & 0x00000040u) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->type(), output); + } + + // optional .paddle_mobile.framework.proto.VarType.TensorDesc + // selected_rows = + // 2; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, *this->selected_rows_, output); + } + + // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = + // 3; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 3, *this->lod_tensor_, output); + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc + // tensor_array = 4; + if (cached_has_bits & 0x00000004u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 4, *this->tensor_array_, output); + } + + // optional .paddle_mobile.framework.proto.VarType.ReaderDesc + // reader = 5; + if (cached_has_bits & 0x00000008u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, *this->reader_, output); + } + + // optional .paddle_mobile.framework.proto.VarType.ChannelDesc + // channel = 6; + if (cached_has_bits & 0x00000010u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 6, *this->channel_, output); + } + + // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = + // 7; + if (cached_has_bits & 0x00000020u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 7, *this->tuple_, output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarType) + } + + size_t VarType::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarType) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // required .paddle_mobile.framework.proto.VarType.Type type = + // 1; + if (has_type()) { + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize( + this->type()); + } + if (_has_bits_[0 / 32] & 63u) { + // optional + // .paddle_mobile.framework.proto.VarType.TensorDesc + // selected_rows + // = 2; + if (has_selected_rows()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->selected_rows_); + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor + // = 3; + if (has_lod_tensor()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->lod_tensor_); + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc + // tensor_array = 4; + if (has_tensor_array()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->tensor_array_); + } + + // optional + // .paddle_mobile.framework.proto.VarType.ReaderDesc reader + // = 5; + if (has_reader()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->reader_); + } + + // optional + // .paddle_mobile.framework.proto.VarType.ChannelDesc + // channel = 6; + if (has_channel()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->channel_); + } + + // optional .paddle_mobile.framework.proto.VarType.Tuple + // tuple = 7; + if (has_tuple()) { + total_size += + 1 + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->tuple_); + } + } + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarType::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void VarType::MergeFrom(const VarType &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarType) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 127u) { + if (cached_has_bits & 0x00000001u) { + mutable_selected_rows()->::paddle_mobile::framework:: + proto::VarType_TensorDesc::MergeFrom( + from.selected_rows()); + } + if (cached_has_bits & 0x00000002u) { + mutable_lod_tensor()->::paddle_mobile::framework:: + proto::VarType_LoDTensorDesc::MergeFrom( + from.lod_tensor()); + } + if (cached_has_bits & 0x00000004u) { + mutable_tensor_array()->::paddle_mobile::framework:: + proto::VarType_LoDTensorArrayDesc::MergeFrom( + from.tensor_array()); + } + if (cached_has_bits & 0x00000008u) { + mutable_reader()->::paddle_mobile::framework::proto:: + VarType_ReaderDesc::MergeFrom(from.reader()); + } + if (cached_has_bits & 0x00000010u) { + mutable_channel()->::paddle_mobile::framework::proto:: + VarType_ChannelDesc::MergeFrom(from.channel()); + } + if (cached_has_bits & 0x00000020u) { + mutable_tuple()->::paddle_mobile::framework::proto:: + VarType_Tuple::MergeFrom(from.tuple()); + } + if (cached_has_bits & 0x00000040u) { + type_ = from.type_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void VarType::CopyFrom(const VarType &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarType) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarType::IsInitialized() const { + if ((_has_bits_[0] & 0x00000040) != 0x00000040) + return false; + if (has_selected_rows()) { + if (!this->selected_rows_->IsInitialized()) + return false; + } + if (has_lod_tensor()) { + if (!this->lod_tensor_->IsInitialized()) + return false; + } + if (has_tensor_array()) { + if (!this->tensor_array_->IsInitialized()) + return false; + } + if (has_reader()) { + if (!this->reader_->IsInitialized()) + return false; + } + if (has_channel()) { + if (!this->channel_->IsInitialized()) + return false; + } + return true; + } + + void VarType::Swap(VarType *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarType::InternalSwap(VarType *other) { + using std::swap; + swap(selected_rows_, other->selected_rows_); + swap(lod_tensor_, other->lod_tensor_); + swap(tensor_array_, other->tensor_array_); + swap(reader_, other->reader_); + swap(channel_, other->channel_); + swap(tuple_, other->tuple_); + swap(type_, other->type_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarType::GetTypeName() const { + return "paddle_mobile.framework.proto.VarType"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarType - -// required .paddle_mobile.framework.proto.VarType.Type type = 1; -bool VarType::has_type() const { return (_has_bits_[0] & 0x00000040u) != 0; } -void VarType::set_has_type() { _has_bits_[0] |= 0x00000040u; } -void VarType::clear_has_type() { _has_bits_[0] &= ~0x00000040u; } -void VarType::clear_type() { - type_ = 0; - clear_has_type(); -} -::paddle_mobile::framework::proto::VarType_Type VarType::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>(type_); -} -void VarType::set_type(::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.type) -} - -// optional .paddle_mobile.framework.proto.VarType.TensorDesc selected_rows = 2; -bool VarType::has_selected_rows() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void VarType::set_has_selected_rows() { _has_bits_[0] |= 0x00000001u; } -void VarType::clear_has_selected_rows() { _has_bits_[0] &= ~0x00000001u; } -void VarType::clear_selected_rows() { - if (selected_rows_ != NULL) - selected_rows_ - ->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - clear_has_selected_rows(); -} -const ::paddle_mobile::framework::proto::VarType_TensorDesc & -VarType::selected_rows() const { - const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = - selected_rows_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.selected_rows) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_TensorDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_TensorDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType::mutable_selected_rows() { - set_has_selected_rows(); - if (selected_rows_ == NULL) { - selected_rows_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.selected_rows) - return selected_rows_; -} -::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType::release_selected_rows() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.selected_rows) - clear_has_selected_rows(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = selected_rows_; - selected_rows_ = NULL; - return temp; -} -void VarType::set_allocated_selected_rows( - ::paddle_mobile::framework::proto::VarType_TensorDesc *selected_rows) { - delete selected_rows_; - selected_rows_ = selected_rows; - if (selected_rows) { - set_has_selected_rows(); - } else { - clear_has_selected_rows(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.selected_rows) -} - -// optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = 3; -bool VarType::has_lod_tensor() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void VarType::set_has_lod_tensor() { _has_bits_[0] |= 0x00000002u; } -void VarType::clear_has_lod_tensor() { _has_bits_[0] &= ~0x00000002u; } -void VarType::clear_lod_tensor() { - if (lod_tensor_ != NULL) - lod_tensor_ - ->::paddle_mobile::framework::proto::VarType_LoDTensorDesc::Clear(); - clear_has_lod_tensor(); -} -const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & -VarType::lod_tensor() const { - const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *p = - lod_tensor_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.lod_tensor) - return p != NULL ? *p : *reinterpret_cast( - &::paddle_mobile::framework::proto:: - _VarType_LoDTensorDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType::mutable_lod_tensor() { - set_has_lod_tensor(); - if (lod_tensor_ == NULL) { - lod_tensor_ = new ::paddle_mobile::framework::proto::VarType_LoDTensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.lod_tensor) - return lod_tensor_; -} -::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType::release_lod_tensor() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.lod_tensor) - clear_has_lod_tensor(); - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *temp = lod_tensor_; - lod_tensor_ = NULL; - return temp; -} -void VarType::set_allocated_lod_tensor( - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *lod_tensor) { - delete lod_tensor_; - lod_tensor_ = lod_tensor; - if (lod_tensor) { - set_has_lod_tensor(); - } else { - clear_has_lod_tensor(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.lod_tensor) -} - -// optional .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc -// tensor_array = 4; -bool VarType::has_tensor_array() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void VarType::set_has_tensor_array() { _has_bits_[0] |= 0x00000004u; } -void VarType::clear_has_tensor_array() { _has_bits_[0] &= ~0x00000004u; } -void VarType::clear_tensor_array() { - if (tensor_array_ != NULL) - tensor_array_->::paddle_mobile::framework::proto:: - VarType_LoDTensorArrayDesc::Clear(); - clear_has_tensor_array(); -} -const ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc & -VarType::tensor_array() const { - const ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc *p = - tensor_array_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tensor_array) - return p != NULL ? *p - : *reinterpret_cast( - &::paddle_mobile::framework::proto:: - _VarType_LoDTensorArrayDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * -VarType::mutable_tensor_array() { - set_has_tensor_array(); - if (tensor_array_ == NULL) { - tensor_array_ = - new ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tensor_array) - return tensor_array_; -} -::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * -VarType::release_tensor_array() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tensor_array) - clear_has_tensor_array(); - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc *temp = - tensor_array_; - tensor_array_ = NULL; - return temp; -} -void VarType::set_allocated_tensor_array( - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc - *tensor_array) { - delete tensor_array_; - tensor_array_ = tensor_array; - if (tensor_array) { - set_has_tensor_array(); - } else { - clear_has_tensor_array(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tensor_array) -} - -// optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader = 5; -bool VarType::has_reader() const { return (_has_bits_[0] & 0x00000008u) != 0; } -void VarType::set_has_reader() { _has_bits_[0] |= 0x00000008u; } -void VarType::clear_has_reader() { _has_bits_[0] &= ~0x00000008u; } -void VarType::clear_reader() { - if (reader_ != NULL) - reader_->::paddle_mobile::framework::proto::VarType_ReaderDesc::Clear(); - clear_has_reader(); -} -const ::paddle_mobile::framework::proto::VarType_ReaderDesc & -VarType::reader() const { - const ::paddle_mobile::framework::proto::VarType_ReaderDesc *p = reader_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.reader) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_ReaderDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_ReaderDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_ReaderDesc * -VarType::mutable_reader() { - set_has_reader(); - if (reader_ == NULL) { - reader_ = new ::paddle_mobile::framework::proto::VarType_ReaderDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.reader) - return reader_; -} -::paddle_mobile::framework::proto::VarType_ReaderDesc * -VarType::release_reader() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.reader) - clear_has_reader(); - ::paddle_mobile::framework::proto::VarType_ReaderDesc *temp = reader_; - reader_ = NULL; - return temp; -} -void VarType::set_allocated_reader( - ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader) { - delete reader_; - reader_ = reader; - if (reader) { - set_has_reader(); - } else { - clear_has_reader(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.reader) -} - -// optional .paddle_mobile.framework.proto.VarType.ChannelDesc channel = 6; -bool VarType::has_channel() const { return (_has_bits_[0] & 0x00000010u) != 0; } -void VarType::set_has_channel() { _has_bits_[0] |= 0x00000010u; } -void VarType::clear_has_channel() { _has_bits_[0] &= ~0x00000010u; } -void VarType::clear_channel() { - if (channel_ != NULL) - channel_->::paddle_mobile::framework::proto::VarType_ChannelDesc::Clear(); - clear_has_channel(); -} -const ::paddle_mobile::framework::proto::VarType_ChannelDesc & -VarType::channel() const { - const ::paddle_mobile::framework::proto::VarType_ChannelDesc *p = channel_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.channel) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_ChannelDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_ChannelDesc_default_instance_); -} -::paddle_mobile::framework::proto::VarType_ChannelDesc * -VarType::mutable_channel() { - set_has_channel(); - if (channel_ == NULL) { - channel_ = new ::paddle_mobile::framework::proto::VarType_ChannelDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.channel) - return channel_; -} -::paddle_mobile::framework::proto::VarType_ChannelDesc * -VarType::release_channel() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.channel) - clear_has_channel(); - ::paddle_mobile::framework::proto::VarType_ChannelDesc *temp = channel_; - channel_ = NULL; - return temp; -} -void VarType::set_allocated_channel( - ::paddle_mobile::framework::proto::VarType_ChannelDesc *channel) { - delete channel_; - channel_ = channel; - if (channel) { - set_has_channel(); - } else { - clear_has_channel(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.channel) -} - -// optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; -bool VarType::has_tuple() const { return (_has_bits_[0] & 0x00000020u) != 0; } -void VarType::set_has_tuple() { _has_bits_[0] |= 0x00000020u; } -void VarType::clear_has_tuple() { _has_bits_[0] &= ~0x00000020u; } -void VarType::clear_tuple() { - if (tuple_ != NULL) - tuple_->::paddle_mobile::framework::proto::VarType_Tuple::Clear(); - clear_has_tuple(); -} -const ::paddle_mobile::framework::proto::VarType_Tuple &VarType::tuple() const { - const ::paddle_mobile::framework::proto::VarType_Tuple *p = tuple_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tuple) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_Tuple *>( - &::paddle_mobile::framework::proto:: - _VarType_Tuple_default_instance_); -} -::paddle_mobile::framework::proto::VarType_Tuple *VarType::mutable_tuple() { - set_has_tuple(); - if (tuple_ == NULL) { - tuple_ = new ::paddle_mobile::framework::proto::VarType_Tuple; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tuple) - return tuple_; -} -::paddle_mobile::framework::proto::VarType_Tuple *VarType::release_tuple() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tuple) - clear_has_tuple(); - ::paddle_mobile::framework::proto::VarType_Tuple *temp = tuple_; - tuple_ = NULL; - return temp; -} -void VarType::set_allocated_tuple( - ::paddle_mobile::framework::proto::VarType_Tuple *tuple) { - delete tuple_; - tuple_ = tuple; - if (tuple) { - set_has_tuple(); - } else { - clear_has_tuple(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tuple) -} + // VarType + + // required .paddle_mobile.framework.proto.VarType.Type type = 1; + bool VarType::has_type() const { + return (_has_bits_[0] & 0x00000040u) != 0; + } + void VarType::set_has_type() { _has_bits_[0] |= 0x00000040u; } + void VarType::clear_has_type() { _has_bits_[0] &= ~0x00000040u; } + void VarType::clear_type() { + type_ = 0; + clear_has_type(); + } + ::paddle_mobile::framework::proto::VarType_Type + VarType::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>(type_); + } + void VarType::set_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + set_has_type(); + type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.type) + } + + // optional .paddle_mobile.framework.proto.VarType.TensorDesc + // selected_rows = 2; + bool VarType::has_selected_rows() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void VarType::set_has_selected_rows() { + _has_bits_[0] |= 0x00000001u; + } + void VarType::clear_has_selected_rows() { + _has_bits_[0] &= ~0x00000001u; + } + void VarType::clear_selected_rows() { + if (selected_rows_ != NULL) + selected_rows_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + clear_has_selected_rows(); + } + const ::paddle_mobile::framework::proto::VarType_TensorDesc & + VarType::selected_rows() const { + const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = + selected_rows_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.selected_rows) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_TensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_TensorDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType::mutable_selected_rows() { + set_has_selected_rows(); + if (selected_rows_ == NULL) { + selected_rows_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.selected_rows) + return selected_rows_; + } + ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType::release_selected_rows() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.selected_rows) + clear_has_selected_rows(); + ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = + selected_rows_; + selected_rows_ = NULL; + return temp; + } + void VarType::set_allocated_selected_rows( + ::paddle_mobile::framework::proto::VarType_TensorDesc + *selected_rows) { + delete selected_rows_; + selected_rows_ = selected_rows; + if (selected_rows) { + set_has_selected_rows(); + } else { + clear_has_selected_rows(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.selected_rows) + } + + // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = 3; + bool VarType::has_lod_tensor() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void VarType::set_has_lod_tensor() { _has_bits_[0] |= 0x00000002u; } + void VarType::clear_has_lod_tensor() { + _has_bits_[0] &= ~0x00000002u; + } + void VarType::clear_lod_tensor() { + if (lod_tensor_ != NULL) + lod_tensor_->::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc::Clear(); + clear_has_lod_tensor(); + } + const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & + VarType::lod_tensor() const { + const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *p = lod_tensor_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.lod_tensor) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_LoDTensorDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType::mutable_lod_tensor() { + set_has_lod_tensor(); + if (lod_tensor_ == NULL) { + lod_tensor_ = new ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.lod_tensor) + return lod_tensor_; + } + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType::release_lod_tensor() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.lod_tensor) + clear_has_lod_tensor(); + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *temp = + lod_tensor_; + lod_tensor_ = NULL; + return temp; + } + void VarType::set_allocated_lod_tensor( + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *lod_tensor) { + delete lod_tensor_; + lod_tensor_ = lod_tensor; + if (lod_tensor) { + set_has_lod_tensor(); + } else { + clear_has_lod_tensor(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.lod_tensor) + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc + // tensor_array = 4; + bool VarType::has_tensor_array() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + void VarType::set_has_tensor_array() { + _has_bits_[0] |= 0x00000004u; + } + void VarType::clear_has_tensor_array() { + _has_bits_[0] &= ~0x00000004u; + } + void VarType::clear_tensor_array() { + if (tensor_array_ != NULL) + tensor_array_->::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc::Clear(); + clear_has_tensor_array(); + } + const ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + & + VarType::tensor_array() const { + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc *p = tensor_array_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tensor_array) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_LoDTensorArrayDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * + VarType::mutable_tensor_array() { + set_has_tensor_array(); + if (tensor_array_ == NULL) { + tensor_array_ = new ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tensor_array) + return tensor_array_; + } + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * + VarType::release_tensor_array() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tensor_array) + clear_has_tensor_array(); + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + *temp = tensor_array_; + tensor_array_ = NULL; + return temp; + } + void VarType::set_allocated_tensor_array( + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + *tensor_array) { + delete tensor_array_; + tensor_array_ = tensor_array; + if (tensor_array) { + set_has_tensor_array(); + } else { + clear_has_tensor_array(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tensor_array) + } + + // optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader + // = 5; + bool VarType::has_reader() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + void VarType::set_has_reader() { _has_bits_[0] |= 0x00000008u; } + void VarType::clear_has_reader() { _has_bits_[0] &= ~0x00000008u; } + void VarType::clear_reader() { + if (reader_ != NULL) + reader_->::paddle_mobile::framework::proto:: + VarType_ReaderDesc::Clear(); + clear_has_reader(); + } + const ::paddle_mobile::framework::proto::VarType_ReaderDesc & + VarType::reader() const { + const ::paddle_mobile::framework::proto::VarType_ReaderDesc *p = + reader_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.reader) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_ReaderDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_ReaderDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_ReaderDesc * + VarType::mutable_reader() { + set_has_reader(); + if (reader_ == NULL) { + reader_ = new ::paddle_mobile::framework::proto:: + VarType_ReaderDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.reader) + return reader_; + } + ::paddle_mobile::framework::proto::VarType_ReaderDesc * + VarType::release_reader() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.reader) + clear_has_reader(); + ::paddle_mobile::framework::proto::VarType_ReaderDesc *temp = + reader_; + reader_ = NULL; + return temp; + } + void VarType::set_allocated_reader( + ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader) { + delete reader_; + reader_ = reader; + if (reader) { + set_has_reader(); + } else { + clear_has_reader(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.reader) + } + + // optional .paddle_mobile.framework.proto.VarType.ChannelDesc + // channel = 6; + bool VarType::has_channel() const { + return (_has_bits_[0] & 0x00000010u) != 0; + } + void VarType::set_has_channel() { _has_bits_[0] |= 0x00000010u; } + void VarType::clear_has_channel() { _has_bits_[0] &= ~0x00000010u; } + void VarType::clear_channel() { + if (channel_ != NULL) + channel_->::paddle_mobile::framework::proto:: + VarType_ChannelDesc::Clear(); + clear_has_channel(); + } + const ::paddle_mobile::framework::proto::VarType_ChannelDesc & + VarType::channel() const { + const ::paddle_mobile::framework::proto::VarType_ChannelDesc + *p = channel_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.channel) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_ChannelDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_ChannelDesc_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_ChannelDesc * + VarType::mutable_channel() { + set_has_channel(); + if (channel_ == NULL) { + channel_ = new ::paddle_mobile::framework::proto:: + VarType_ChannelDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.channel) + return channel_; + } + ::paddle_mobile::framework::proto::VarType_ChannelDesc * + VarType::release_channel() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.channel) + clear_has_channel(); + ::paddle_mobile::framework::proto::VarType_ChannelDesc *temp = + channel_; + channel_ = NULL; + return temp; + } + void VarType::set_allocated_channel( + ::paddle_mobile::framework::proto::VarType_ChannelDesc + *channel) { + delete channel_; + channel_ = channel; + if (channel) { + set_has_channel(); + } else { + clear_has_channel(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.channel) + } + + // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; + bool VarType::has_tuple() const { + return (_has_bits_[0] & 0x00000020u) != 0; + } + void VarType::set_has_tuple() { _has_bits_[0] |= 0x00000020u; } + void VarType::clear_has_tuple() { _has_bits_[0] &= ~0x00000020u; } + void VarType::clear_tuple() { + if (tuple_ != NULL) + tuple_->::paddle_mobile::framework::proto::VarType_Tuple:: + Clear(); + clear_has_tuple(); + } + const ::paddle_mobile::framework::proto::VarType_Tuple & + VarType::tuple() const { + const ::paddle_mobile::framework::proto::VarType_Tuple *p = + tuple_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tuple) + return p != NULL ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_Tuple *>( + &::paddle_mobile::framework::proto:: + _VarType_Tuple_default_instance_); + } + ::paddle_mobile::framework::proto::VarType_Tuple * + VarType::mutable_tuple() { + set_has_tuple(); + if (tuple_ == NULL) { + tuple_ = + new ::paddle_mobile::framework::proto::VarType_Tuple; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tuple) + return tuple_; + } + ::paddle_mobile::framework::proto::VarType_Tuple * + VarType::release_tuple() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tuple) + clear_has_tuple(); + ::paddle_mobile::framework::proto::VarType_Tuple *temp = tuple_; + tuple_ = NULL; + return temp; + } + void VarType::set_allocated_tuple( + ::paddle_mobile::framework::proto::VarType_Tuple *tuple) { + delete tuple_; + tuple_ = tuple; + if (tuple) { + set_has_tuple(); + } else { + clear_has_tuple(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tuple) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int VarDesc::kNameFieldNumber; -const int VarDesc::kTypeFieldNumber; -const int VarDesc::kPersistableFieldNumber; + const int VarDesc::kNameFieldNumber; + const int VarDesc::kTypeFieldNumber; + const int VarDesc::kPersistableFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -VarDesc::VarDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarDesc) -} -VarDesc::VarDesc(const VarDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (from.has_name()) { - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - if (from.has_type()) { - type_ = new ::paddle_mobile::framework::proto::VarType(*from.type_); - } else { - type_ = NULL; - } - persistable_ = from.persistable_; - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarDesc) -} - -void VarDesc::SharedCtor() { - _cached_size_ = 0; - name_.UnsafeSetDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - ::memset(&type_, 0, - static_cast(reinterpret_cast(&persistable_) - - reinterpret_cast(&type_)) + - sizeof(persistable_)); -} - -VarDesc::~VarDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarDesc) - SharedDtor(); -} - -void VarDesc::SharedDtor() { - name_.DestroyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - if (this != internal_default_instance()) - delete type_; -} - -void VarDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const VarDesc &VarDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -VarDesc *VarDesc::New(::google::protobuf::Arena *arena) const { - VarDesc *n = new VarDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void VarDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 3u) { - if (cached_has_bits & 0x00000001u) { - GOOGLE_DCHECK(!name_.IsDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited())); - (*name_.UnsafeRawStringPointer())->clear(); - } - if (cached_has_bits & 0x00000002u) { - GOOGLE_DCHECK(type_ != NULL); - type_->::paddle_mobile::framework::proto::VarType::Clear(); - } - } - persistable_ = false; - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool VarDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + VarDesc::VarDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.VarDesc) + } + VarDesc::VarDesc(const VarDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (from.has_name()) { + name_.AssignWithDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + if (from.has_type()) { + type_ = new ::paddle_mobile::framework::proto::VarType( + *from.type_); + } else { + type_ = NULL; + } + persistable_ = from.persistable_; + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.VarDesc) + } + + void VarDesc::SharedCtor() { + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + ::memset(&type_, 0, + static_cast( + reinterpret_cast(&persistable_) - + reinterpret_cast(&type_)) + + sizeof(persistable_)); + } + + VarDesc::~VarDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.VarDesc) + SharedDtor(); + } + + void VarDesc::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) + delete type_; + } + + void VarDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const VarDesc &VarDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + VarDesc *VarDesc::New(::google::protobuf::Arena *arena) const { + VarDesc *n = new VarDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void VarDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.VarDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 3u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(!name_.IsDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited())); + (*name_.UnsafeRawStringPointer())->clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(type_ != NULL); + type_->::paddle_mobile::framework::proto::VarType:: + Clear(); + } + } + persistable_ = false; + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool VarDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required string name = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_name())); - } else { - goto handle_unusual; - } - break; - } - - // required .paddle_mobile.framework.proto.VarType type = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, mutable_type())); - } else { - goto handle_unusual; - } - break; - } - - // optional bool persistable = 3 [default = false]; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { - set_has_persistable(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( - input, &persistable_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.VarDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadString(input, this->mutable_name())); + } else { + goto handle_unusual; + } + break; + } + + // required .paddle_mobile.framework.proto.VarType type = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 18u /* 18 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, + mutable_type())); + } else { + goto handle_unusual; + } + break; + } + + // optional bool persistable = 3 [default = false]; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 24u /* 24 & 0xFF */)) { + set_has_persistable(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + bool, ::google::protobuf::internal:: + WireFormatLite::TYPE_BOOL>( + input, &persistable_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.VarDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.VarDesc) + return false; #undef DO_ -} - -void VarDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required string name = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 1, this->name(), output); - } - - // required .paddle_mobile.framework.proto.VarType type = 2; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteMessage(2, *this->type_, - output); - } - - // optional bool persistable = 3 [default = false]; - if (cached_has_bits & 0x00000004u) { - ::google::protobuf::internal::WireFormatLite::WriteBool( - 3, this->persistable(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarDesc) -} - -size_t VarDesc::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.VarDesc) - size_t total_size = 0; - - if (has_name()) { - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - } - - if (has_type()) { - // required .paddle_mobile.framework.proto.VarType type = 2; - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->type_); - } - - return total_size; -} -size_t VarDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == - 0) { // All required fields are present. - // required string name = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->name()); - - // required .paddle_mobile.framework.proto.VarType type = 2; - total_size += - 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - *this->type_); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - // optional bool persistable = 3 [default = false]; - if (has_persistable()) { - total_size += 1 + 1; - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void VarDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void VarDesc::MergeFrom(const VarDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 7u) { - if (cached_has_bits & 0x00000001u) { - set_has_name(); - name_.AssignWithDefault( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - from.name_); - } - if (cached_has_bits & 0x00000002u) { - mutable_type()->::paddle_mobile::framework::proto::VarType::MergeFrom( - from.type()); - } - if (cached_has_bits & 0x00000004u) { - persistable_ = from.persistable_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void VarDesc::CopyFrom(const VarDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool VarDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) - return false; - if (has_type()) { - if (!this->type_->IsInitialized()) - return false; - } - return true; -} - -void VarDesc::Swap(VarDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void VarDesc::InternalSwap(VarDesc *other) { - using std::swap; - name_.Swap(&other->name_); - swap(type_, other->type_); - swap(persistable_, other->persistable_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string VarDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.VarDesc"; -} + } + + void VarDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.VarDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required string name = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite:: + WriteStringMaybeAliased(1, this->name(), output); + } + + // required .paddle_mobile.framework.proto.VarType type = 2; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, *this->type_, output); + } + + // optional bool persistable = 3 [default = false]; + if (cached_has_bits & 0x00000004u) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 3, this->persistable(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.VarDesc) + } + + size_t VarDesc::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.VarDesc) + size_t total_size = 0; + + if (has_name()) { + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + } + + if (has_type()) { + // required .paddle_mobile.framework.proto.VarType type = 2; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->type_); + } + + return total_size; + } + size_t VarDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.VarDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == + 0) { // All required fields are present. + // required string name = 1; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + StringSize(this->name()); + + // required .paddle_mobile.framework.proto.VarType type = 2; + total_size += 1 + + ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*this->type_); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + // optional bool persistable = 3 [default = false]; + if (has_persistable()) { + total_size += 1 + 1; + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void VarDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void VarDesc::MergeFrom(const VarDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.VarDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 7u) { + if (cached_has_bits & 0x00000001u) { + set_has_name(); + name_.AssignWithDefault( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + from.name_); + } + if (cached_has_bits & 0x00000002u) { + mutable_type()->::paddle_mobile::framework::proto:: + VarType::MergeFrom(from.type()); + } + if (cached_has_bits & 0x00000004u) { + persistable_ = from.persistable_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void VarDesc::CopyFrom(const VarDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.VarDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool VarDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) + return false; + if (has_type()) { + if (!this->type_->IsInitialized()) + return false; + } + return true; + } + + void VarDesc::Swap(VarDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void VarDesc::InternalSwap(VarDesc *other) { + using std::swap; + name_.Swap(&other->name_); + swap(type_, other->type_); + swap(persistable_, other->persistable_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string VarDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.VarDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// VarDesc - -// required string name = 1; -bool VarDesc::has_name() const { return (_has_bits_[0] & 0x00000001u) != 0; } -void VarDesc::set_has_name() { _has_bits_[0] |= 0x00000001u; } -void VarDesc::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -void VarDesc::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -const ::std::string &VarDesc::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.name) - return name_.GetNoArena(); -} -void VarDesc::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.name) -} + // VarDesc + + // required string name = 1; + bool VarDesc::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void VarDesc::set_has_name() { _has_bits_[0] |= 0x00000001u; } + void VarDesc::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } + void VarDesc::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + const ::std::string &VarDesc::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.name) + return name_.GetNoArena(); + } + void VarDesc::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.name) + } #if LANG_CXX11 -void VarDesc::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.VarDesc.name) -} + void VarDesc::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.VarDesc.name) + } #endif -void VarDesc::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.VarDesc.name) -} -void VarDesc::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.VarDesc.name) -} -::std::string *VarDesc::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string *VarDesc::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void VarDesc::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.name) -} - -// required .paddle_mobile.framework.proto.VarType type = 2; -bool VarDesc::has_type() const { return (_has_bits_[0] & 0x00000002u) != 0; } -void VarDesc::set_has_type() { _has_bits_[0] |= 0x00000002u; } -void VarDesc::clear_has_type() { _has_bits_[0] &= ~0x00000002u; } -void VarDesc::clear_type() { - if (type_ != NULL) - type_->::paddle_mobile::framework::proto::VarType::Clear(); - clear_has_type(); -} -const ::paddle_mobile::framework::proto::VarType &VarDesc::type() const { - const ::paddle_mobile::framework::proto::VarType *p = type_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.type) - return p != NULL ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType *>( - &::paddle_mobile::framework::proto:: - _VarType_default_instance_); -} -::paddle_mobile::framework::proto::VarType *VarDesc::mutable_type() { - set_has_type(); - if (type_ == NULL) { - type_ = new ::paddle_mobile::framework::proto::VarType; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.type) - return type_; -} -::paddle_mobile::framework::proto::VarType *VarDesc::release_type() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.type) - clear_has_type(); - ::paddle_mobile::framework::proto::VarType *temp = type_; - type_ = NULL; - return temp; -} -void VarDesc::set_allocated_type( - ::paddle_mobile::framework::proto::VarType *type) { - delete type_; - type_ = type; - if (type) { - set_has_type(); - } else { - clear_has_type(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.type) -} - -// optional bool persistable = 3 [default = false]; -bool VarDesc::has_persistable() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void VarDesc::set_has_persistable() { _has_bits_[0] |= 0x00000004u; } -void VarDesc::clear_has_persistable() { _has_bits_[0] &= ~0x00000004u; } -void VarDesc::clear_persistable() { - persistable_ = false; - clear_has_persistable(); -} -bool VarDesc::persistable() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.persistable) - return persistable_; -} -void VarDesc::set_persistable(bool value) { - set_has_persistable(); - persistable_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.persistable) -} + void VarDesc::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.VarDesc.name) + } + void VarDesc::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.VarDesc.name) + } + ::std::string *VarDesc::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + ::std::string *VarDesc::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + void VarDesc::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.name) + } + + // required .paddle_mobile.framework.proto.VarType type = 2; + bool VarDesc::has_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void VarDesc::set_has_type() { _has_bits_[0] |= 0x00000002u; } + void VarDesc::clear_has_type() { _has_bits_[0] &= ~0x00000002u; } + void VarDesc::clear_type() { + if (type_ != NULL) + type_->::paddle_mobile::framework::proto::VarType::Clear(); + clear_has_type(); + } + const ::paddle_mobile::framework::proto::VarType & + VarDesc::type() const { + const ::paddle_mobile::framework::proto::VarType *p = type_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.type) + return p != NULL + ? *p + : *reinterpret_cast( + &::paddle_mobile::framework::proto:: + _VarType_default_instance_); + } + ::paddle_mobile::framework::proto::VarType * + VarDesc::mutable_type() { + set_has_type(); + if (type_ == NULL) { + type_ = new ::paddle_mobile::framework::proto::VarType; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.type) + return type_; + } + ::paddle_mobile::framework::proto::VarType * + VarDesc::release_type() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.type) + clear_has_type(); + ::paddle_mobile::framework::proto::VarType *temp = type_; + type_ = NULL; + return temp; + } + void VarDesc::set_allocated_type( + ::paddle_mobile::framework::proto::VarType *type) { + delete type_; + type_ = type; + if (type) { + set_has_type(); + } else { + clear_has_type(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.type) + } + + // optional bool persistable = 3 [default = false]; + bool VarDesc::has_persistable() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + void VarDesc::set_has_persistable() { + _has_bits_[0] |= 0x00000004u; + } + void VarDesc::clear_has_persistable() { + _has_bits_[0] &= ~0x00000004u; + } + void VarDesc::clear_persistable() { + persistable_ = false; + clear_has_persistable(); + } + bool VarDesc::persistable() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.persistable) + return persistable_; + } + void VarDesc::set_persistable(bool value) { + set_has_persistable(); + persistable_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.persistable) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int BlockDesc::kIdxFieldNumber; -const int BlockDesc::kParentIdxFieldNumber; -const int BlockDesc::kVarsFieldNumber; -const int BlockDesc::kOpsFieldNumber; -const int BlockDesc::kForwardBlockIdxFieldNumber; + const int BlockDesc::kIdxFieldNumber; + const int BlockDesc::kParentIdxFieldNumber; + const int BlockDesc::kVarsFieldNumber; + const int BlockDesc::kOpsFieldNumber; + const int BlockDesc::kForwardBlockIdxFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -BlockDesc::BlockDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.BlockDesc) -} -BlockDesc::BlockDesc(const BlockDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), vars_(from.vars_), - ops_(from.ops_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::memcpy(&idx_, &from.idx_, - static_cast(reinterpret_cast(&forward_block_idx_) - - reinterpret_cast(&idx_)) + - sizeof(forward_block_idx_)); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.BlockDesc) -} - -void BlockDesc::SharedCtor() { - _cached_size_ = 0; - ::memset(&idx_, 0, - static_cast(reinterpret_cast(&parent_idx_) - - reinterpret_cast(&idx_)) + - sizeof(parent_idx_)); - forward_block_idx_ = -1; -} - -BlockDesc::~BlockDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.BlockDesc) - SharedDtor(); -} - -void BlockDesc::SharedDtor() {} - -void BlockDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const BlockDesc &BlockDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -BlockDesc *BlockDesc::New(::google::protobuf::Arena *arena) const { - BlockDesc *n = new BlockDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void BlockDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.BlockDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - vars_.Clear(); - ops_.Clear(); - cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 7u) { - ::memset(&idx_, 0, - static_cast(reinterpret_cast(&parent_idx_) - + BlockDesc::BlockDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.BlockDesc) + } + BlockDesc::BlockDesc(const BlockDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + vars_(from.vars_), ops_(from.ops_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&idx_, &from.idx_, + static_cast( + reinterpret_cast(&forward_block_idx_) - + reinterpret_cast(&idx_)) + + sizeof(forward_block_idx_)); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.BlockDesc) + } + + void BlockDesc::SharedCtor() { + _cached_size_ = 0; + ::memset(&idx_, 0, static_cast( + reinterpret_cast(&parent_idx_) - + reinterpret_cast(&idx_)) + + sizeof(parent_idx_)); + forward_block_idx_ = -1; + } + + BlockDesc::~BlockDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.BlockDesc) + SharedDtor(); + } + + void BlockDesc::SharedDtor() {} + + void BlockDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const BlockDesc &BlockDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + BlockDesc *BlockDesc::New(::google::protobuf::Arena *arena) const { + BlockDesc *n = new BlockDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void BlockDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.BlockDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + vars_.Clear(); + ops_.Clear(); + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 7u) { + ::memset(&idx_, 0, + static_cast( + reinterpret_cast(&parent_idx_) - reinterpret_cast(&idx_)) + - sizeof(parent_idx_)); - forward_block_idx_ = -1; - } - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool BlockDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + sizeof(parent_idx_)); + forward_block_idx_ = -1; + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool BlockDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.BlockDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // required int32 idx = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { - set_has_idx(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(input, - &idx_))); - } else { - goto handle_unusual; - } - break; - } - - // required int32 parent_idx = 2; - case 2: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { - set_has_parent_idx(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &parent_idx_))); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; - case 3: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_vars())); - } else { - goto handle_unusual; - } - break; - } - - // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; - case 4: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_ops())); - } else { - goto handle_unusual; - } - break; - } - - // optional int32 forward_block_idx = 5 [default = -1]; - case 5: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { - set_has_forward_block_idx(); - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, - ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &forward_block_idx_))); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.BlockDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.BlockDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.BlockDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // required int32 idx = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 8u /* 8 & 0xFF */)) { + set_has_idx(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, &idx_))); + } else { + goto handle_unusual; + } + break; + } + + // required int32 parent_idx = 2; + case 2: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 16u /* 16 & 0xFF */)) { + set_has_parent_idx(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, &parent_idx_))); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; + case 3: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 26u /* 26 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_vars())); + } else { + goto handle_unusual; + } + break; + } + + // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; + case 4: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 34u /* 34 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_ops())); + } else { + goto handle_unusual; + } + break; + } + + // optional int32 forward_block_idx = 5 [default = -1]; + case 5: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 40u /* 40 & 0xFF */)) { + set_has_forward_block_idx(); + DO_((::google::protobuf::internal::WireFormatLite:: + ReadPrimitive< + ::google::protobuf::int32, + ::google::protobuf::internal:: + WireFormatLite::TYPE_INT32>( + input, &forward_block_idx_))); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.BlockDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.BlockDesc) + return false; #undef DO_ -} - -void BlockDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.BlockDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - cached_has_bits = _has_bits_[0]; - // required int32 idx = 1; - if (cached_has_bits & 0x00000001u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->idx(), - output); - } - - // required int32 parent_idx = 2; - if (cached_has_bits & 0x00000002u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32( - 2, this->parent_idx(), output); - } - - // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; - for (unsigned int i = 0, n = static_cast(this->vars_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 3, this->vars(static_cast(i)), output); - } - - // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; - for (unsigned int i = 0, n = static_cast(this->ops_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 4, this->ops(static_cast(i)), output); - } - - // optional int32 forward_block_idx = 5 [default = -1]; - if (cached_has_bits & 0x00000004u) { - ::google::protobuf::internal::WireFormatLite::WriteInt32( - 5, this->forward_block_idx(), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.BlockDesc) -} - -size_t BlockDesc::RequiredFieldsByteSizeFallback() const { - // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.BlockDesc) - size_t total_size = 0; - - if (has_idx()) { - // required int32 idx = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->idx()); - } - - if (has_parent_idx()) { - // required int32 parent_idx = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->parent_idx()); - } - - return total_size; -} -size_t BlockDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.BlockDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == - 0) { // All required fields are present. - // required int32 idx = 1; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->idx()); - - // required int32 parent_idx = 2; - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->parent_idx()); - - } else { - total_size += RequiredFieldsByteSizeFallback(); - } - // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; - { - unsigned int count = static_cast(this->vars_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->vars(static_cast(i))); - } - } - - // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; - { - unsigned int count = static_cast(this->ops_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->ops(static_cast(i))); - } - } - - // optional int32 forward_block_idx = 5 [default = -1]; - if (has_forward_block_idx()) { - total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( - this->forward_block_idx()); - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void BlockDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void BlockDesc::MergeFrom(const BlockDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.BlockDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - vars_.MergeFrom(from.vars_); - ops_.MergeFrom(from.ops_); - cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 7u) { - if (cached_has_bits & 0x00000001u) { - idx_ = from.idx_; - } - if (cached_has_bits & 0x00000002u) { - parent_idx_ = from.parent_idx_; - } - if (cached_has_bits & 0x00000004u) { - forward_block_idx_ = from.forward_block_idx_; - } - _has_bits_[0] |= cached_has_bits; - } -} - -void BlockDesc::CopyFrom(const BlockDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.BlockDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool BlockDesc::IsInitialized() const { - if ((_has_bits_[0] & 0x00000003) != 0x00000003) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->vars())) - return false; - if (!::google::protobuf::internal::AllAreInitialized(this->ops())) - return false; - return true; -} - -void BlockDesc::Swap(BlockDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void BlockDesc::InternalSwap(BlockDesc *other) { - using std::swap; - vars_.InternalSwap(&other->vars_); - ops_.InternalSwap(&other->ops_); - swap(idx_, other->idx_); - swap(parent_idx_, other->parent_idx_); - swap(forward_block_idx_, other->forward_block_idx_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string BlockDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.BlockDesc"; -} + } + + void BlockDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.BlockDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // required int32 idx = 1; + if (cached_has_bits & 0x00000001u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 1, this->idx(), output); + } + + // required int32 parent_idx = 2; + if (cached_has_bits & 0x00000002u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 2, this->parent_idx(), output); + } + + // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; + for (unsigned int i = 0, n = static_cast( + this->vars_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 3, this->vars(static_cast(i)), output); + } + + // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; + for (unsigned int i = 0, n = static_cast( + this->ops_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 4, this->ops(static_cast(i)), output); + } + + // optional int32 forward_block_idx = 5 [default = -1]; + if (cached_has_bits & 0x00000004u) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 5, this->forward_block_idx(), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.BlockDesc) + } + + size_t BlockDesc::RequiredFieldsByteSizeFallback() const { + // @@protoc_insertion_point(required_fields_byte_size_fallback_start:paddle_mobile.framework.proto.BlockDesc) + size_t total_size = 0; + + if (has_idx()) { + // required int32 idx = 1; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->idx()); + } + + if (has_parent_idx()) { + // required int32 parent_idx = 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->parent_idx()); + } + + return total_size; + } + size_t BlockDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.BlockDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == + 0) { // All required fields are present. + // required int32 idx = 1; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->idx()); + + // required int32 parent_idx = 2; + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->parent_idx()); + + } else { + total_size += RequiredFieldsByteSizeFallback(); + } + // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; + { + unsigned int count = + static_cast(this->vars_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->vars(static_cast(i))); + } + } + + // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; + { + unsigned int count = + static_cast(this->ops_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->ops(static_cast(i))); + } + } + + // optional int32 forward_block_idx = 5 [default = -1]; + if (has_forward_block_idx()) { + total_size += + 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->forward_block_idx()); + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void BlockDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void BlockDesc::MergeFrom(const BlockDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.BlockDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + vars_.MergeFrom(from.vars_); + ops_.MergeFrom(from.ops_); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 7u) { + if (cached_has_bits & 0x00000001u) { + idx_ = from.idx_; + } + if (cached_has_bits & 0x00000002u) { + parent_idx_ = from.parent_idx_; + } + if (cached_has_bits & 0x00000004u) { + forward_block_idx_ = from.forward_block_idx_; + } + _has_bits_[0] |= cached_has_bits; + } + } + + void BlockDesc::CopyFrom(const BlockDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.BlockDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool BlockDesc::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->vars())) + return false; + if (!::google::protobuf::internal::AllAreInitialized( + this->ops())) + return false; + return true; + } + + void BlockDesc::Swap(BlockDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void BlockDesc::InternalSwap(BlockDesc *other) { + using std::swap; + vars_.InternalSwap(&other->vars_); + ops_.InternalSwap(&other->ops_); + swap(idx_, other->idx_); + swap(parent_idx_, other->parent_idx_); + swap(forward_block_idx_, other->forward_block_idx_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string BlockDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.BlockDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// BlockDesc - -// required int32 idx = 1; -bool BlockDesc::has_idx() const { return (_has_bits_[0] & 0x00000001u) != 0; } -void BlockDesc::set_has_idx() { _has_bits_[0] |= 0x00000001u; } -void BlockDesc::clear_has_idx() { _has_bits_[0] &= ~0x00000001u; } -void BlockDesc::clear_idx() { - idx_ = 0; - clear_has_idx(); -} -::google::protobuf::int32 BlockDesc::idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.idx) - return idx_; -} -void BlockDesc::set_idx(::google::protobuf::int32 value) { - set_has_idx(); - idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.idx) -} - -// required int32 parent_idx = 2; -bool BlockDesc::has_parent_idx() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void BlockDesc::set_has_parent_idx() { _has_bits_[0] |= 0x00000002u; } -void BlockDesc::clear_has_parent_idx() { _has_bits_[0] &= ~0x00000002u; } -void BlockDesc::clear_parent_idx() { - parent_idx_ = 0; - clear_has_parent_idx(); -} -::google::protobuf::int32 BlockDesc::parent_idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.parent_idx) - return parent_idx_; -} -void BlockDesc::set_parent_idx(::google::protobuf::int32 value) { - set_has_parent_idx(); - parent_idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.parent_idx) -} - -// repeated .paddle_mobile.framework.proto.VarDesc vars = 3; -int BlockDesc::vars_size() const { return vars_.size(); } -void BlockDesc::clear_vars() { vars_.Clear(); } -const ::paddle_mobile::framework::proto::VarDesc & -BlockDesc::vars(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_.Get(index); -} -::paddle_mobile::framework::proto::VarDesc *BlockDesc::mutable_vars(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_.Mutable(index); -} -::paddle_mobile::framework::proto::VarDesc *BlockDesc::add_vars() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_.Add(); -} -::google::protobuf::RepeatedPtrField<::paddle_mobile::framework::proto::VarDesc> - *BlockDesc::mutable_vars() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.vars) - return &vars_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarDesc> & -BlockDesc::vars() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_; -} - -// repeated .paddle_mobile.framework.proto.OpDesc ops = 4; -int BlockDesc::ops_size() const { return ops_.size(); } -void BlockDesc::clear_ops() { ops_.Clear(); } -const ::paddle_mobile::framework::proto::OpDesc & -BlockDesc::ops(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_.Get(index); -} -::paddle_mobile::framework::proto::OpDesc *BlockDesc::mutable_ops(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_.Mutable(index); -} -::paddle_mobile::framework::proto::OpDesc *BlockDesc::add_ops() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_.Add(); -} -::google::protobuf::RepeatedPtrField<::paddle_mobile::framework::proto::OpDesc> - *BlockDesc::mutable_ops() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.ops) - return &ops_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc> & -BlockDesc::ops() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_; -} - -// optional int32 forward_block_idx = 5 [default = -1]; -bool BlockDesc::has_forward_block_idx() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void BlockDesc::set_has_forward_block_idx() { _has_bits_[0] |= 0x00000004u; } -void BlockDesc::clear_has_forward_block_idx() { _has_bits_[0] &= ~0x00000004u; } -void BlockDesc::clear_forward_block_idx() { - forward_block_idx_ = -1; - clear_has_forward_block_idx(); -} -::google::protobuf::int32 BlockDesc::forward_block_idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) - return forward_block_idx_; -} -void BlockDesc::set_forward_block_idx(::google::protobuf::int32 value) { - set_has_forward_block_idx(); - forward_block_idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) -} + // BlockDesc + + // required int32 idx = 1; + bool BlockDesc::has_idx() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + void BlockDesc::set_has_idx() { _has_bits_[0] |= 0x00000001u; } + void BlockDesc::clear_has_idx() { _has_bits_[0] &= ~0x00000001u; } + void BlockDesc::clear_idx() { + idx_ = 0; + clear_has_idx(); + } + ::google::protobuf::int32 BlockDesc::idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.idx) + return idx_; + } + void BlockDesc::set_idx(::google::protobuf::int32 value) { + set_has_idx(); + idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.idx) + } + + // required int32 parent_idx = 2; + bool BlockDesc::has_parent_idx() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + void BlockDesc::set_has_parent_idx() { + _has_bits_[0] |= 0x00000002u; + } + void BlockDesc::clear_has_parent_idx() { + _has_bits_[0] &= ~0x00000002u; + } + void BlockDesc::clear_parent_idx() { + parent_idx_ = 0; + clear_has_parent_idx(); + } + ::google::protobuf::int32 BlockDesc::parent_idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.parent_idx) + return parent_idx_; + } + void BlockDesc::set_parent_idx(::google::protobuf::int32 value) { + set_has_parent_idx(); + parent_idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.parent_idx) + } + + // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; + int BlockDesc::vars_size() const { return vars_.size(); } + void BlockDesc::clear_vars() { vars_.Clear(); } + const ::paddle_mobile::framework::proto::VarDesc & + BlockDesc::vars(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_.Get(index); + } + ::paddle_mobile::framework::proto::VarDesc * + BlockDesc::mutable_vars(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_.Mutable(index); + } + ::paddle_mobile::framework::proto::VarDesc *BlockDesc::add_vars() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> * + BlockDesc::mutable_vars() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.vars) + return &vars_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> & + BlockDesc::vars() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_; + } + + // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; + int BlockDesc::ops_size() const { return ops_.size(); } + void BlockDesc::clear_ops() { ops_.Clear(); } + const ::paddle_mobile::framework::proto::OpDesc & + BlockDesc::ops(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_.Get(index); + } + ::paddle_mobile::framework::proto::OpDesc * + BlockDesc::mutable_ops(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_.Mutable(index); + } + ::paddle_mobile::framework::proto::OpDesc *BlockDesc::add_ops() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> * + BlockDesc::mutable_ops() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.ops) + return &ops_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> & + BlockDesc::ops() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_; + } + + // optional int32 forward_block_idx = 5 [default = -1]; + bool BlockDesc::has_forward_block_idx() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + void BlockDesc::set_has_forward_block_idx() { + _has_bits_[0] |= 0x00000004u; + } + void BlockDesc::clear_has_forward_block_idx() { + _has_bits_[0] &= ~0x00000004u; + } + void BlockDesc::clear_forward_block_idx() { + forward_block_idx_ = -1; + clear_has_forward_block_idx(); + } + ::google::protobuf::int32 BlockDesc::forward_block_idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) + return forward_block_idx_; + } + void + BlockDesc::set_forward_block_idx(::google::protobuf::int32 value) { + set_has_forward_block_idx(); + forward_block_idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== #if !defined(_MSC_VER) || _MSC_VER >= 1900 -const int ProgramDesc::kBlocksFieldNumber; + const int ProgramDesc::kBlocksFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 -ProgramDesc::ProgramDesc() - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_framework_2eproto::InitDefaults(); - } - SharedCtor(); - // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.ProgramDesc) -} -ProgramDesc::ProgramDesc(const ProgramDesc &from) - : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), - _has_bits_(from._has_bits_), _cached_size_(0), blocks_(from.blocks_) { - _internal_metadata_.MergeFrom(from._internal_metadata_); - // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.ProgramDesc) -} - -void ProgramDesc::SharedCtor() { _cached_size_ = 0; } - -ProgramDesc::~ProgramDesc() { - // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.ProgramDesc) - SharedDtor(); -} - -void ProgramDesc::SharedDtor() {} - -void ProgramDesc::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); -} -const ProgramDesc &ProgramDesc::default_instance() { - protobuf_framework_2eproto::InitDefaults(); - return *internal_default_instance(); -} - -ProgramDesc *ProgramDesc::New(::google::protobuf::Arena *arena) const { - ProgramDesc *n = new ProgramDesc; - if (arena != NULL) { - arena->Own(n); - } - return n; -} - -void ProgramDesc::Clear() { - // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.ProgramDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - // Prevent compiler warnings about cached_has_bits being unused - (void)cached_has_bits; - - blocks_.Clear(); - _has_bits_.Clear(); - _internal_metadata_.Clear(); -} - -bool ProgramDesc::MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) { + ProgramDesc::ProgramDesc() + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL) { + if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { + protobuf_framework_2eproto::InitDefaults(); + } + SharedCtor(); + // @@protoc_insertion_point(constructor:paddle_mobile.framework.proto.ProgramDesc) + } + ProgramDesc::ProgramDesc(const ProgramDesc &from) + : ::google::protobuf::MessageLite(), _internal_metadata_(NULL), + _has_bits_(from._has_bits_), _cached_size_(0), + blocks_(from.blocks_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:paddle_mobile.framework.proto.ProgramDesc) + } + + void ProgramDesc::SharedCtor() { _cached_size_ = 0; } + + ProgramDesc::~ProgramDesc() { + // @@protoc_insertion_point(destructor:paddle_mobile.framework.proto.ProgramDesc) + SharedDtor(); + } + + void ProgramDesc::SharedDtor() {} + + void ProgramDesc::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + } + const ProgramDesc &ProgramDesc::default_instance() { + protobuf_framework_2eproto::InitDefaults(); + return *internal_default_instance(); + } + + ProgramDesc * + ProgramDesc::New(::google::protobuf::Arena *arena) const { + ProgramDesc *n = new ProgramDesc; + if (arena != NULL) { + arena->Own(n); + } + return n; + } + + void ProgramDesc::Clear() { + // @@protoc_insertion_point(message_clear_start:paddle_mobile.framework.proto.ProgramDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void)cached_has_bits; + + blocks_.Clear(); + _has_bits_.Clear(); + _internal_metadata_.Clear(); + } + + bool ProgramDesc::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) { #define DO_(EXPRESSION) \ - if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ - goto failure - ::google::protobuf::uint32 tag; - ::google::protobuf::io::LazyStringOutputStream unknown_fields_string( - ::google::protobuf::NewPermanentCallback( - &_internal_metadata_, - &::google::protobuf::internal::InternalMetadataWithArenaLite:: - mutable_unknown_fields)); - ::google::protobuf::io::CodedOutputStream unknown_fields_stream( - &unknown_fields_string, false); - // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.ProgramDesc) - for (;;) { - ::std::pair<::google::protobuf::uint32, bool> p = - input->ReadTagWithCutoffNoLastTag(127u); - tag = p.first; - if (!p.second) - goto handle_unusual; - switch ( - ::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { - // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; - case 1: { - if (static_cast<::google::protobuf::uint8>(tag) == - static_cast<::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_blocks())); - } else { - goto handle_unusual; - } - break; - } - - default: { - handle_unusual: - if (tag == 0) { - goto success; - } - DO_(::google::protobuf::internal::WireFormatLite::SkipField( - input, tag, &unknown_fields_stream)); - break; - } - } - } -success: - // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.ProgramDesc) - return true; -failure: - // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.ProgramDesc) - return false; + if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) \ + goto failure + ::google::protobuf::uint32 tag; + ::google::protobuf::io::LazyStringOutputStream + unknown_fields_string( + ::google::protobuf::NewPermanentCallback( + &_internal_metadata_, + &::google::protobuf::internal:: + InternalMetadataWithArenaLite:: + mutable_unknown_fields)); + ::google::protobuf::io::CodedOutputStream unknown_fields_stream( + &unknown_fields_string, false); + // @@protoc_insertion_point(parse_start:paddle_mobile.framework.proto.ProgramDesc) + for (;;) { + ::std::pair<::google::protobuf::uint32, bool> p = + input->ReadTagWithCutoffNoLastTag(127u); + tag = p.first; + if (!p.second) + goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite:: + GetTagFieldNumber(tag)) { + // repeated .paddle_mobile.framework.proto.BlockDesc blocks + // = 1; + case 1: { + if (static_cast<::google::protobuf::uint8>(tag) == + static_cast<::google::protobuf::uint8>( + 10u /* 10 & 0xFF */)) { + DO_(::google::protobuf::internal::WireFormatLite:: + ReadMessageNoVirtual(input, add_blocks())); + } else { + goto handle_unusual; + } + break; + } + + default: { + handle_unusual: + if (tag == 0) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite:: + SkipField(input, tag, &unknown_fields_stream)); + break; + } + } + } + success: + // @@protoc_insertion_point(parse_success:paddle_mobile.framework.proto.ProgramDesc) + return true; + failure: + // @@protoc_insertion_point(parse_failure:paddle_mobile.framework.proto.ProgramDesc) + return false; #undef DO_ -} - -void ProgramDesc::SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const { - // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.ProgramDesc) - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; - for (unsigned int i = 0, n = static_cast(this->blocks_size()); - i < n; i++) { - ::google::protobuf::internal::WireFormatLite::WriteMessage( - 1, this->blocks(static_cast(i)), output); - } - - output->WriteRaw( - _internal_metadata_.unknown_fields().data(), - static_cast(_internal_metadata_.unknown_fields().size())); - // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.ProgramDesc) -} - -size_t ProgramDesc::ByteSizeLong() const { - // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.ProgramDesc) - size_t total_size = 0; - - total_size += _internal_metadata_.unknown_fields().size(); - - // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; - { - unsigned int count = static_cast(this->blocks_size()); - total_size += 1UL * count; - for (unsigned int i = 0; i < count; i++) { - total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( - this->blocks(static_cast(i))); - } - } - - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); - return total_size; -} - -void ProgramDesc::CheckTypeAndMergeFrom( - const ::google::protobuf::MessageLite &from) { - MergeFrom(*::google::protobuf::down_cast(&from)); -} - -void ProgramDesc::MergeFrom(const ProgramDesc &from) { - // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.ProgramDesc) - GOOGLE_DCHECK_NE(&from, this); - _internal_metadata_.MergeFrom(from._internal_metadata_); - ::google::protobuf::uint32 cached_has_bits = 0; - (void)cached_has_bits; - - blocks_.MergeFrom(from.blocks_); -} - -void ProgramDesc::CopyFrom(const ProgramDesc &from) { - // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.ProgramDesc) - if (&from == this) - return; - Clear(); - MergeFrom(from); -} - -bool ProgramDesc::IsInitialized() const { - if (!::google::protobuf::internal::AllAreInitialized(this->blocks())) - return false; - return true; -} - -void ProgramDesc::Swap(ProgramDesc *other) { - if (other == this) - return; - InternalSwap(other); -} -void ProgramDesc::InternalSwap(ProgramDesc *other) { - using std::swap; - blocks_.InternalSwap(&other->blocks_); - swap(_has_bits_[0], other->_has_bits_[0]); - _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); -} - -::std::string ProgramDesc::GetTypeName() const { - return "paddle_mobile.framework.proto.ProgramDesc"; -} + } + + void ProgramDesc::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const { + // @@protoc_insertion_point(serialize_start:paddle_mobile.framework.proto.ProgramDesc) + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; + for (unsigned int i = 0, n = static_cast( + this->blocks_size()); + i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->blocks(static_cast(i)), output); + } + + output->WriteRaw( + _internal_metadata_.unknown_fields().data(), + static_cast( + _internal_metadata_.unknown_fields().size())); + // @@protoc_insertion_point(serialize_end:paddle_mobile.framework.proto.ProgramDesc) + } + + size_t ProgramDesc::ByteSizeLong() const { + // @@protoc_insertion_point(message_byte_size_start:paddle_mobile.framework.proto.ProgramDesc) + size_t total_size = 0; + + total_size += _internal_metadata_.unknown_fields().size(); + + // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; + { + unsigned int count = + static_cast(this->blocks_size()); + total_size += 1UL * count; + for (unsigned int i = 0; i < count; i++) { + total_size += ::google::protobuf::internal:: + WireFormatLite::MessageSizeNoVirtual( + this->blocks(static_cast(i))); + } + } + + int cached_size = + ::google::protobuf::internal::ToCachedSize(total_size); + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = cached_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; + } + + void ProgramDesc::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) { + MergeFrom( + *::google::protobuf::down_cast(&from)); + } + + void ProgramDesc::MergeFrom(const ProgramDesc &from) { + // @@protoc_insertion_point(class_specific_merge_from_start:paddle_mobile.framework.proto.ProgramDesc) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::google::protobuf::uint32 cached_has_bits = 0; + (void)cached_has_bits; + + blocks_.MergeFrom(from.blocks_); + } + + void ProgramDesc::CopyFrom(const ProgramDesc &from) { + // @@protoc_insertion_point(class_specific_copy_from_start:paddle_mobile.framework.proto.ProgramDesc) + if (&from == this) + return; + Clear(); + MergeFrom(from); + } + + bool ProgramDesc::IsInitialized() const { + if (!::google::protobuf::internal::AllAreInitialized( + this->blocks())) + return false; + return true; + } + + void ProgramDesc::Swap(ProgramDesc *other) { + if (other == this) + return; + InternalSwap(other); + } + void ProgramDesc::InternalSwap(ProgramDesc *other) { + using std::swap; + blocks_.InternalSwap(&other->blocks_); + swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + swap(_cached_size_, other->_cached_size_); + } + + ::std::string ProgramDesc::GetTypeName() const { + return "paddle_mobile.framework.proto.ProgramDesc"; + } #if PROTOBUF_INLINE_NOT_IN_HEADERS -// ProgramDesc - -// repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; -int ProgramDesc::blocks_size() const { return blocks_.size(); } -void ProgramDesc::clear_blocks() { blocks_.Clear(); } -const ::paddle_mobile::framework::proto::BlockDesc & -ProgramDesc::blocks(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_.Get(index); -} -::paddle_mobile::framework::proto::BlockDesc * -ProgramDesc::mutable_blocks(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_.Mutable(index); -} -::paddle_mobile::framework::proto::BlockDesc *ProgramDesc::add_blocks() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_.Add(); -} -::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> * -ProgramDesc::mutable_blocks() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.ProgramDesc.blocks) - return &blocks_; -} -const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> & -ProgramDesc::blocks() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_; -} + // ProgramDesc + + // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; + int ProgramDesc::blocks_size() const { return blocks_.size(); } + void ProgramDesc::clear_blocks() { blocks_.Clear(); } + const ::paddle_mobile::framework::proto::BlockDesc & + ProgramDesc::blocks(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_.Get(index); + } + ::paddle_mobile::framework::proto::BlockDesc * + ProgramDesc::mutable_blocks(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_.Mutable(index); + } + ::paddle_mobile::framework::proto::BlockDesc * + ProgramDesc::add_blocks() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_.Add(); + } + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> * + ProgramDesc::mutable_blocks() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.ProgramDesc.blocks) + return &blocks_; + } + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> & + ProgramDesc::blocks() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_; + } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS -// @@protoc_insertion_point(namespace_scope) + // @@protoc_insertion_point(namespace_scope) -} // namespace proto -} // namespace framework + } // namespace proto + } // namespace framework } // namespace paddle_mobile // @@protoc_insertion_point(global_scope) diff --git a/src/framework/framework.pb.h b/src/framework/framework.pb.h index 585c05ef8c01ed784da3bd1399115d56565051c4..8deede1bc90bb652c0d52e2eac7cc9e96d0d5de9 100644 --- a/src/framework/framework.pb.h +++ b/src/framework/framework.pb.h @@ -31,2555 +31,2865 @@ #include // IWYU pragma: export // @@protoc_insertion_point(includes) namespace paddle_mobile { -namespace framework { -namespace proto { -class BlockDesc; -class BlockDescDefaultTypeInternal; -extern BlockDescDefaultTypeInternal _BlockDesc_default_instance_; -class OpDesc; -class OpDescDefaultTypeInternal; -extern OpDescDefaultTypeInternal _OpDesc_default_instance_; -class OpDesc_Attr; -class OpDesc_AttrDefaultTypeInternal; -extern OpDesc_AttrDefaultTypeInternal _OpDesc_Attr_default_instance_; -class OpDesc_Var; -class OpDesc_VarDefaultTypeInternal; -extern OpDesc_VarDefaultTypeInternal _OpDesc_Var_default_instance_; -class OpProto; -class OpProtoDefaultTypeInternal; -extern OpProtoDefaultTypeInternal _OpProto_default_instance_; -class OpProto_Attr; -class OpProto_AttrDefaultTypeInternal; -extern OpProto_AttrDefaultTypeInternal _OpProto_Attr_default_instance_; -class OpProto_Var; -class OpProto_VarDefaultTypeInternal; -extern OpProto_VarDefaultTypeInternal _OpProto_Var_default_instance_; -class ProgramDesc; -class ProgramDescDefaultTypeInternal; -extern ProgramDescDefaultTypeInternal _ProgramDesc_default_instance_; -class VarDesc; -class VarDescDefaultTypeInternal; -extern VarDescDefaultTypeInternal _VarDesc_default_instance_; -class VarType; -class VarTypeDefaultTypeInternal; -extern VarTypeDefaultTypeInternal _VarType_default_instance_; -class VarType_ChannelDesc; -class VarType_ChannelDescDefaultTypeInternal; -extern VarType_ChannelDescDefaultTypeInternal - _VarType_ChannelDesc_default_instance_; -class VarType_LoDTensorArrayDesc; -class VarType_LoDTensorArrayDescDefaultTypeInternal; -extern VarType_LoDTensorArrayDescDefaultTypeInternal - _VarType_LoDTensorArrayDesc_default_instance_; -class VarType_LoDTensorDesc; -class VarType_LoDTensorDescDefaultTypeInternal; -extern VarType_LoDTensorDescDefaultTypeInternal - _VarType_LoDTensorDesc_default_instance_; -class VarType_ReaderDesc; -class VarType_ReaderDescDefaultTypeInternal; -extern VarType_ReaderDescDefaultTypeInternal - _VarType_ReaderDesc_default_instance_; -class VarType_TensorDesc; -class VarType_TensorDescDefaultTypeInternal; -extern VarType_TensorDescDefaultTypeInternal - _VarType_TensorDesc_default_instance_; -class VarType_Tuple; -class VarType_TupleDefaultTypeInternal; -extern VarType_TupleDefaultTypeInternal _VarType_Tuple_default_instance_; -} // namespace proto -} // namespace framework + namespace framework { + namespace proto { + class BlockDesc; + class BlockDescDefaultTypeInternal; + extern BlockDescDefaultTypeInternal _BlockDesc_default_instance_; + class OpDesc; + class OpDescDefaultTypeInternal; + extern OpDescDefaultTypeInternal _OpDesc_default_instance_; + class OpDesc_Attr; + class OpDesc_AttrDefaultTypeInternal; + extern OpDesc_AttrDefaultTypeInternal + _OpDesc_Attr_default_instance_; + class OpDesc_Var; + class OpDesc_VarDefaultTypeInternal; + extern OpDesc_VarDefaultTypeInternal _OpDesc_Var_default_instance_; + class OpProto; + class OpProtoDefaultTypeInternal; + extern OpProtoDefaultTypeInternal _OpProto_default_instance_; + class OpProto_Attr; + class OpProto_AttrDefaultTypeInternal; + extern OpProto_AttrDefaultTypeInternal + _OpProto_Attr_default_instance_; + class OpProto_Var; + class OpProto_VarDefaultTypeInternal; + extern OpProto_VarDefaultTypeInternal + _OpProto_Var_default_instance_; + class ProgramDesc; + class ProgramDescDefaultTypeInternal; + extern ProgramDescDefaultTypeInternal + _ProgramDesc_default_instance_; + class VarDesc; + class VarDescDefaultTypeInternal; + extern VarDescDefaultTypeInternal _VarDesc_default_instance_; + class VarType; + class VarTypeDefaultTypeInternal; + extern VarTypeDefaultTypeInternal _VarType_default_instance_; + class VarType_ChannelDesc; + class VarType_ChannelDescDefaultTypeInternal; + extern VarType_ChannelDescDefaultTypeInternal + _VarType_ChannelDesc_default_instance_; + class VarType_LoDTensorArrayDesc; + class VarType_LoDTensorArrayDescDefaultTypeInternal; + extern VarType_LoDTensorArrayDescDefaultTypeInternal + _VarType_LoDTensorArrayDesc_default_instance_; + class VarType_LoDTensorDesc; + class VarType_LoDTensorDescDefaultTypeInternal; + extern VarType_LoDTensorDescDefaultTypeInternal + _VarType_LoDTensorDesc_default_instance_; + class VarType_ReaderDesc; + class VarType_ReaderDescDefaultTypeInternal; + extern VarType_ReaderDescDefaultTypeInternal + _VarType_ReaderDesc_default_instance_; + class VarType_TensorDesc; + class VarType_TensorDescDefaultTypeInternal; + extern VarType_TensorDescDefaultTypeInternal + _VarType_TensorDesc_default_instance_; + class VarType_Tuple; + class VarType_TupleDefaultTypeInternal; + extern VarType_TupleDefaultTypeInternal + _VarType_Tuple_default_instance_; + } // namespace proto + } // namespace framework } // namespace paddle_mobile namespace paddle_mobile { -namespace framework { -namespace proto { - -namespace protobuf_framework_2eproto { -// Internal implementation detail -- do not call these. -struct TableStruct { - static const ::google::protobuf::internal::ParseTableField entries[]; - static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; - static const ::google::protobuf::internal::FieldMetadata field_metadata[]; - static const ::google::protobuf::internal::SerializationTable - serialization_table[]; - static void InitDefaultsImpl(); -}; -void AddDescriptors(); -void InitDefaults(); -} // namespace protobuf_framework_2eproto - -enum VarType_Type { - VarType_Type_BOOL = 0, - VarType_Type_INT16 = 1, - VarType_Type_INT32 = 2, - VarType_Type_INT64 = 3, - VarType_Type_FP16 = 4, - VarType_Type_FP32 = 5, - VarType_Type_FP64 = 6, - VarType_Type_LOD_TENSOR = 7, - VarType_Type_SELECTED_ROWS = 8, - VarType_Type_FEED_MINIBATCH = 9, - VarType_Type_FETCH_LIST = 10, - VarType_Type_STEP_SCOPES = 11, - VarType_Type_LOD_RANK_TABLE = 12, - VarType_Type_LOD_TENSOR_ARRAY = 13, - VarType_Type_PLACE_LIST = 14, - VarType_Type_READER = 15, - VarType_Type_CHANNEL = 16, - VarType_Type_RAW = 17, - VarType_Type_TUPLE = 18 -}; -bool VarType_Type_IsValid(int value); -const VarType_Type VarType_Type_Type_MIN = VarType_Type_BOOL; -const VarType_Type VarType_Type_Type_MAX = VarType_Type_TUPLE; -const int VarType_Type_Type_ARRAYSIZE = VarType_Type_Type_MAX + 1; - -enum AttrType { - INT = 0, - FLOAT = 1, - STRING = 2, - INTS = 3, - FLOATS = 4, - STRINGS = 5, - BOOLEAN = 6, - BOOLEANS = 7, - BLOCK = 8, - LONG = 9 -}; -bool AttrType_IsValid(int value); -const AttrType AttrType_MIN = INT; -const AttrType AttrType_MAX = LONG; -const int AttrType_ARRAYSIZE = AttrType_MAX + 1; - -// =================================================================== - -class OpDesc_Attr - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpDesc.Attr) - */ -{ -public: - OpDesc_Attr(); - virtual ~OpDesc_Attr(); - - OpDesc_Attr(const OpDesc_Attr &from); - - inline OpDesc_Attr &operator=(const OpDesc_Attr &from) { - CopyFrom(from); - return *this; - } + namespace framework { + namespace proto { + + namespace protobuf_framework_2eproto { + // Internal implementation detail -- do not call these. + struct TableStruct { + static const ::google::protobuf::internal::ParseTableField + entries[]; + static const ::google::protobuf::internal:: + AuxillaryParseTableField aux[]; + static const ::google::protobuf::internal::ParseTable + schema[]; + static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::FieldMetadata + field_metadata[]; + static const ::google::protobuf::internal:: + SerializationTable serialization_table[]; + static void InitDefaultsImpl(); + }; + void AddDescriptors(); + void InitDefaults(); + } // namespace protobuf_framework_2eproto + + enum VarType_Type { + VarType_Type_BOOL = 0, + VarType_Type_INT16 = 1, + VarType_Type_INT32 = 2, + VarType_Type_INT64 = 3, + VarType_Type_FP16 = 4, + VarType_Type_FP32 = 5, + VarType_Type_FP64 = 6, + VarType_Type_LOD_TENSOR = 7, + VarType_Type_SELECTED_ROWS = 8, + VarType_Type_FEED_MINIBATCH = 9, + VarType_Type_FETCH_LIST = 10, + VarType_Type_STEP_SCOPES = 11, + VarType_Type_LOD_RANK_TABLE = 12, + VarType_Type_LOD_TENSOR_ARRAY = 13, + VarType_Type_PLACE_LIST = 14, + VarType_Type_READER = 15, + VarType_Type_CHANNEL = 16, + VarType_Type_RAW = 17, + VarType_Type_TUPLE = 18 + }; + bool VarType_Type_IsValid(int value); + const VarType_Type VarType_Type_Type_MIN = VarType_Type_BOOL; + const VarType_Type VarType_Type_Type_MAX = VarType_Type_TUPLE; + const int VarType_Type_Type_ARRAYSIZE = VarType_Type_Type_MAX + 1; + + enum AttrType { + INT = 0, + FLOAT = 1, + STRING = 2, + INTS = 3, + FLOATS = 4, + STRINGS = 5, + BOOLEAN = 6, + BOOLEANS = 7, + BLOCK = 8, + LONG = 9 + }; + bool AttrType_IsValid(int value); + const AttrType AttrType_MIN = INT; + const AttrType AttrType_MAX = LONG; + const int AttrType_ARRAYSIZE = AttrType_MAX + 1; + + // =================================================================== + + class OpDesc_Attr + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpDesc.Attr) + */ + { + public: + OpDesc_Attr(); + virtual ~OpDesc_Attr(); + + OpDesc_Attr(const OpDesc_Attr &from); + + inline OpDesc_Attr &operator=(const OpDesc_Attr &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - OpDesc_Attr(OpDesc_Attr &&from) noexcept : OpDesc_Attr() { - *this = ::std::move(from); - } - - inline OpDesc_Attr &operator=(OpDesc_Attr &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + OpDesc_Attr(OpDesc_Attr &&from) noexcept : OpDesc_Attr() { + *this = ::std::move(from); + } + + inline OpDesc_Attr &operator=(OpDesc_Attr &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const OpDesc_Attr &default_instance(); - - static inline const OpDesc_Attr *internal_default_instance() { - return reinterpret_cast( - &_OpDesc_Attr_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 0; - - void Swap(OpDesc_Attr *other); - friend void swap(OpDesc_Attr &a, OpDesc_Attr &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline OpDesc_Attr *New() const PROTOBUF_FINAL { return New(NULL); } - - OpDesc_Attr *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const OpDesc_Attr &from); - void MergeFrom(const OpDesc_Attr &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(OpDesc_Attr *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated int32 ints = 6; - int ints_size() const; - void clear_ints(); - static const int kIntsFieldNumber = 6; - ::google::protobuf::int32 ints(int index) const; - void set_ints(int index, ::google::protobuf::int32 value); - void add_ints(::google::protobuf::int32 value); - const ::google::protobuf::RepeatedField<::google::protobuf::int32> & - ints() const; - ::google::protobuf::RepeatedField<::google::protobuf::int32> *mutable_ints(); - - // repeated float floats = 7; - int floats_size() const; - void clear_floats(); - static const int kFloatsFieldNumber = 7; - float floats(int index) const; - void set_floats(int index, float value); - void add_floats(float value); - const ::google::protobuf::RepeatedField &floats() const; - ::google::protobuf::RepeatedField *mutable_floats(); - - // repeated string strings = 8; - int strings_size() const; - void clear_strings(); - static const int kStringsFieldNumber = 8; - const ::std::string &strings(int index) const; - ::std::string *mutable_strings(int index); - void set_strings(int index, const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const OpDesc_Attr &default_instance(); + + static inline const OpDesc_Attr *internal_default_instance() { + return reinterpret_cast( + &_OpDesc_Attr_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 0; + + void Swap(OpDesc_Attr *other); + friend void swap(OpDesc_Attr &a, OpDesc_Attr &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline OpDesc_Attr *New() const PROTOBUF_FINAL { + return New(NULL); + } + + OpDesc_Attr * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const OpDesc_Attr &from); + void MergeFrom(const OpDesc_Attr &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(OpDesc_Attr *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated int32 ints = 6; + int ints_size() const; + void clear_ints(); + static const int kIntsFieldNumber = 6; + ::google::protobuf::int32 ints(int index) const; + void set_ints(int index, ::google::protobuf::int32 value); + void add_ints(::google::protobuf::int32 value); + const ::google::protobuf::RepeatedField< + ::google::protobuf::int32> & + ints() const; + ::google::protobuf::RepeatedField<::google::protobuf::int32> * + mutable_ints(); + + // repeated float floats = 7; + int floats_size() const; + void clear_floats(); + static const int kFloatsFieldNumber = 7; + float floats(int index) const; + void set_floats(int index, float value); + void add_floats(float value); + const ::google::protobuf::RepeatedField &floats() const; + ::google::protobuf::RepeatedField *mutable_floats(); + + // repeated string strings = 8; + int strings_size() const; + void clear_strings(); + static const int kStringsFieldNumber = 8; + const ::std::string &strings(int index) const; + ::std::string *mutable_strings(int index); + void set_strings(int index, const ::std::string &value); #if LANG_CXX11 - void set_strings(int index, ::std::string &&value); + void set_strings(int index, ::std::string &&value); #endif - void set_strings(int index, const char *value); - void set_strings(int index, const char *value, size_t size); - ::std::string *add_strings(); - void add_strings(const ::std::string &value); + void set_strings(int index, const char *value); + void set_strings(int index, const char *value, size_t size); + ::std::string *add_strings(); + void add_strings(const ::std::string &value); #if LANG_CXX11 - void add_strings(::std::string &&value); + void add_strings(::std::string &&value); #endif - void add_strings(const char *value); - void add_strings(const char *value, size_t size); - const ::google::protobuf::RepeatedPtrField<::std::string> &strings() const; - ::google::protobuf::RepeatedPtrField<::std::string> *mutable_strings(); - - // repeated bool bools = 11; - int bools_size() const; - void clear_bools(); - static const int kBoolsFieldNumber = 11; - bool bools(int index) const; - void set_bools(int index, bool value); - void add_bools(bool value); - const ::google::protobuf::RepeatedField &bools() const; - ::google::protobuf::RepeatedField *mutable_bools(); - - // required string name = 1; - bool has_name() const; - void clear_name(); - static const int kNameFieldNumber = 1; - const ::std::string &name() const; - void set_name(const ::std::string &value); + void add_strings(const char *value); + void add_strings(const char *value, size_t size); + const ::google::protobuf::RepeatedPtrField<::std::string> & + strings() const; + ::google::protobuf::RepeatedPtrField<::std::string> * + mutable_strings(); + + // repeated bool bools = 11; + int bools_size() const; + void clear_bools(); + static const int kBoolsFieldNumber = 11; + bool bools(int index) const; + void set_bools(int index, bool value); + void add_bools(bool value); + const ::google::protobuf::RepeatedField &bools() const; + ::google::protobuf::RepeatedField *mutable_bools(); + + // required string name = 1; + bool has_name() const; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string &name() const; + void set_name(const ::std::string &value); #if LANG_CXX11 - void set_name(::std::string &&value); + void set_name(::std::string &&value); #endif - void set_name(const char *value); - void set_name(const char *value, size_t size); - ::std::string *mutable_name(); - ::std::string *release_name(); - void set_allocated_name(::std::string *name); - - // optional string s = 5; - bool has_s() const; - void clear_s(); - static const int kSFieldNumber = 5; - const ::std::string &s() const; - void set_s(const ::std::string &value); + void set_name(const char *value); + void set_name(const char *value, size_t size); + ::std::string *mutable_name(); + ::std::string *release_name(); + void set_allocated_name(::std::string *name); + + // optional string s = 5; + bool has_s() const; + void clear_s(); + static const int kSFieldNumber = 5; + const ::std::string &s() const; + void set_s(const ::std::string &value); #if LANG_CXX11 - void set_s(::std::string &&value); + void set_s(::std::string &&value); #endif - void set_s(const char *value); - void set_s(const char *value, size_t size); - ::std::string *mutable_s(); - ::std::string *release_s(); - void set_allocated_s(::std::string *s); - - // required .paddle_mobile.framework.proto.AttrType type = 2; - bool has_type() const; - void clear_type(); - static const int kTypeFieldNumber = 2; - ::paddle_mobile::framework::proto::AttrType type() const; - void set_type(::paddle_mobile::framework::proto::AttrType value); - - // optional int32 i = 3; - bool has_i() const; - void clear_i(); - static const int kIFieldNumber = 3; - ::google::protobuf::int32 i() const; - void set_i(::google::protobuf::int32 value); - - // optional float f = 4; - bool has_f() const; - void clear_f(); - static const int kFFieldNumber = 4; - float f() const; - void set_f(float value); - - // optional bool b = 10; - bool has_b() const; - void clear_b(); - static const int kBFieldNumber = 10; - bool b() const; - void set_b(bool value); - - // optional int64 l = 13; - bool has_l() const; - void clear_l(); - static const int kLFieldNumber = 13; - ::google::protobuf::int64 l() const; - void set_l(::google::protobuf::int64 value); - - // optional int32 block_idx = 12; - bool has_block_idx() const; - void clear_block_idx(); - static const int kBlockIdxFieldNumber = 12; - ::google::protobuf::int32 block_idx() const; - void set_block_idx(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpDesc.Attr) -private: - void set_has_name(); - void clear_has_name(); - void set_has_type(); - void clear_has_type(); - void set_has_i(); - void clear_has_i(); - void set_has_f(); - void clear_has_f(); - void set_has_s(); - void clear_has_s(); - void set_has_b(); - void clear_has_b(); - void set_has_block_idx(); - void clear_has_block_idx(); - void set_has_l(); - void clear_has_l(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedField<::google::protobuf::int32> ints_; - ::google::protobuf::RepeatedField floats_; - ::google::protobuf::RepeatedPtrField<::std::string> strings_; - ::google::protobuf::RepeatedField bools_; - ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::internal::ArenaStringPtr s_; - int type_; - ::google::protobuf::int32 i_; - float f_; - bool b_; - ::google::protobuf::int64 l_; - ::google::protobuf::int32 block_idx_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class OpDesc_Var - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpDesc.Var) - */ -{ -public: - OpDesc_Var(); - virtual ~OpDesc_Var(); - - OpDesc_Var(const OpDesc_Var &from); - - inline OpDesc_Var &operator=(const OpDesc_Var &from) { - CopyFrom(from); - return *this; - } + void set_s(const char *value); + void set_s(const char *value, size_t size); + ::std::string *mutable_s(); + ::std::string *release_s(); + void set_allocated_s(::std::string *s); + + // required .paddle_mobile.framework.proto.AttrType type = 2; + bool has_type() const; + void clear_type(); + static const int kTypeFieldNumber = 2; + ::paddle_mobile::framework::proto::AttrType type() const; + void + set_type(::paddle_mobile::framework::proto::AttrType value); + + // optional int32 i = 3; + bool has_i() const; + void clear_i(); + static const int kIFieldNumber = 3; + ::google::protobuf::int32 i() const; + void set_i(::google::protobuf::int32 value); + + // optional float f = 4; + bool has_f() const; + void clear_f(); + static const int kFFieldNumber = 4; + float f() const; + void set_f(float value); + + // optional bool b = 10; + bool has_b() const; + void clear_b(); + static const int kBFieldNumber = 10; + bool b() const; + void set_b(bool value); + + // optional int64 l = 13; + bool has_l() const; + void clear_l(); + static const int kLFieldNumber = 13; + ::google::protobuf::int64 l() const; + void set_l(::google::protobuf::int64 value); + + // optional int32 block_idx = 12; + bool has_block_idx() const; + void clear_block_idx(); + static const int kBlockIdxFieldNumber = 12; + ::google::protobuf::int32 block_idx() const; + void set_block_idx(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpDesc.Attr) + private: + void set_has_name(); + void clear_has_name(); + void set_has_type(); + void clear_has_type(); + void set_has_i(); + void clear_has_i(); + void set_has_f(); + void clear_has_f(); + void set_has_s(); + void clear_has_s(); + void set_has_b(); + void clear_has_b(); + void set_has_block_idx(); + void clear_has_block_idx(); + void set_has_l(); + void clear_has_l(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedField<::google::protobuf::int32> + ints_; + ::google::protobuf::RepeatedField floats_; + ::google::protobuf::RepeatedPtrField<::std::string> strings_; + ::google::protobuf::RepeatedField bools_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::internal::ArenaStringPtr s_; + int type_; + ::google::protobuf::int32 i_; + float f_; + bool b_; + ::google::protobuf::int64 l_; + ::google::protobuf::int32 block_idx_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class OpDesc_Var + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpDesc.Var) + */ + { + public: + OpDesc_Var(); + virtual ~OpDesc_Var(); + + OpDesc_Var(const OpDesc_Var &from); + + inline OpDesc_Var &operator=(const OpDesc_Var &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - OpDesc_Var(OpDesc_Var &&from) noexcept : OpDesc_Var() { - *this = ::std::move(from); - } - - inline OpDesc_Var &operator=(OpDesc_Var &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + OpDesc_Var(OpDesc_Var &&from) noexcept : OpDesc_Var() { + *this = ::std::move(from); + } + + inline OpDesc_Var &operator=(OpDesc_Var &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const OpDesc_Var &default_instance(); - - static inline const OpDesc_Var *internal_default_instance() { - return reinterpret_cast(&_OpDesc_Var_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 1; - - void Swap(OpDesc_Var *other); - friend void swap(OpDesc_Var &a, OpDesc_Var &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline OpDesc_Var *New() const PROTOBUF_FINAL { return New(NULL); } - - OpDesc_Var *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const OpDesc_Var &from); - void MergeFrom(const OpDesc_Var &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(OpDesc_Var *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated string arguments = 2; - int arguments_size() const; - void clear_arguments(); - static const int kArgumentsFieldNumber = 2; - const ::std::string &arguments(int index) const; - ::std::string *mutable_arguments(int index); - void set_arguments(int index, const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const OpDesc_Var &default_instance(); + + static inline const OpDesc_Var *internal_default_instance() { + return reinterpret_cast( + &_OpDesc_Var_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 1; + + void Swap(OpDesc_Var *other); + friend void swap(OpDesc_Var &a, OpDesc_Var &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline OpDesc_Var *New() const PROTOBUF_FINAL { + return New(NULL); + } + + OpDesc_Var * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const OpDesc_Var &from); + void MergeFrom(const OpDesc_Var &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(OpDesc_Var *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated string arguments = 2; + int arguments_size() const; + void clear_arguments(); + static const int kArgumentsFieldNumber = 2; + const ::std::string &arguments(int index) const; + ::std::string *mutable_arguments(int index); + void set_arguments(int index, const ::std::string &value); #if LANG_CXX11 - void set_arguments(int index, ::std::string &&value); + void set_arguments(int index, ::std::string &&value); #endif - void set_arguments(int index, const char *value); - void set_arguments(int index, const char *value, size_t size); - ::std::string *add_arguments(); - void add_arguments(const ::std::string &value); + void set_arguments(int index, const char *value); + void set_arguments(int index, const char *value, size_t size); + ::std::string *add_arguments(); + void add_arguments(const ::std::string &value); #if LANG_CXX11 - void add_arguments(::std::string &&value); + void add_arguments(::std::string &&value); #endif - void add_arguments(const char *value); - void add_arguments(const char *value, size_t size); - const ::google::protobuf::RepeatedPtrField<::std::string> &arguments() const; - ::google::protobuf::RepeatedPtrField<::std::string> *mutable_arguments(); - - // required string parameter = 1; - bool has_parameter() const; - void clear_parameter(); - static const int kParameterFieldNumber = 1; - const ::std::string ¶meter() const; - void set_parameter(const ::std::string &value); + void add_arguments(const char *value); + void add_arguments(const char *value, size_t size); + const ::google::protobuf::RepeatedPtrField<::std::string> & + arguments() const; + ::google::protobuf::RepeatedPtrField<::std::string> * + mutable_arguments(); + + // required string parameter = 1; + bool has_parameter() const; + void clear_parameter(); + static const int kParameterFieldNumber = 1; + const ::std::string ¶meter() const; + void set_parameter(const ::std::string &value); #if LANG_CXX11 - void set_parameter(::std::string &&value); + void set_parameter(::std::string &&value); #endif - void set_parameter(const char *value); - void set_parameter(const char *value, size_t size); - ::std::string *mutable_parameter(); - ::std::string *release_parameter(); - void set_allocated_parameter(::std::string *parameter); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpDesc.Var) -private: - void set_has_parameter(); - void clear_has_parameter(); - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField<::std::string> arguments_; - ::google::protobuf::internal::ArenaStringPtr parameter_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class OpDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpDesc) - */ -{ -public: - OpDesc(); - virtual ~OpDesc(); - - OpDesc(const OpDesc &from); - - inline OpDesc &operator=(const OpDesc &from) { - CopyFrom(from); - return *this; - } + void set_parameter(const char *value); + void set_parameter(const char *value, size_t size); + ::std::string *mutable_parameter(); + ::std::string *release_parameter(); + void set_allocated_parameter(::std::string *parameter); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpDesc.Var) + private: + void set_has_parameter(); + void clear_has_parameter(); + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField<::std::string> arguments_; + ::google::protobuf::internal::ArenaStringPtr parameter_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class OpDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpDesc) + */ + { + public: + OpDesc(); + virtual ~OpDesc(); + + OpDesc(const OpDesc &from); + + inline OpDesc &operator=(const OpDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - OpDesc(OpDesc &&from) noexcept : OpDesc() { *this = ::std::move(from); } - - inline OpDesc &operator=(OpDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + OpDesc(OpDesc &&from) noexcept : OpDesc() { + *this = ::std::move(from); + } + + inline OpDesc &operator=(OpDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const OpDesc &default_instance(); - - static inline const OpDesc *internal_default_instance() { - return reinterpret_cast(&_OpDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 2; - - void Swap(OpDesc *other); - friend void swap(OpDesc &a, OpDesc &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline OpDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - OpDesc *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const OpDesc &from); - void MergeFrom(const OpDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(OpDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - typedef OpDesc_Attr Attr; - typedef OpDesc_Var Var; - - // accessors ------------------------------------------------------- - - // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; - int inputs_size() const; - void clear_inputs(); - static const int kInputsFieldNumber = 1; - const ::paddle_mobile::framework::proto::OpDesc_Var &inputs(int index) const; - ::paddle_mobile::framework::proto::OpDesc_Var *mutable_inputs(int index); - ::paddle_mobile::framework::proto::OpDesc_Var *add_inputs(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> * - mutable_inputs(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> & - inputs() const; - - // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; - int outputs_size() const; - void clear_outputs(); - static const int kOutputsFieldNumber = 2; - const ::paddle_mobile::framework::proto::OpDesc_Var &outputs(int index) const; - ::paddle_mobile::framework::proto::OpDesc_Var *mutable_outputs(int index); - ::paddle_mobile::framework::proto::OpDesc_Var *add_outputs(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> * - mutable_outputs(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> & - outputs() const; - - // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; - int attrs_size() const; - void clear_attrs(); - static const int kAttrsFieldNumber = 4; - const ::paddle_mobile::framework::proto::OpDesc_Attr &attrs(int index) const; - ::paddle_mobile::framework::proto::OpDesc_Attr *mutable_attrs(int index); - ::paddle_mobile::framework::proto::OpDesc_Attr *add_attrs(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> * - mutable_attrs(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> & - attrs() const; - - // required string type = 3; - bool has_type() const; - void clear_type(); - static const int kTypeFieldNumber = 3; - const ::std::string &type() const; - void set_type(const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const OpDesc &default_instance(); + + static inline const OpDesc *internal_default_instance() { + return reinterpret_cast( + &_OpDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 2; + + void Swap(OpDesc *other); + friend void swap(OpDesc &a, OpDesc &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline OpDesc *New() const PROTOBUF_FINAL { return New(NULL); } + + OpDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const OpDesc &from); + void MergeFrom(const OpDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(OpDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + typedef OpDesc_Attr Attr; + typedef OpDesc_Var Var; + + // accessors + // ------------------------------------------------------- + + // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = + // 1; + int inputs_size() const; + void clear_inputs(); + static const int kInputsFieldNumber = 1; + const ::paddle_mobile::framework::proto::OpDesc_Var & + inputs(int index) const; + ::paddle_mobile::framework::proto::OpDesc_Var * + mutable_inputs(int index); + ::paddle_mobile::framework::proto::OpDesc_Var *add_inputs(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> * + mutable_inputs(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> & + inputs() const; + + // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = + // 2; + int outputs_size() const; + void clear_outputs(); + static const int kOutputsFieldNumber = 2; + const ::paddle_mobile::framework::proto::OpDesc_Var & + outputs(int index) const; + ::paddle_mobile::framework::proto::OpDesc_Var * + mutable_outputs(int index); + ::paddle_mobile::framework::proto::OpDesc_Var *add_outputs(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> * + mutable_outputs(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> & + outputs() const; + + // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = + // 4; + int attrs_size() const; + void clear_attrs(); + static const int kAttrsFieldNumber = 4; + const ::paddle_mobile::framework::proto::OpDesc_Attr & + attrs(int index) const; + ::paddle_mobile::framework::proto::OpDesc_Attr * + mutable_attrs(int index); + ::paddle_mobile::framework::proto::OpDesc_Attr *add_attrs(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> * + mutable_attrs(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> & + attrs() const; + + // required string type = 3; + bool has_type() const; + void clear_type(); + static const int kTypeFieldNumber = 3; + const ::std::string &type() const; + void set_type(const ::std::string &value); #if LANG_CXX11 - void set_type(::std::string &&value); + void set_type(::std::string &&value); #endif - void set_type(const char *value); - void set_type(const char *value, size_t size); - ::std::string *mutable_type(); - ::std::string *release_type(); - void set_allocated_type(::std::string *type); - - // optional bool is_target = 5 [default = false]; - bool has_is_target() const; - void clear_is_target(); - static const int kIsTargetFieldNumber = 5; - bool is_target() const; - void set_is_target(bool value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpDesc) -private: - void set_has_type(); - void clear_has_type(); - void set_has_is_target(); - void clear_has_is_target(); - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> - inputs_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> - outputs_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> - attrs_; - ::google::protobuf::internal::ArenaStringPtr type_; - bool is_target_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class OpProto_Var - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpProto.Var) - */ -{ -public: - OpProto_Var(); - virtual ~OpProto_Var(); - - OpProto_Var(const OpProto_Var &from); - - inline OpProto_Var &operator=(const OpProto_Var &from) { - CopyFrom(from); - return *this; - } + void set_type(const char *value); + void set_type(const char *value, size_t size); + ::std::string *mutable_type(); + ::std::string *release_type(); + void set_allocated_type(::std::string *type); + + // optional bool is_target = 5 [default = false]; + bool has_is_target() const; + void clear_is_target(); + static const int kIsTargetFieldNumber = 5; + bool is_target() const; + void set_is_target(bool value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpDesc) + private: + void set_has_type(); + void clear_has_type(); + void set_has_is_target(); + void clear_has_is_target(); + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> + inputs_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> + outputs_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> + attrs_; + ::google::protobuf::internal::ArenaStringPtr type_; + bool is_target_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class OpProto_Var + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpProto.Var) + */ + { + public: + OpProto_Var(); + virtual ~OpProto_Var(); + + OpProto_Var(const OpProto_Var &from); + + inline OpProto_Var &operator=(const OpProto_Var &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - OpProto_Var(OpProto_Var &&from) noexcept : OpProto_Var() { - *this = ::std::move(from); - } - - inline OpProto_Var &operator=(OpProto_Var &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + OpProto_Var(OpProto_Var &&from) noexcept : OpProto_Var() { + *this = ::std::move(from); + } + + inline OpProto_Var &operator=(OpProto_Var &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const OpProto_Var &default_instance(); - - static inline const OpProto_Var *internal_default_instance() { - return reinterpret_cast( - &_OpProto_Var_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 3; - - void Swap(OpProto_Var *other); - friend void swap(OpProto_Var &a, OpProto_Var &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline OpProto_Var *New() const PROTOBUF_FINAL { return New(NULL); } - - OpProto_Var *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const OpProto_Var &from); - void MergeFrom(const OpProto_Var &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(OpProto_Var *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required string name = 1; - bool has_name() const; - void clear_name(); - static const int kNameFieldNumber = 1; - const ::std::string &name() const; - void set_name(const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const OpProto_Var &default_instance(); + + static inline const OpProto_Var *internal_default_instance() { + return reinterpret_cast( + &_OpProto_Var_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 3; + + void Swap(OpProto_Var *other); + friend void swap(OpProto_Var &a, OpProto_Var &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline OpProto_Var *New() const PROTOBUF_FINAL { + return New(NULL); + } + + OpProto_Var * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const OpProto_Var &from); + void MergeFrom(const OpProto_Var &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(OpProto_Var *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // required string name = 1; + bool has_name() const; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string &name() const; + void set_name(const ::std::string &value); #if LANG_CXX11 - void set_name(::std::string &&value); + void set_name(::std::string &&value); #endif - void set_name(const char *value); - void set_name(const char *value, size_t size); - ::std::string *mutable_name(); - ::std::string *release_name(); - void set_allocated_name(::std::string *name); - - // required string comment = 2; - bool has_comment() const; - void clear_comment(); - static const int kCommentFieldNumber = 2; - const ::std::string &comment() const; - void set_comment(const ::std::string &value); + void set_name(const char *value); + void set_name(const char *value, size_t size); + ::std::string *mutable_name(); + ::std::string *release_name(); + void set_allocated_name(::std::string *name); + + // required string comment = 2; + bool has_comment() const; + void clear_comment(); + static const int kCommentFieldNumber = 2; + const ::std::string &comment() const; + void set_comment(const ::std::string &value); #if LANG_CXX11 - void set_comment(::std::string &&value); + void set_comment(::std::string &&value); #endif - void set_comment(const char *value); - void set_comment(const char *value, size_t size); - ::std::string *mutable_comment(); - ::std::string *release_comment(); - void set_allocated_comment(::std::string *comment); - - // optional bool duplicable = 3 [default = false]; - bool has_duplicable() const; - void clear_duplicable(); - static const int kDuplicableFieldNumber = 3; - bool duplicable() const; - void set_duplicable(bool value); - - // optional bool intermediate = 4 [default = false]; - bool has_intermediate() const; - void clear_intermediate(); - static const int kIntermediateFieldNumber = 4; - bool intermediate() const; - void set_intermediate(bool value); - - // optional bool dispensable = 5 [default = false]; - bool has_dispensable() const; - void clear_dispensable(); - static const int kDispensableFieldNumber = 5; - bool dispensable() const; - void set_dispensable(bool value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpProto.Var) -private: - void set_has_name(); - void clear_has_name(); - void set_has_comment(); - void clear_has_comment(); - void set_has_duplicable(); - void clear_has_duplicable(); - void set_has_intermediate(); - void clear_has_intermediate(); - void set_has_dispensable(); - void clear_has_dispensable(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::internal::ArenaStringPtr comment_; - bool duplicable_; - bool intermediate_; - bool dispensable_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class OpProto_Attr - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpProto.Attr) - */ -{ -public: - OpProto_Attr(); - virtual ~OpProto_Attr(); - - OpProto_Attr(const OpProto_Attr &from); - - inline OpProto_Attr &operator=(const OpProto_Attr &from) { - CopyFrom(from); - return *this; - } + void set_comment(const char *value); + void set_comment(const char *value, size_t size); + ::std::string *mutable_comment(); + ::std::string *release_comment(); + void set_allocated_comment(::std::string *comment); + + // optional bool duplicable = 3 [default = false]; + bool has_duplicable() const; + void clear_duplicable(); + static const int kDuplicableFieldNumber = 3; + bool duplicable() const; + void set_duplicable(bool value); + + // optional bool intermediate = 4 [default = false]; + bool has_intermediate() const; + void clear_intermediate(); + static const int kIntermediateFieldNumber = 4; + bool intermediate() const; + void set_intermediate(bool value); + + // optional bool dispensable = 5 [default = false]; + bool has_dispensable() const; + void clear_dispensable(); + static const int kDispensableFieldNumber = 5; + bool dispensable() const; + void set_dispensable(bool value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpProto.Var) + private: + void set_has_name(); + void clear_has_name(); + void set_has_comment(); + void clear_has_comment(); + void set_has_duplicable(); + void clear_has_duplicable(); + void set_has_intermediate(); + void clear_has_intermediate(); + void set_has_dispensable(); + void clear_has_dispensable(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::internal::ArenaStringPtr comment_; + bool duplicable_; + bool intermediate_; + bool dispensable_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class OpProto_Attr + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpProto.Attr) + */ + { + public: + OpProto_Attr(); + virtual ~OpProto_Attr(); + + OpProto_Attr(const OpProto_Attr &from); + + inline OpProto_Attr &operator=(const OpProto_Attr &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - OpProto_Attr(OpProto_Attr &&from) noexcept : OpProto_Attr() { - *this = ::std::move(from); - } - - inline OpProto_Attr &operator=(OpProto_Attr &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + OpProto_Attr(OpProto_Attr &&from) noexcept : OpProto_Attr() { + *this = ::std::move(from); + } + + inline OpProto_Attr &operator=(OpProto_Attr &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const OpProto_Attr &default_instance(); - - static inline const OpProto_Attr *internal_default_instance() { - return reinterpret_cast( - &_OpProto_Attr_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 4; - - void Swap(OpProto_Attr *other); - friend void swap(OpProto_Attr &a, OpProto_Attr &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline OpProto_Attr *New() const PROTOBUF_FINAL { return New(NULL); } - - OpProto_Attr *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const OpProto_Attr &from); - void MergeFrom(const OpProto_Attr &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(OpProto_Attr *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required string name = 1; - bool has_name() const; - void clear_name(); - static const int kNameFieldNumber = 1; - const ::std::string &name() const; - void set_name(const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const OpProto_Attr &default_instance(); + + static inline const OpProto_Attr *internal_default_instance() { + return reinterpret_cast( + &_OpProto_Attr_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 4; + + void Swap(OpProto_Attr *other); + friend void swap(OpProto_Attr &a, OpProto_Attr &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline OpProto_Attr *New() const PROTOBUF_FINAL { + return New(NULL); + } + + OpProto_Attr * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const OpProto_Attr &from); + void MergeFrom(const OpProto_Attr &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(OpProto_Attr *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // required string name = 1; + bool has_name() const; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string &name() const; + void set_name(const ::std::string &value); #if LANG_CXX11 - void set_name(::std::string &&value); + void set_name(::std::string &&value); #endif - void set_name(const char *value); - void set_name(const char *value, size_t size); - ::std::string *mutable_name(); - ::std::string *release_name(); - void set_allocated_name(::std::string *name); - - // required string comment = 3; - bool has_comment() const; - void clear_comment(); - static const int kCommentFieldNumber = 3; - const ::std::string &comment() const; - void set_comment(const ::std::string &value); + void set_name(const char *value); + void set_name(const char *value, size_t size); + ::std::string *mutable_name(); + ::std::string *release_name(); + void set_allocated_name(::std::string *name); + + // required string comment = 3; + bool has_comment() const; + void clear_comment(); + static const int kCommentFieldNumber = 3; + const ::std::string &comment() const; + void set_comment(const ::std::string &value); #if LANG_CXX11 - void set_comment(::std::string &&value); + void set_comment(::std::string &&value); #endif - void set_comment(const char *value); - void set_comment(const char *value, size_t size); - ::std::string *mutable_comment(); - ::std::string *release_comment(); - void set_allocated_comment(::std::string *comment); - - // required .paddle_mobile.framework.proto.AttrType type = 2; - bool has_type() const; - void clear_type(); - static const int kTypeFieldNumber = 2; - ::paddle_mobile::framework::proto::AttrType type() const; - void set_type(::paddle_mobile::framework::proto::AttrType value); - - // optional bool generated = 4 [default = false]; - bool has_generated() const; - void clear_generated(); - static const int kGeneratedFieldNumber = 4; - bool generated() const; - void set_generated(bool value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpProto.Attr) -private: - void set_has_name(); - void clear_has_name(); - void set_has_type(); - void clear_has_type(); - void set_has_comment(); - void clear_has_comment(); - void set_has_generated(); - void clear_has_generated(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::internal::ArenaStringPtr name_; - ::google::protobuf::internal::ArenaStringPtr comment_; - int type_; - bool generated_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class OpProto - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpProto) - */ -{ -public: - OpProto(); - virtual ~OpProto(); - - OpProto(const OpProto &from); - - inline OpProto &operator=(const OpProto &from) { - CopyFrom(from); - return *this; - } + void set_comment(const char *value); + void set_comment(const char *value, size_t size); + ::std::string *mutable_comment(); + ::std::string *release_comment(); + void set_allocated_comment(::std::string *comment); + + // required .paddle_mobile.framework.proto.AttrType type = 2; + bool has_type() const; + void clear_type(); + static const int kTypeFieldNumber = 2; + ::paddle_mobile::framework::proto::AttrType type() const; + void + set_type(::paddle_mobile::framework::proto::AttrType value); + + // optional bool generated = 4 [default = false]; + bool has_generated() const; + void clear_generated(); + static const int kGeneratedFieldNumber = 4; + bool generated() const; + void set_generated(bool value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpProto.Attr) + private: + void set_has_name(); + void clear_has_name(); + void set_has_type(); + void clear_has_type(); + void set_has_comment(); + void clear_has_comment(); + void set_has_generated(); + void clear_has_generated(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::internal::ArenaStringPtr comment_; + int type_; + bool generated_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class OpProto + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.OpProto) + */ + { + public: + OpProto(); + virtual ~OpProto(); + + OpProto(const OpProto &from); + + inline OpProto &operator=(const OpProto &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - OpProto(OpProto &&from) noexcept : OpProto() { *this = ::std::move(from); } - - inline OpProto &operator=(OpProto &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + OpProto(OpProto &&from) noexcept : OpProto() { + *this = ::std::move(from); + } + + inline OpProto &operator=(OpProto &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const OpProto &default_instance(); - - static inline const OpProto *internal_default_instance() { - return reinterpret_cast(&_OpProto_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 5; - - void Swap(OpProto *other); - friend void swap(OpProto &a, OpProto &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline OpProto *New() const PROTOBUF_FINAL { return New(NULL); } - - OpProto *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const OpProto &from); - void MergeFrom(const OpProto &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(OpProto *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - typedef OpProto_Var Var; - typedef OpProto_Attr Attr; - - // accessors ------------------------------------------------------- - - // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; - int inputs_size() const; - void clear_inputs(); - static const int kInputsFieldNumber = 2; - const ::paddle_mobile::framework::proto::OpProto_Var &inputs(int index) const; - ::paddle_mobile::framework::proto::OpProto_Var *mutable_inputs(int index); - ::paddle_mobile::framework::proto::OpProto_Var *add_inputs(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> * - mutable_inputs(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> & - inputs() const; - - // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; - int outputs_size() const; - void clear_outputs(); - static const int kOutputsFieldNumber = 3; - const ::paddle_mobile::framework::proto::OpProto_Var & - outputs(int index) const; - ::paddle_mobile::framework::proto::OpProto_Var *mutable_outputs(int index); - ::paddle_mobile::framework::proto::OpProto_Var *add_outputs(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> * - mutable_outputs(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> & - outputs() const; - - // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; - int attrs_size() const; - void clear_attrs(); - static const int kAttrsFieldNumber = 4; - const ::paddle_mobile::framework::proto::OpProto_Attr &attrs(int index) const; - ::paddle_mobile::framework::proto::OpProto_Attr *mutable_attrs(int index); - ::paddle_mobile::framework::proto::OpProto_Attr *add_attrs(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> * - mutable_attrs(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> & - attrs() const; - - // required string type = 1; - bool has_type() const; - void clear_type(); - static const int kTypeFieldNumber = 1; - const ::std::string &type() const; - void set_type(const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const OpProto &default_instance(); + + static inline const OpProto *internal_default_instance() { + return reinterpret_cast( + &_OpProto_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 5; + + void Swap(OpProto *other); + friend void swap(OpProto &a, OpProto &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline OpProto *New() const PROTOBUF_FINAL { return New(NULL); } + + OpProto * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const OpProto &from); + void MergeFrom(const OpProto &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(OpProto *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + typedef OpProto_Var Var; + typedef OpProto_Attr Attr; + + // accessors + // ------------------------------------------------------- + + // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = + // 2; + int inputs_size() const; + void clear_inputs(); + static const int kInputsFieldNumber = 2; + const ::paddle_mobile::framework::proto::OpProto_Var & + inputs(int index) const; + ::paddle_mobile::framework::proto::OpProto_Var * + mutable_inputs(int index); + ::paddle_mobile::framework::proto::OpProto_Var *add_inputs(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> * + mutable_inputs(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> & + inputs() const; + + // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = + // 3; + int outputs_size() const; + void clear_outputs(); + static const int kOutputsFieldNumber = 3; + const ::paddle_mobile::framework::proto::OpProto_Var & + outputs(int index) const; + ::paddle_mobile::framework::proto::OpProto_Var * + mutable_outputs(int index); + ::paddle_mobile::framework::proto::OpProto_Var *add_outputs(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> * + mutable_outputs(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> & + outputs() const; + + // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = + // 4; + int attrs_size() const; + void clear_attrs(); + static const int kAttrsFieldNumber = 4; + const ::paddle_mobile::framework::proto::OpProto_Attr & + attrs(int index) const; + ::paddle_mobile::framework::proto::OpProto_Attr * + mutable_attrs(int index); + ::paddle_mobile::framework::proto::OpProto_Attr *add_attrs(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> * + mutable_attrs(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> & + attrs() const; + + // required string type = 1; + bool has_type() const; + void clear_type(); + static const int kTypeFieldNumber = 1; + const ::std::string &type() const; + void set_type(const ::std::string &value); #if LANG_CXX11 - void set_type(::std::string &&value); + void set_type(::std::string &&value); #endif - void set_type(const char *value); - void set_type(const char *value, size_t size); - ::std::string *mutable_type(); - ::std::string *release_type(); - void set_allocated_type(::std::string *type); - - // required string comment = 5; - bool has_comment() const; - void clear_comment(); - static const int kCommentFieldNumber = 5; - const ::std::string &comment() const; - void set_comment(const ::std::string &value); + void set_type(const char *value); + void set_type(const char *value, size_t size); + ::std::string *mutable_type(); + ::std::string *release_type(); + void set_allocated_type(::std::string *type); + + // required string comment = 5; + bool has_comment() const; + void clear_comment(); + static const int kCommentFieldNumber = 5; + const ::std::string &comment() const; + void set_comment(const ::std::string &value); #if LANG_CXX11 - void set_comment(::std::string &&value); + void set_comment(::std::string &&value); #endif - void set_comment(const char *value); - void set_comment(const char *value, size_t size); - ::std::string *mutable_comment(); - ::std::string *release_comment(); - void set_allocated_comment(::std::string *comment); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpProto) -private: - void set_has_type(); - void clear_has_type(); - void set_has_comment(); - void clear_has_comment(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> - inputs_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> - outputs_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> - attrs_; - ::google::protobuf::internal::ArenaStringPtr type_; - ::google::protobuf::internal::ArenaStringPtr comment_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType_TensorDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.TensorDesc) - */ -{ -public: - VarType_TensorDesc(); - virtual ~VarType_TensorDesc(); - - VarType_TensorDesc(const VarType_TensorDesc &from); - - inline VarType_TensorDesc &operator=(const VarType_TensorDesc &from) { - CopyFrom(from); - return *this; - } + void set_comment(const char *value); + void set_comment(const char *value, size_t size); + ::std::string *mutable_comment(); + ::std::string *release_comment(); + void set_allocated_comment(::std::string *comment); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.OpProto) + private: + void set_has_type(); + void clear_has_type(); + void set_has_comment(); + void clear_has_comment(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> + inputs_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> + outputs_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> + attrs_; + ::google::protobuf::internal::ArenaStringPtr type_; + ::google::protobuf::internal::ArenaStringPtr comment_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType_TensorDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.TensorDesc) + */ + { + public: + VarType_TensorDesc(); + virtual ~VarType_TensorDesc(); + + VarType_TensorDesc(const VarType_TensorDesc &from); + + inline VarType_TensorDesc & + operator=(const VarType_TensorDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType_TensorDesc(VarType_TensorDesc &&from) noexcept - : VarType_TensorDesc() { - *this = ::std::move(from); - } - - inline VarType_TensorDesc &operator=(VarType_TensorDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType_TensorDesc(VarType_TensorDesc &&from) noexcept + : VarType_TensorDesc() { + *this = ::std::move(from); + } + + inline VarType_TensorDesc & + operator=(VarType_TensorDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType_TensorDesc &default_instance(); - - static inline const VarType_TensorDesc *internal_default_instance() { - return reinterpret_cast( - &_VarType_TensorDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 6; - - void Swap(VarType_TensorDesc *other); - friend void swap(VarType_TensorDesc &a, VarType_TensorDesc &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline VarType_TensorDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - VarType_TensorDesc * - New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType_TensorDesc &from); - void MergeFrom(const VarType_TensorDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType_TensorDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated int64 dims = 2; - int dims_size() const; - void clear_dims(); - static const int kDimsFieldNumber = 2; - ::google::protobuf::int64 dims(int index) const; - void set_dims(int index, ::google::protobuf::int64 value); - void add_dims(::google::protobuf::int64 value); - const ::google::protobuf::RepeatedField<::google::protobuf::int64> & - dims() const; - ::google::protobuf::RepeatedField<::google::protobuf::int64> *mutable_dims(); - - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - bool has_data_type() const; - void clear_data_type(); - static const int kDataTypeFieldNumber = 1; - ::paddle_mobile::framework::proto::VarType_Type data_type() const; - void set_data_type(::paddle_mobile::framework::proto::VarType_Type value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.TensorDesc) -private: - void set_has_data_type(); - void clear_has_data_type(); - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedField<::google::protobuf::int64> dims_; - int data_type_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType_LoDTensorDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.LoDTensorDesc) - */ -{ -public: - VarType_LoDTensorDesc(); - virtual ~VarType_LoDTensorDesc(); - - VarType_LoDTensorDesc(const VarType_LoDTensorDesc &from); - - inline VarType_LoDTensorDesc &operator=(const VarType_LoDTensorDesc &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType_TensorDesc &default_instance(); + + static inline const VarType_TensorDesc * + internal_default_instance() { + return reinterpret_cast( + &_VarType_TensorDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 6; + + void Swap(VarType_TensorDesc *other); + friend void swap(VarType_TensorDesc &a, VarType_TensorDesc &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline VarType_TensorDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + VarType_TensorDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType_TensorDesc &from); + void MergeFrom(const VarType_TensorDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType_TensorDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated int64 dims = 2; + int dims_size() const; + void clear_dims(); + static const int kDimsFieldNumber = 2; + ::google::protobuf::int64 dims(int index) const; + void set_dims(int index, ::google::protobuf::int64 value); + void add_dims(::google::protobuf::int64 value); + const ::google::protobuf::RepeatedField< + ::google::protobuf::int64> & + dims() const; + ::google::protobuf::RepeatedField<::google::protobuf::int64> * + mutable_dims(); + + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + bool has_data_type() const; + void clear_data_type(); + static const int kDataTypeFieldNumber = 1; + ::paddle_mobile::framework::proto::VarType_Type + data_type() const; + void set_data_type( + ::paddle_mobile::framework::proto::VarType_Type value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.TensorDesc) + private: + void set_has_data_type(); + void clear_has_data_type(); + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedField<::google::protobuf::int64> + dims_; + int data_type_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType_LoDTensorDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + */ + { + public: + VarType_LoDTensorDesc(); + virtual ~VarType_LoDTensorDesc(); + + VarType_LoDTensorDesc(const VarType_LoDTensorDesc &from); + + inline VarType_LoDTensorDesc & + operator=(const VarType_LoDTensorDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType_LoDTensorDesc(VarType_LoDTensorDesc &&from) noexcept - : VarType_LoDTensorDesc() { - *this = ::std::move(from); - } - - inline VarType_LoDTensorDesc & - operator=(VarType_LoDTensorDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType_LoDTensorDesc(VarType_LoDTensorDesc &&from) noexcept + : VarType_LoDTensorDesc() { + *this = ::std::move(from); + } + + inline VarType_LoDTensorDesc & + operator=(VarType_LoDTensorDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType_LoDTensorDesc &default_instance(); - - static inline const VarType_LoDTensorDesc *internal_default_instance() { - return reinterpret_cast( - &_VarType_LoDTensorDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 7; - - void Swap(VarType_LoDTensorDesc *other); - friend void swap(VarType_LoDTensorDesc &a, VarType_LoDTensorDesc &b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline VarType_LoDTensorDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - VarType_LoDTensorDesc * - New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType_LoDTensorDesc &from); - void MergeFrom(const VarType_LoDTensorDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType_LoDTensorDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - bool has_tensor() const; - void clear_tensor(); - static const int kTensorFieldNumber = 1; - const ::paddle_mobile::framework::proto::VarType_TensorDesc &tensor() const; - ::paddle_mobile::framework::proto::VarType_TensorDesc *mutable_tensor(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *release_tensor(); - void set_allocated_tensor( - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor); - - // optional int32 lod_level = 2 [default = 0]; - bool has_lod_level() const; - void clear_lod_level(); - static const int kLodLevelFieldNumber = 2; - ::google::protobuf::int32 lod_level() const; - void set_lod_level(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.LoDTensorDesc) -private: - void set_has_tensor(); - void clear_has_tensor(); - void set_has_lod_level(); - void clear_has_lod_level(); - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor_; - ::google::protobuf::int32 lod_level_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType_LoDTensorArrayDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) - */ -{ -public: - VarType_LoDTensorArrayDesc(); - virtual ~VarType_LoDTensorArrayDesc(); - - VarType_LoDTensorArrayDesc(const VarType_LoDTensorArrayDesc &from); - - inline VarType_LoDTensorArrayDesc & - operator=(const VarType_LoDTensorArrayDesc &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType_LoDTensorDesc &default_instance(); + + static inline const VarType_LoDTensorDesc * + internal_default_instance() { + return reinterpret_cast( + &_VarType_LoDTensorDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 7; + + void Swap(VarType_LoDTensorDesc *other); + friend void swap(VarType_LoDTensorDesc &a, + VarType_LoDTensorDesc &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline VarType_LoDTensorDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + VarType_LoDTensorDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType_LoDTensorDesc &from); + void MergeFrom(const VarType_LoDTensorDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType_LoDTensorDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // required .paddle_mobile.framework.proto.VarType.TensorDesc + // tensor = 1; + bool has_tensor() const; + void clear_tensor(); + static const int kTensorFieldNumber = 1; + const ::paddle_mobile::framework::proto::VarType_TensorDesc & + tensor() const; + ::paddle_mobile::framework::proto::VarType_TensorDesc * + mutable_tensor(); + ::paddle_mobile::framework::proto::VarType_TensorDesc * + release_tensor(); + void set_allocated_tensor( + ::paddle_mobile::framework::proto::VarType_TensorDesc + *tensor); + + // optional int32 lod_level = 2 [default = 0]; + bool has_lod_level() const; + void clear_lod_level(); + static const int kLodLevelFieldNumber = 2; + ::google::protobuf::int32 lod_level() const; + void set_lod_level(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.LoDTensorDesc) + private: + void set_has_tensor(); + void clear_has_tensor(); + void set_has_lod_level(); + void clear_has_lod_level(); + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor_; + ::google::protobuf::int32 lod_level_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType_LoDTensorArrayDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + */ + { + public: + VarType_LoDTensorArrayDesc(); + virtual ~VarType_LoDTensorArrayDesc(); + + VarType_LoDTensorArrayDesc( + const VarType_LoDTensorArrayDesc &from); + + inline VarType_LoDTensorArrayDesc & + operator=(const VarType_LoDTensorArrayDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType_LoDTensorArrayDesc(VarType_LoDTensorArrayDesc &&from) noexcept - : VarType_LoDTensorArrayDesc() { - *this = ::std::move(from); - } - - inline VarType_LoDTensorArrayDesc & - operator=(VarType_LoDTensorArrayDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType_LoDTensorArrayDesc( + VarType_LoDTensorArrayDesc &&from) noexcept + : VarType_LoDTensorArrayDesc() { + *this = ::std::move(from); + } + + inline VarType_LoDTensorArrayDesc & + operator=(VarType_LoDTensorArrayDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType_LoDTensorArrayDesc &default_instance(); - - static inline const VarType_LoDTensorArrayDesc *internal_default_instance() { - return reinterpret_cast( - &_VarType_LoDTensorArrayDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 8; - - void Swap(VarType_LoDTensorArrayDesc *other); - friend void swap(VarType_LoDTensorArrayDesc &a, - VarType_LoDTensorArrayDesc &b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline VarType_LoDTensorArrayDesc *New() const PROTOBUF_FINAL { - return New(NULL); - } - - VarType_LoDTensorArrayDesc * - New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType_LoDTensorArrayDesc &from); - void MergeFrom(const VarType_LoDTensorArrayDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType_LoDTensorArrayDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; - bool has_tensor() const; - void clear_tensor(); - static const int kTensorFieldNumber = 1; - const ::paddle_mobile::framework::proto::VarType_TensorDesc &tensor() const; - ::paddle_mobile::framework::proto::VarType_TensorDesc *mutable_tensor(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *release_tensor(); - void set_allocated_tensor( - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor); - - // optional int32 lod_level = 2 [default = 0]; - bool has_lod_level() const; - void clear_lod_level(); - static const int kLodLevelFieldNumber = 2; - ::google::protobuf::int32 lod_level() const; - void set_lod_level(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) -private: - void set_has_tensor(); - void clear_has_tensor(); - void set_has_lod_level(); - void clear_has_lod_level(); - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor_; - ::google::protobuf::int32 lod_level_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType_ReaderDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.ReaderDesc) - */ -{ -public: - VarType_ReaderDesc(); - virtual ~VarType_ReaderDesc(); - - VarType_ReaderDesc(const VarType_ReaderDesc &from); - - inline VarType_ReaderDesc &operator=(const VarType_ReaderDesc &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType_LoDTensorArrayDesc &default_instance(); + + static inline const VarType_LoDTensorArrayDesc * + internal_default_instance() { + return reinterpret_cast( + &_VarType_LoDTensorArrayDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 8; + + void Swap(VarType_LoDTensorArrayDesc *other); + friend void swap(VarType_LoDTensorArrayDesc &a, + VarType_LoDTensorArrayDesc &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline VarType_LoDTensorArrayDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + VarType_LoDTensorArrayDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType_LoDTensorArrayDesc &from); + void MergeFrom(const VarType_LoDTensorArrayDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType_LoDTensorArrayDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // required .paddle_mobile.framework.proto.VarType.TensorDesc + // tensor = 1; + bool has_tensor() const; + void clear_tensor(); + static const int kTensorFieldNumber = 1; + const ::paddle_mobile::framework::proto::VarType_TensorDesc & + tensor() const; + ::paddle_mobile::framework::proto::VarType_TensorDesc * + mutable_tensor(); + ::paddle_mobile::framework::proto::VarType_TensorDesc * + release_tensor(); + void set_allocated_tensor( + ::paddle_mobile::framework::proto::VarType_TensorDesc + *tensor); + + // optional int32 lod_level = 2 [default = 0]; + bool has_lod_level() const; + void clear_lod_level(); + static const int kLodLevelFieldNumber = 2; + ::google::protobuf::int32 lod_level() const; + void set_lod_level(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc) + private: + void set_has_tensor(); + void clear_has_tensor(); + void set_has_lod_level(); + void clear_has_lod_level(); + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor_; + ::google::protobuf::int32 lod_level_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType_ReaderDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.ReaderDesc) + */ + { + public: + VarType_ReaderDesc(); + virtual ~VarType_ReaderDesc(); + + VarType_ReaderDesc(const VarType_ReaderDesc &from); + + inline VarType_ReaderDesc & + operator=(const VarType_ReaderDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType_ReaderDesc(VarType_ReaderDesc &&from) noexcept - : VarType_ReaderDesc() { - *this = ::std::move(from); - } - - inline VarType_ReaderDesc &operator=(VarType_ReaderDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType_ReaderDesc(VarType_ReaderDesc &&from) noexcept + : VarType_ReaderDesc() { + *this = ::std::move(from); + } + + inline VarType_ReaderDesc & + operator=(VarType_ReaderDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType_ReaderDesc &default_instance(); - - static inline const VarType_ReaderDesc *internal_default_instance() { - return reinterpret_cast( - &_VarType_ReaderDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 9; - - void Swap(VarType_ReaderDesc *other); - friend void swap(VarType_ReaderDesc &a, VarType_ReaderDesc &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline VarType_ReaderDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - VarType_ReaderDesc * - New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType_ReaderDesc &from); - void MergeFrom(const VarType_ReaderDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType_ReaderDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = - // 1; - int lod_tensor_size() const; - void clear_lod_tensor(); - static const int kLodTensorFieldNumber = 1; - const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & - lod_tensor(int index) const; - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * - mutable_lod_tensor(int index); - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *add_lod_tensor(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> * - mutable_lod_tensor(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> & - lod_tensor() const; - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.ReaderDesc) -private: - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> - lod_tensor_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType_ChannelDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.ChannelDesc) - */ -{ -public: - VarType_ChannelDesc(); - virtual ~VarType_ChannelDesc(); - - VarType_ChannelDesc(const VarType_ChannelDesc &from); - - inline VarType_ChannelDesc &operator=(const VarType_ChannelDesc &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType_ReaderDesc &default_instance(); + + static inline const VarType_ReaderDesc * + internal_default_instance() { + return reinterpret_cast( + &_VarType_ReaderDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 9; + + void Swap(VarType_ReaderDesc *other); + friend void swap(VarType_ReaderDesc &a, VarType_ReaderDesc &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline VarType_ReaderDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + VarType_ReaderDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType_ReaderDesc &from); + void MergeFrom(const VarType_ReaderDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType_ReaderDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = + // 1; + int lod_tensor_size() const; + void clear_lod_tensor(); + static const int kLodTensorFieldNumber = 1; + const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & + lod_tensor(int index) const; + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + mutable_lod_tensor(int index); + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + add_lod_tensor(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> * + mutable_lod_tensor(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> & + lod_tensor() const; + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.ReaderDesc) + private: + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> + lod_tensor_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType_ChannelDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.ChannelDesc) + */ + { + public: + VarType_ChannelDesc(); + virtual ~VarType_ChannelDesc(); + + VarType_ChannelDesc(const VarType_ChannelDesc &from); + + inline VarType_ChannelDesc & + operator=(const VarType_ChannelDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType_ChannelDesc(VarType_ChannelDesc &&from) noexcept - : VarType_ChannelDesc() { - *this = ::std::move(from); - } - - inline VarType_ChannelDesc &operator=(VarType_ChannelDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType_ChannelDesc(VarType_ChannelDesc &&from) noexcept + : VarType_ChannelDesc() { + *this = ::std::move(from); + } + + inline VarType_ChannelDesc & + operator=(VarType_ChannelDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType_ChannelDesc &default_instance(); - - static inline const VarType_ChannelDesc *internal_default_instance() { - return reinterpret_cast( - &_VarType_ChannelDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 10; - - void Swap(VarType_ChannelDesc *other); - friend void swap(VarType_ChannelDesc &a, VarType_ChannelDesc &b) { - a.Swap(&b); - } - - // implements Message ---------------------------------------------- - - inline VarType_ChannelDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - VarType_ChannelDesc * - New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType_ChannelDesc &from); - void MergeFrom(const VarType_ChannelDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType_ChannelDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required int64 capacity = 2; - bool has_capacity() const; - void clear_capacity(); - static const int kCapacityFieldNumber = 2; - ::google::protobuf::int64 capacity() const; - void set_capacity(::google::protobuf::int64 value); - - // required .paddle_mobile.framework.proto.VarType.Type data_type = 1; - bool has_data_type() const; - void clear_data_type(); - static const int kDataTypeFieldNumber = 1; - ::paddle_mobile::framework::proto::VarType_Type data_type() const; - void set_data_type(::paddle_mobile::framework::proto::VarType_Type value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.ChannelDesc) -private: - void set_has_data_type(); - void clear_has_data_type(); - void set_has_capacity(); - void clear_has_capacity(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::int64 capacity_; - int data_type_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType_Tuple - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.Tuple) - */ -{ -public: - VarType_Tuple(); - virtual ~VarType_Tuple(); - - VarType_Tuple(const VarType_Tuple &from); - - inline VarType_Tuple &operator=(const VarType_Tuple &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType_ChannelDesc &default_instance(); + + static inline const VarType_ChannelDesc * + internal_default_instance() { + return reinterpret_cast( + &_VarType_ChannelDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 10; + + void Swap(VarType_ChannelDesc *other); + friend void swap(VarType_ChannelDesc &a, + VarType_ChannelDesc &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline VarType_ChannelDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + VarType_ChannelDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType_ChannelDesc &from); + void MergeFrom(const VarType_ChannelDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType_ChannelDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // required int64 capacity = 2; + bool has_capacity() const; + void clear_capacity(); + static const int kCapacityFieldNumber = 2; + ::google::protobuf::int64 capacity() const; + void set_capacity(::google::protobuf::int64 value); + + // required .paddle_mobile.framework.proto.VarType.Type + // data_type = 1; + bool has_data_type() const; + void clear_data_type(); + static const int kDataTypeFieldNumber = 1; + ::paddle_mobile::framework::proto::VarType_Type + data_type() const; + void set_data_type( + ::paddle_mobile::framework::proto::VarType_Type value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.ChannelDesc) + private: + void set_has_data_type(); + void clear_has_data_type(); + void set_has_capacity(); + void clear_has_capacity(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::int64 capacity_; + int data_type_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType_Tuple + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType.Tuple) + */ + { + public: + VarType_Tuple(); + virtual ~VarType_Tuple(); + + VarType_Tuple(const VarType_Tuple &from); + + inline VarType_Tuple &operator=(const VarType_Tuple &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType_Tuple(VarType_Tuple &&from) noexcept : VarType_Tuple() { - *this = ::std::move(from); - } - - inline VarType_Tuple &operator=(VarType_Tuple &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType_Tuple(VarType_Tuple &&from) noexcept : VarType_Tuple() { + *this = ::std::move(from); + } + + inline VarType_Tuple &operator=(VarType_Tuple &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType_Tuple &default_instance(); - - static inline const VarType_Tuple *internal_default_instance() { - return reinterpret_cast( - &_VarType_Tuple_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 11; - - void Swap(VarType_Tuple *other); - friend void swap(VarType_Tuple &a, VarType_Tuple &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline VarType_Tuple *New() const PROTOBUF_FINAL { return New(NULL); } - - VarType_Tuple *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType_Tuple &from); - void MergeFrom(const VarType_Tuple &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType_Tuple *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .paddle_mobile.framework.proto.VarType.Type element_type = 1; - int element_type_size() const; - void clear_element_type(); - static const int kElementTypeFieldNumber = 1; - ::paddle_mobile::framework::proto::VarType_Type element_type(int index) const; - void set_element_type(int index, - ::paddle_mobile::framework::proto::VarType_Type value); - void add_element_type(::paddle_mobile::framework::proto::VarType_Type value); - const ::google::protobuf::RepeatedField &element_type() const; - ::google::protobuf::RepeatedField *mutable_element_type(); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.Tuple) -private: - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedField element_type_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarType - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType) - */ -{ -public: - VarType(); - virtual ~VarType(); - - VarType(const VarType &from); - - inline VarType &operator=(const VarType &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType_Tuple &default_instance(); + + static inline const VarType_Tuple *internal_default_instance() { + return reinterpret_cast( + &_VarType_Tuple_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 11; + + void Swap(VarType_Tuple *other); + friend void swap(VarType_Tuple &a, VarType_Tuple &b) { + a.Swap(&b); + } + + // implements Message + // ---------------------------------------------- + + inline VarType_Tuple *New() const PROTOBUF_FINAL { + return New(NULL); + } + + VarType_Tuple * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType_Tuple &from); + void MergeFrom(const VarType_Tuple &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType_Tuple *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated .paddle_mobile.framework.proto.VarType.Type + // element_type = 1; + int element_type_size() const; + void clear_element_type(); + static const int kElementTypeFieldNumber = 1; + ::paddle_mobile::framework::proto::VarType_Type + element_type(int index) const; + void set_element_type( + int index, + ::paddle_mobile::framework::proto::VarType_Type value); + void add_element_type( + ::paddle_mobile::framework::proto::VarType_Type value); + const ::google::protobuf::RepeatedField & + element_type() const; + ::google::protobuf::RepeatedField *mutable_element_type(); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType.Tuple) + private: + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedField element_type_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarType + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarType) + */ + { + public: + VarType(); + virtual ~VarType(); + + VarType(const VarType &from); + + inline VarType &operator=(const VarType &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarType(VarType &&from) noexcept : VarType() { *this = ::std::move(from); } - - inline VarType &operator=(VarType &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarType(VarType &&from) noexcept : VarType() { + *this = ::std::move(from); + } + + inline VarType &operator=(VarType &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarType &default_instance(); - - static inline const VarType *internal_default_instance() { - return reinterpret_cast(&_VarType_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 12; - - void Swap(VarType *other); - friend void swap(VarType &a, VarType &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline VarType *New() const PROTOBUF_FINAL { return New(NULL); } - - VarType *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarType &from); - void MergeFrom(const VarType &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarType *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - typedef VarType_TensorDesc TensorDesc; - typedef VarType_LoDTensorDesc LoDTensorDesc; - typedef VarType_LoDTensorArrayDesc LoDTensorArrayDesc; - typedef VarType_ReaderDesc ReaderDesc; - typedef VarType_ChannelDesc ChannelDesc; - typedef VarType_Tuple Tuple; - - typedef VarType_Type Type; - static const Type BOOL = VarType_Type_BOOL; - static const Type INT16 = VarType_Type_INT16; - static const Type INT32 = VarType_Type_INT32; - static const Type INT64 = VarType_Type_INT64; - static const Type FP16 = VarType_Type_FP16; - static const Type FP32 = VarType_Type_FP32; - static const Type FP64 = VarType_Type_FP64; - static const Type LOD_TENSOR = VarType_Type_LOD_TENSOR; - static const Type SELECTED_ROWS = VarType_Type_SELECTED_ROWS; - static const Type FEED_MINIBATCH = VarType_Type_FEED_MINIBATCH; - static const Type FETCH_LIST = VarType_Type_FETCH_LIST; - static const Type STEP_SCOPES = VarType_Type_STEP_SCOPES; - static const Type LOD_RANK_TABLE = VarType_Type_LOD_RANK_TABLE; - static const Type LOD_TENSOR_ARRAY = VarType_Type_LOD_TENSOR_ARRAY; - static const Type PLACE_LIST = VarType_Type_PLACE_LIST; - static const Type READER = VarType_Type_READER; - static const Type CHANNEL = VarType_Type_CHANNEL; - static const Type RAW = VarType_Type_RAW; - static const Type TUPLE = VarType_Type_TUPLE; - static inline bool Type_IsValid(int value) { - return VarType_Type_IsValid(value); - } - static const Type Type_MIN = VarType_Type_Type_MIN; - static const Type Type_MAX = VarType_Type_Type_MAX; - static const int Type_ARRAYSIZE = VarType_Type_Type_ARRAYSIZE; - - // accessors ------------------------------------------------------- - - // optional .paddle_mobile.framework.proto.VarType.TensorDesc selected_rows = - // 2; - bool has_selected_rows() const; - void clear_selected_rows(); - static const int kSelectedRowsFieldNumber = 2; - const ::paddle_mobile::framework::proto::VarType_TensorDesc & - selected_rows() const; - ::paddle_mobile::framework::proto::VarType_TensorDesc * - mutable_selected_rows(); - ::paddle_mobile::framework::proto::VarType_TensorDesc * - release_selected_rows(); - void set_allocated_selected_rows( - ::paddle_mobile::framework::proto::VarType_TensorDesc *selected_rows); - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = - // 3; - bool has_lod_tensor() const; - void clear_lod_tensor(); - static const int kLodTensorFieldNumber = 3; - const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & - lod_tensor() const; - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * - mutable_lod_tensor(); - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * - release_lod_tensor(); - void set_allocated_lod_tensor( - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *lod_tensor); - - // optional .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc - // tensor_array = 4; - bool has_tensor_array() const; - void clear_tensor_array(); - static const int kTensorArrayFieldNumber = 4; - const ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc & - tensor_array() const; - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * - mutable_tensor_array(); - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * - release_tensor_array(); - void set_allocated_tensor_array( - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc - *tensor_array); - - // optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader = 5; - bool has_reader() const; - void clear_reader(); - static const int kReaderFieldNumber = 5; - const ::paddle_mobile::framework::proto::VarType_ReaderDesc &reader() const; - ::paddle_mobile::framework::proto::VarType_ReaderDesc *mutable_reader(); - ::paddle_mobile::framework::proto::VarType_ReaderDesc *release_reader(); - void set_allocated_reader( - ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader); - - // optional .paddle_mobile.framework.proto.VarType.ChannelDesc channel = 6; - bool has_channel() const; - void clear_channel(); - static const int kChannelFieldNumber = 6; - const ::paddle_mobile::framework::proto::VarType_ChannelDesc &channel() const; - ::paddle_mobile::framework::proto::VarType_ChannelDesc *mutable_channel(); - ::paddle_mobile::framework::proto::VarType_ChannelDesc *release_channel(); - void set_allocated_channel( - ::paddle_mobile::framework::proto::VarType_ChannelDesc *channel); - - // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; - bool has_tuple() const; - void clear_tuple(); - static const int kTupleFieldNumber = 7; - const ::paddle_mobile::framework::proto::VarType_Tuple &tuple() const; - ::paddle_mobile::framework::proto::VarType_Tuple *mutable_tuple(); - ::paddle_mobile::framework::proto::VarType_Tuple *release_tuple(); - void - set_allocated_tuple(::paddle_mobile::framework::proto::VarType_Tuple *tuple); - - // required .paddle_mobile.framework.proto.VarType.Type type = 1; - bool has_type() const; - void clear_type(); - static const int kTypeFieldNumber = 1; - ::paddle_mobile::framework::proto::VarType_Type type() const; - void set_type(::paddle_mobile::framework::proto::VarType_Type value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType) -private: - void set_has_type(); - void clear_has_type(); - void set_has_selected_rows(); - void clear_has_selected_rows(); - void set_has_lod_tensor(); - void clear_has_lod_tensor(); - void set_has_tensor_array(); - void clear_has_tensor_array(); - void set_has_reader(); - void clear_has_reader(); - void set_has_channel(); - void clear_has_channel(); - void set_has_tuple(); - void clear_has_tuple(); - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::paddle_mobile::framework::proto::VarType_TensorDesc *selected_rows_; - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *lod_tensor_; - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc *tensor_array_; - ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader_; - ::paddle_mobile::framework::proto::VarType_ChannelDesc *channel_; - ::paddle_mobile::framework::proto::VarType_Tuple *tuple_; - int type_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class VarDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarDesc) - */ -{ -public: - VarDesc(); - virtual ~VarDesc(); - - VarDesc(const VarDesc &from); - - inline VarDesc &operator=(const VarDesc &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarType &default_instance(); + + static inline const VarType *internal_default_instance() { + return reinterpret_cast( + &_VarType_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 12; + + void Swap(VarType *other); + friend void swap(VarType &a, VarType &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline VarType *New() const PROTOBUF_FINAL { return New(NULL); } + + VarType * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarType &from); + void MergeFrom(const VarType &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarType *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + typedef VarType_TensorDesc TensorDesc; + typedef VarType_LoDTensorDesc LoDTensorDesc; + typedef VarType_LoDTensorArrayDesc LoDTensorArrayDesc; + typedef VarType_ReaderDesc ReaderDesc; + typedef VarType_ChannelDesc ChannelDesc; + typedef VarType_Tuple Tuple; + + typedef VarType_Type Type; + static const Type BOOL = VarType_Type_BOOL; + static const Type INT16 = VarType_Type_INT16; + static const Type INT32 = VarType_Type_INT32; + static const Type INT64 = VarType_Type_INT64; + static const Type FP16 = VarType_Type_FP16; + static const Type FP32 = VarType_Type_FP32; + static const Type FP64 = VarType_Type_FP64; + static const Type LOD_TENSOR = VarType_Type_LOD_TENSOR; + static const Type SELECTED_ROWS = VarType_Type_SELECTED_ROWS; + static const Type FEED_MINIBATCH = VarType_Type_FEED_MINIBATCH; + static const Type FETCH_LIST = VarType_Type_FETCH_LIST; + static const Type STEP_SCOPES = VarType_Type_STEP_SCOPES; + static const Type LOD_RANK_TABLE = VarType_Type_LOD_RANK_TABLE; + static const Type LOD_TENSOR_ARRAY = + VarType_Type_LOD_TENSOR_ARRAY; + static const Type PLACE_LIST = VarType_Type_PLACE_LIST; + static const Type READER = VarType_Type_READER; + static const Type CHANNEL = VarType_Type_CHANNEL; + static const Type RAW = VarType_Type_RAW; + static const Type TUPLE = VarType_Type_TUPLE; + static inline bool Type_IsValid(int value) { + return VarType_Type_IsValid(value); + } + static const Type Type_MIN = VarType_Type_Type_MIN; + static const Type Type_MAX = VarType_Type_Type_MAX; + static const int Type_ARRAYSIZE = VarType_Type_Type_ARRAYSIZE; + + // accessors + // ------------------------------------------------------- + + // optional .paddle_mobile.framework.proto.VarType.TensorDesc + // selected_rows = + // 2; + bool has_selected_rows() const; + void clear_selected_rows(); + static const int kSelectedRowsFieldNumber = 2; + const ::paddle_mobile::framework::proto::VarType_TensorDesc & + selected_rows() const; + ::paddle_mobile::framework::proto::VarType_TensorDesc * + mutable_selected_rows(); + ::paddle_mobile::framework::proto::VarType_TensorDesc * + release_selected_rows(); + void set_allocated_selected_rows( + ::paddle_mobile::framework::proto::VarType_TensorDesc + *selected_rows); + + // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = + // 3; + bool has_lod_tensor() const; + void clear_lod_tensor(); + static const int kLodTensorFieldNumber = 3; + const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & + lod_tensor() const; + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + mutable_lod_tensor(); + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + release_lod_tensor(); + void set_allocated_lod_tensor( + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *lod_tensor); + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc + // tensor_array = 4; + bool has_tensor_array() const; + void clear_tensor_array(); + static const int kTensorArrayFieldNumber = 4; + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc & + tensor_array() const; + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * + mutable_tensor_array(); + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * + release_tensor_array(); + void set_allocated_tensor_array( + ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc *tensor_array); + + // optional .paddle_mobile.framework.proto.VarType.ReaderDesc + // reader = 5; + bool has_reader() const; + void clear_reader(); + static const int kReaderFieldNumber = 5; + const ::paddle_mobile::framework::proto::VarType_ReaderDesc & + reader() const; + ::paddle_mobile::framework::proto::VarType_ReaderDesc * + mutable_reader(); + ::paddle_mobile::framework::proto::VarType_ReaderDesc * + release_reader(); + void set_allocated_reader( + ::paddle_mobile::framework::proto::VarType_ReaderDesc + *reader); + + // optional .paddle_mobile.framework.proto.VarType.ChannelDesc + // channel = 6; + bool has_channel() const; + void clear_channel(); + static const int kChannelFieldNumber = 6; + const ::paddle_mobile::framework::proto::VarType_ChannelDesc & + channel() const; + ::paddle_mobile::framework::proto::VarType_ChannelDesc * + mutable_channel(); + ::paddle_mobile::framework::proto::VarType_ChannelDesc * + release_channel(); + void set_allocated_channel( + ::paddle_mobile::framework::proto::VarType_ChannelDesc + *channel); + + // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = + // 7; + bool has_tuple() const; + void clear_tuple(); + static const int kTupleFieldNumber = 7; + const ::paddle_mobile::framework::proto::VarType_Tuple & + tuple() const; + ::paddle_mobile::framework::proto::VarType_Tuple * + mutable_tuple(); + ::paddle_mobile::framework::proto::VarType_Tuple * + release_tuple(); + void set_allocated_tuple( + ::paddle_mobile::framework::proto::VarType_Tuple *tuple); + + // required .paddle_mobile.framework.proto.VarType.Type type = + // 1; + bool has_type() const; + void clear_type(); + static const int kTypeFieldNumber = 1; + ::paddle_mobile::framework::proto::VarType_Type type() const; + void + set_type(::paddle_mobile::framework::proto::VarType_Type value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarType) + private: + void set_has_type(); + void clear_has_type(); + void set_has_selected_rows(); + void clear_has_selected_rows(); + void set_has_lod_tensor(); + void clear_has_lod_tensor(); + void set_has_tensor_array(); + void clear_has_tensor_array(); + void set_has_reader(); + void clear_has_reader(); + void set_has_channel(); + void clear_has_channel(); + void set_has_tuple(); + void clear_has_tuple(); + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::paddle_mobile::framework::proto::VarType_TensorDesc + *selected_rows_; + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *lod_tensor_; + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + *tensor_array_; + ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader_; + ::paddle_mobile::framework::proto::VarType_ChannelDesc + *channel_; + ::paddle_mobile::framework::proto::VarType_Tuple *tuple_; + int type_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class VarDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.VarDesc) + */ + { + public: + VarDesc(); + virtual ~VarDesc(); + + VarDesc(const VarDesc &from); + + inline VarDesc &operator=(const VarDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - VarDesc(VarDesc &&from) noexcept : VarDesc() { *this = ::std::move(from); } - - inline VarDesc &operator=(VarDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + VarDesc(VarDesc &&from) noexcept : VarDesc() { + *this = ::std::move(from); + } + + inline VarDesc &operator=(VarDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const VarDesc &default_instance(); - - static inline const VarDesc *internal_default_instance() { - return reinterpret_cast(&_VarDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 13; - - void Swap(VarDesc *other); - friend void swap(VarDesc &a, VarDesc &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline VarDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - VarDesc *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const VarDesc &from); - void MergeFrom(const VarDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(VarDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // required string name = 1; - bool has_name() const; - void clear_name(); - static const int kNameFieldNumber = 1; - const ::std::string &name() const; - void set_name(const ::std::string &value); + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const VarDesc &default_instance(); + + static inline const VarDesc *internal_default_instance() { + return reinterpret_cast( + &_VarDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 13; + + void Swap(VarDesc *other); + friend void swap(VarDesc &a, VarDesc &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline VarDesc *New() const PROTOBUF_FINAL { return New(NULL); } + + VarDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const VarDesc &from); + void MergeFrom(const VarDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(VarDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // required string name = 1; + bool has_name() const; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string &name() const; + void set_name(const ::std::string &value); #if LANG_CXX11 - void set_name(::std::string &&value); + void set_name(::std::string &&value); #endif - void set_name(const char *value); - void set_name(const char *value, size_t size); - ::std::string *mutable_name(); - ::std::string *release_name(); - void set_allocated_name(::std::string *name); - - // required .paddle_mobile.framework.proto.VarType type = 2; - bool has_type() const; - void clear_type(); - static const int kTypeFieldNumber = 2; - const ::paddle_mobile::framework::proto::VarType &type() const; - ::paddle_mobile::framework::proto::VarType *mutable_type(); - ::paddle_mobile::framework::proto::VarType *release_type(); - void set_allocated_type(::paddle_mobile::framework::proto::VarType *type); - - // optional bool persistable = 3 [default = false]; - bool has_persistable() const; - void clear_persistable(); - static const int kPersistableFieldNumber = 3; - bool persistable() const; - void set_persistable(bool value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarDesc) -private: - void set_has_name(); - void clear_has_name(); - void set_has_type(); - void clear_has_type(); - void set_has_persistable(); - void clear_has_persistable(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::internal::ArenaStringPtr name_; - ::paddle_mobile::framework::proto::VarType *type_; - bool persistable_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class BlockDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.BlockDesc) - */ -{ -public: - BlockDesc(); - virtual ~BlockDesc(); - - BlockDesc(const BlockDesc &from); - - inline BlockDesc &operator=(const BlockDesc &from) { - CopyFrom(from); - return *this; - } + void set_name(const char *value); + void set_name(const char *value, size_t size); + ::std::string *mutable_name(); + ::std::string *release_name(); + void set_allocated_name(::std::string *name); + + // required .paddle_mobile.framework.proto.VarType type = 2; + bool has_type() const; + void clear_type(); + static const int kTypeFieldNumber = 2; + const ::paddle_mobile::framework::proto::VarType &type() const; + ::paddle_mobile::framework::proto::VarType *mutable_type(); + ::paddle_mobile::framework::proto::VarType *release_type(); + void set_allocated_type( + ::paddle_mobile::framework::proto::VarType *type); + + // optional bool persistable = 3 [default = false]; + bool has_persistable() const; + void clear_persistable(); + static const int kPersistableFieldNumber = 3; + bool persistable() const; + void set_persistable(bool value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.VarDesc) + private: + void set_has_name(); + void clear_has_name(); + void set_has_type(); + void clear_has_type(); + void set_has_persistable(); + void clear_has_persistable(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::paddle_mobile::framework::proto::VarType *type_; + bool persistable_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class BlockDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.BlockDesc) + */ + { + public: + BlockDesc(); + virtual ~BlockDesc(); + + BlockDesc(const BlockDesc &from); + + inline BlockDesc &operator=(const BlockDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - BlockDesc(BlockDesc &&from) noexcept : BlockDesc() { - *this = ::std::move(from); - } - - inline BlockDesc &operator=(BlockDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + BlockDesc(BlockDesc &&from) noexcept : BlockDesc() { + *this = ::std::move(from); + } + + inline BlockDesc &operator=(BlockDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const BlockDesc &default_instance(); - - static inline const BlockDesc *internal_default_instance() { - return reinterpret_cast(&_BlockDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 14; - - void Swap(BlockDesc *other); - friend void swap(BlockDesc &a, BlockDesc &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline BlockDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - BlockDesc *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const BlockDesc &from); - void MergeFrom(const BlockDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(BlockDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; - int vars_size() const; - void clear_vars(); - static const int kVarsFieldNumber = 3; - const ::paddle_mobile::framework::proto::VarDesc &vars(int index) const; - ::paddle_mobile::framework::proto::VarDesc *mutable_vars(int index); - ::paddle_mobile::framework::proto::VarDesc *add_vars(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarDesc> * - mutable_vars(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarDesc> & - vars() const; - - // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; - int ops_size() const; - void clear_ops(); - static const int kOpsFieldNumber = 4; - const ::paddle_mobile::framework::proto::OpDesc &ops(int index) const; - ::paddle_mobile::framework::proto::OpDesc *mutable_ops(int index); - ::paddle_mobile::framework::proto::OpDesc *add_ops(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc> * - mutable_ops(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc> & - ops() const; - - // required int32 idx = 1; - bool has_idx() const; - void clear_idx(); - static const int kIdxFieldNumber = 1; - ::google::protobuf::int32 idx() const; - void set_idx(::google::protobuf::int32 value); - - // required int32 parent_idx = 2; - bool has_parent_idx() const; - void clear_parent_idx(); - static const int kParentIdxFieldNumber = 2; - ::google::protobuf::int32 parent_idx() const; - void set_parent_idx(::google::protobuf::int32 value); - - // optional int32 forward_block_idx = 5 [default = -1]; - bool has_forward_block_idx() const; - void clear_forward_block_idx(); - static const int kForwardBlockIdxFieldNumber = 5; - ::google::protobuf::int32 forward_block_idx() const; - void set_forward_block_idx(::google::protobuf::int32 value); - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.BlockDesc) -private: - void set_has_idx(); - void clear_has_idx(); - void set_has_parent_idx(); - void clear_has_parent_idx(); - void set_has_forward_block_idx(); - void clear_has_forward_block_idx(); - - // helper for ByteSizeLong() - size_t RequiredFieldsByteSizeFallback() const; - - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarDesc> - vars_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc> - ops_; - ::google::protobuf::int32 idx_; - ::google::protobuf::int32 parent_idx_; - ::google::protobuf::int32 forward_block_idx_; - friend struct protobuf_framework_2eproto::TableStruct; -}; -// ------------------------------------------------------------------- - -class ProgramDesc - : public ::google::protobuf:: - MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.ProgramDesc) - */ -{ -public: - ProgramDesc(); - virtual ~ProgramDesc(); - - ProgramDesc(const ProgramDesc &from); - - inline ProgramDesc &operator=(const ProgramDesc &from) { - CopyFrom(from); - return *this; - } + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const BlockDesc &default_instance(); + + static inline const BlockDesc *internal_default_instance() { + return reinterpret_cast( + &_BlockDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 14; + + void Swap(BlockDesc *other); + friend void swap(BlockDesc &a, BlockDesc &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline BlockDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + BlockDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const BlockDesc &from); + void MergeFrom(const BlockDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(BlockDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; + int vars_size() const; + void clear_vars(); + static const int kVarsFieldNumber = 3; + const ::paddle_mobile::framework::proto::VarDesc & + vars(int index) const; + ::paddle_mobile::framework::proto::VarDesc * + mutable_vars(int index); + ::paddle_mobile::framework::proto::VarDesc *add_vars(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> * + mutable_vars(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> & + vars() const; + + // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; + int ops_size() const; + void clear_ops(); + static const int kOpsFieldNumber = 4; + const ::paddle_mobile::framework::proto::OpDesc & + ops(int index) const; + ::paddle_mobile::framework::proto::OpDesc * + mutable_ops(int index); + ::paddle_mobile::framework::proto::OpDesc *add_ops(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> * + mutable_ops(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> & + ops() const; + + // required int32 idx = 1; + bool has_idx() const; + void clear_idx(); + static const int kIdxFieldNumber = 1; + ::google::protobuf::int32 idx() const; + void set_idx(::google::protobuf::int32 value); + + // required int32 parent_idx = 2; + bool has_parent_idx() const; + void clear_parent_idx(); + static const int kParentIdxFieldNumber = 2; + ::google::protobuf::int32 parent_idx() const; + void set_parent_idx(::google::protobuf::int32 value); + + // optional int32 forward_block_idx = 5 [default = -1]; + bool has_forward_block_idx() const; + void clear_forward_block_idx(); + static const int kForwardBlockIdxFieldNumber = 5; + ::google::protobuf::int32 forward_block_idx() const; + void set_forward_block_idx(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.BlockDesc) + private: + void set_has_idx(); + void clear_has_idx(); + void set_has_parent_idx(); + void clear_has_parent_idx(); + void set_has_forward_block_idx(); + void clear_has_forward_block_idx(); + + // helper for ByteSizeLong() + size_t RequiredFieldsByteSizeFallback() const; + + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> + vars_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> + ops_; + ::google::protobuf::int32 idx_; + ::google::protobuf::int32 parent_idx_; + ::google::protobuf::int32 forward_block_idx_; + friend struct protobuf_framework_2eproto::TableStruct; + }; + // ------------------------------------------------------------------- + + class ProgramDesc + : public ::google::protobuf:: + MessageLite /* @@protoc_insertion_point(class_definition:paddle_mobile.framework.proto.ProgramDesc) + */ + { + public: + ProgramDesc(); + virtual ~ProgramDesc(); + + ProgramDesc(const ProgramDesc &from); + + inline ProgramDesc &operator=(const ProgramDesc &from) { + CopyFrom(from); + return *this; + } #if LANG_CXX11 - ProgramDesc(ProgramDesc &&from) noexcept : ProgramDesc() { - *this = ::std::move(from); - } - - inline ProgramDesc &operator=(ProgramDesc &&from) noexcept { - if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { - if (this != &from) - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } + ProgramDesc(ProgramDesc &&from) noexcept : ProgramDesc() { + *this = ::std::move(from); + } + + inline ProgramDesc &operator=(ProgramDesc &&from) noexcept { + if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { + if (this != &from) + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } #endif - inline const ::std::string &unknown_fields() const { - return _internal_metadata_.unknown_fields(); - } - inline ::std::string *mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields(); - } - - static const ProgramDesc &default_instance(); - - static inline const ProgramDesc *internal_default_instance() { - return reinterpret_cast( - &_ProgramDesc_default_instance_); - } - static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 15; - - void Swap(ProgramDesc *other); - friend void swap(ProgramDesc &a, ProgramDesc &b) { a.Swap(&b); } - - // implements Message ---------------------------------------------- - - inline ProgramDesc *New() const PROTOBUF_FINAL { return New(NULL); } - - ProgramDesc *New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; - void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite &from) - PROTOBUF_FINAL; - void CopyFrom(const ProgramDesc &from); - void MergeFrom(const ProgramDesc &from); - void Clear() PROTOBUF_FINAL; - bool IsInitialized() const PROTOBUF_FINAL; - - size_t ByteSizeLong() const PROTOBUF_FINAL; - bool MergePartialFromCodedStream( - ::google::protobuf::io::CodedInputStream *input) PROTOBUF_FINAL; - void SerializeWithCachedSizes( - ::google::protobuf::io::CodedOutputStream *output) const PROTOBUF_FINAL; - void DiscardUnknownFields(); - int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } - -private: - void SharedCtor(); - void SharedDtor(); - void SetCachedSize(int size) const; - void InternalSwap(ProgramDesc *other); - -private: - inline ::google::protobuf::Arena *GetArenaNoVirtual() const { return NULL; } - inline void *MaybeArenaPtr() const { return NULL; } - -public: - ::std::string GetTypeName() const PROTOBUF_FINAL; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; - int blocks_size() const; - void clear_blocks(); - static const int kBlocksFieldNumber = 1; - const ::paddle_mobile::framework::proto::BlockDesc &blocks(int index) const; - ::paddle_mobile::framework::proto::BlockDesc *mutable_blocks(int index); - ::paddle_mobile::framework::proto::BlockDesc *add_blocks(); - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> * - mutable_blocks(); - const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> & - blocks() const; - - // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.ProgramDesc) -private: - ::google::protobuf::internal::InternalMetadataWithArenaLite - _internal_metadata_; - ::google::protobuf::internal::HasBits<1> _has_bits_; - mutable int _cached_size_; - ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> - blocks_; - friend struct protobuf_framework_2eproto::TableStruct; -}; + inline const ::std::string &unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + inline ::std::string *mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ProgramDesc &default_instance(); + + static inline const ProgramDesc *internal_default_instance() { + return reinterpret_cast( + &_ProgramDesc_default_instance_); + } + static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 15; + + void Swap(ProgramDesc *other); + friend void swap(ProgramDesc &a, ProgramDesc &b) { a.Swap(&b); } + + // implements Message + // ---------------------------------------------- + + inline ProgramDesc *New() const PROTOBUF_FINAL { + return New(NULL); + } + + ProgramDesc * + New(::google::protobuf::Arena *arena) const PROTOBUF_FINAL; + void CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite &from) PROTOBUF_FINAL; + void CopyFrom(const ProgramDesc &from); + void MergeFrom(const ProgramDesc &from); + void Clear() PROTOBUF_FINAL; + bool IsInitialized() const PROTOBUF_FINAL; + + size_t ByteSizeLong() const PROTOBUF_FINAL; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream *input) + PROTOBUF_FINAL; + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream *output) const + PROTOBUF_FINAL; + void DiscardUnknownFields(); + int GetCachedSize() const PROTOBUF_FINAL { + return _cached_size_; + } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ProgramDesc *other); + + private: + inline ::google::protobuf::Arena *GetArenaNoVirtual() const { + return NULL; + } + inline void *MaybeArenaPtr() const { return NULL; } + + public: + ::std::string GetTypeName() const PROTOBUF_FINAL; + + // nested types + // ---------------------------------------------------- + + // accessors + // ------------------------------------------------------- + + // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; + int blocks_size() const; + void clear_blocks(); + static const int kBlocksFieldNumber = 1; + const ::paddle_mobile::framework::proto::BlockDesc & + blocks(int index) const; + ::paddle_mobile::framework::proto::BlockDesc * + mutable_blocks(int index); + ::paddle_mobile::framework::proto::BlockDesc *add_blocks(); + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> * + mutable_blocks(); + const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> & + blocks() const; + + // @@protoc_insertion_point(class_scope:paddle_mobile.framework.proto.ProgramDesc) + private: + ::google::protobuf::internal::InternalMetadataWithArenaLite + _internal_metadata_; + ::google::protobuf::internal::HasBits<1> _has_bits_; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> + blocks_; + friend struct protobuf_framework_2eproto::TableStruct; + }; // =================================================================== // =================================================================== @@ -2589,2381 +2899,2695 @@ private: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ -// OpDesc_Attr - -// required string name = 1; -inline bool OpDesc_Attr::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void OpDesc_Attr::set_has_name() { _has_bits_[0] |= 0x00000001u; } -inline void OpDesc_Attr::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -inline void OpDesc_Attr::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -inline const ::std::string &OpDesc_Attr::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.name) - return name_.GetNoArena(); -} -inline void OpDesc_Attr::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.name) -} + // OpDesc_Attr + + // required string name = 1; + inline bool OpDesc_Attr::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void OpDesc_Attr::set_has_name() { + _has_bits_[0] |= 0x00000001u; + } + inline void OpDesc_Attr::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + inline void OpDesc_Attr::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + inline const ::std::string &OpDesc_Attr::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.name) + return name_.GetNoArena(); + } + inline void OpDesc_Attr::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.name) + } #if LANG_CXX11 -inline void OpDesc_Attr::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.name) -} + inline void OpDesc_Attr::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.name) + } #endif -inline void OpDesc_Attr::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.name) -} -inline void OpDesc_Attr::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.name) -} -inline ::std::string *OpDesc_Attr::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpDesc_Attr::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpDesc_Attr::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.name) -} - -// required .paddle_mobile.framework.proto.AttrType type = 2; -inline bool OpDesc_Attr::has_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void OpDesc_Attr::set_has_type() { _has_bits_[0] |= 0x00000004u; } -inline void OpDesc_Attr::clear_has_type() { _has_bits_[0] &= ~0x00000004u; } -inline void OpDesc_Attr::clear_type() { - type_ = 0; - clear_has_type(); -} -inline ::paddle_mobile::framework::proto::AttrType OpDesc_Attr::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.type) - return static_cast<::paddle_mobile::framework::proto::AttrType>(type_); -} -inline void -OpDesc_Attr::set_type(::paddle_mobile::framework::proto::AttrType value) { - assert(::paddle_mobile::framework::proto::AttrType_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.type) -} - -// optional int32 i = 3; -inline bool OpDesc_Attr::has_i() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void OpDesc_Attr::set_has_i() { _has_bits_[0] |= 0x00000008u; } -inline void OpDesc_Attr::clear_has_i() { _has_bits_[0] &= ~0x00000008u; } -inline void OpDesc_Attr::clear_i() { - i_ = 0; - clear_has_i(); -} -inline ::google::protobuf::int32 OpDesc_Attr::i() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.i) - return i_; -} -inline void OpDesc_Attr::set_i(::google::protobuf::int32 value) { - set_has_i(); - i_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.i) -} - -// optional float f = 4; -inline bool OpDesc_Attr::has_f() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -inline void OpDesc_Attr::set_has_f() { _has_bits_[0] |= 0x00000010u; } -inline void OpDesc_Attr::clear_has_f() { _has_bits_[0] &= ~0x00000010u; } -inline void OpDesc_Attr::clear_f() { - f_ = 0; - clear_has_f(); -} -inline float OpDesc_Attr::f() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.f) - return f_; -} -inline void OpDesc_Attr::set_f(float value) { - set_has_f(); - f_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.f) -} - -// optional string s = 5; -inline bool OpDesc_Attr::has_s() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void OpDesc_Attr::set_has_s() { _has_bits_[0] |= 0x00000002u; } -inline void OpDesc_Attr::clear_has_s() { _has_bits_[0] &= ~0x00000002u; } -inline void OpDesc_Attr::clear_s() { - s_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_s(); -} -inline const ::std::string &OpDesc_Attr::s() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.s) - return s_.GetNoArena(); -} -inline void OpDesc_Attr::set_s(const ::std::string &value) { - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.s) -} + inline void OpDesc_Attr::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.name) + } + inline void OpDesc_Attr::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.name) + } + inline ::std::string *OpDesc_Attr::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpDesc_Attr::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpDesc_Attr::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.name) + } + + // required .paddle_mobile.framework.proto.AttrType type = 2; + inline bool OpDesc_Attr::has_type() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + inline void OpDesc_Attr::set_has_type() { + _has_bits_[0] |= 0x00000004u; + } + inline void OpDesc_Attr::clear_has_type() { + _has_bits_[0] &= ~0x00000004u; + } + inline void OpDesc_Attr::clear_type() { + type_ = 0; + clear_has_type(); + } + inline ::paddle_mobile::framework::proto::AttrType + OpDesc_Attr::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.type) + return static_cast<::paddle_mobile::framework::proto::AttrType>( + type_); + } + inline void OpDesc_Attr::set_type( + ::paddle_mobile::framework::proto::AttrType value) { + assert( + ::paddle_mobile::framework::proto::AttrType_IsValid(value)); + set_has_type(); + type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.type) + } + + // optional int32 i = 3; + inline bool OpDesc_Attr::has_i() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + inline void OpDesc_Attr::set_has_i() { + _has_bits_[0] |= 0x00000008u; + } + inline void OpDesc_Attr::clear_has_i() { + _has_bits_[0] &= ~0x00000008u; + } + inline void OpDesc_Attr::clear_i() { + i_ = 0; + clear_has_i(); + } + inline ::google::protobuf::int32 OpDesc_Attr::i() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.i) + return i_; + } + inline void OpDesc_Attr::set_i(::google::protobuf::int32 value) { + set_has_i(); + i_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.i) + } + + // optional float f = 4; + inline bool OpDesc_Attr::has_f() const { + return (_has_bits_[0] & 0x00000010u) != 0; + } + inline void OpDesc_Attr::set_has_f() { + _has_bits_[0] |= 0x00000010u; + } + inline void OpDesc_Attr::clear_has_f() { + _has_bits_[0] &= ~0x00000010u; + } + inline void OpDesc_Attr::clear_f() { + f_ = 0; + clear_has_f(); + } + inline float OpDesc_Attr::f() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.f) + return f_; + } + inline void OpDesc_Attr::set_f(float value) { + set_has_f(); + f_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.f) + } + + // optional string s = 5; + inline bool OpDesc_Attr::has_s() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void OpDesc_Attr::set_has_s() { + _has_bits_[0] |= 0x00000002u; + } + inline void OpDesc_Attr::clear_has_s() { + _has_bits_[0] &= ~0x00000002u; + } + inline void OpDesc_Attr::clear_s() { + s_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_s(); + } + inline const ::std::string &OpDesc_Attr::s() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.s) + return s_.GetNoArena(); + } + inline void OpDesc_Attr::set_s(const ::std::string &value) { + set_has_s(); + s_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.s) + } #if LANG_CXX11 -inline void OpDesc_Attr::set_s(::std::string &&value) { - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.s) -} + inline void OpDesc_Attr::set_s(::std::string &&value) { + set_has_s(); + s_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Attr.s) + } #endif -inline void OpDesc_Attr::set_s(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.s) -} -inline void OpDesc_Attr::set_s(const char *value, size_t size) { - set_has_s(); - s_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.s) -} -inline ::std::string *OpDesc_Attr::mutable_s() { - set_has_s(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.s) - return s_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpDesc_Attr::release_s() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.s) - clear_has_s(); - return s_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpDesc_Attr::set_allocated_s(::std::string *s) { - if (s != NULL) { - set_has_s(); - } else { - clear_has_s(); - } - s_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), s); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.s) -} - -// repeated int32 ints = 6; -inline int OpDesc_Attr::ints_size() const { return ints_.size(); } -inline void OpDesc_Attr::clear_ints() { ints_.Clear(); } -inline ::google::protobuf::int32 OpDesc_Attr::ints(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.ints) - return ints_.Get(index); -} -inline void OpDesc_Attr::set_ints(int index, ::google::protobuf::int32 value) { - ints_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.ints) -} -inline void OpDesc_Attr::add_ints(::google::protobuf::int32 value) { - ints_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.ints) -} -inline const ::google::protobuf::RepeatedField<::google::protobuf::int32> & -OpDesc_Attr::ints() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) - return ints_; -} -inline ::google::protobuf::RepeatedField<::google::protobuf::int32> * -OpDesc_Attr::mutable_ints() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) - return &ints_; -} - -// repeated float floats = 7; -inline int OpDesc_Attr::floats_size() const { return floats_.size(); } -inline void OpDesc_Attr::clear_floats() { floats_.Clear(); } -inline float OpDesc_Attr::floats(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.floats) - return floats_.Get(index); -} -inline void OpDesc_Attr::set_floats(int index, float value) { - floats_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.floats) -} -inline void OpDesc_Attr::add_floats(float value) { - floats_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.floats) -} -inline const ::google::protobuf::RepeatedField & -OpDesc_Attr::floats() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) - return floats_; -} -inline ::google::protobuf::RepeatedField *OpDesc_Attr::mutable_floats() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) - return &floats_; -} - -// repeated string strings = 8; -inline int OpDesc_Attr::strings_size() const { return strings_.size(); } -inline void OpDesc_Attr::clear_strings() { strings_.Clear(); } -inline const ::std::string &OpDesc_Attr::strings(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_.Get(index); -} -inline ::std::string *OpDesc_Attr::mutable_strings(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_.Mutable(index); -} -inline void OpDesc_Attr::set_strings(int index, const ::std::string &value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) - strings_.Mutable(index)->assign(value); -} + inline void OpDesc_Attr::set_s(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_s(); + s_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.s) + } + inline void OpDesc_Attr::set_s(const char *value, size_t size) { + set_has_s(); + s_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.s) + } + inline ::std::string *OpDesc_Attr::mutable_s() { + set_has_s(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.s) + return s_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpDesc_Attr::release_s() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Attr.s) + clear_has_s(); + return s_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpDesc_Attr::set_allocated_s(::std::string *s) { + if (s != NULL) { + set_has_s(); + } else { + clear_has_s(); + } + s_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + s); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Attr.s) + } + + // repeated int32 ints = 6; + inline int OpDesc_Attr::ints_size() const { return ints_.size(); } + inline void OpDesc_Attr::clear_ints() { ints_.Clear(); } + inline ::google::protobuf::int32 + OpDesc_Attr::ints(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.ints) + return ints_.Get(index); + } + inline void OpDesc_Attr::set_ints(int index, + ::google::protobuf::int32 value) { + ints_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.ints) + } + inline void OpDesc_Attr::add_ints(::google::protobuf::int32 value) { + ints_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.ints) + } + inline const ::google::protobuf::RepeatedField< + ::google::protobuf::int32> & + OpDesc_Attr::ints() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) + return ints_; + } + inline ::google::protobuf::RepeatedField<::google::protobuf::int32> + *OpDesc_Attr::mutable_ints() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.ints) + return &ints_; + } + + // repeated float floats = 7; + inline int OpDesc_Attr::floats_size() const { + return floats_.size(); + } + inline void OpDesc_Attr::clear_floats() { floats_.Clear(); } + inline float OpDesc_Attr::floats(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.floats) + return floats_.Get(index); + } + inline void OpDesc_Attr::set_floats(int index, float value) { + floats_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.floats) + } + inline void OpDesc_Attr::add_floats(float value) { + floats_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.floats) + } + inline const ::google::protobuf::RepeatedField & + OpDesc_Attr::floats() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) + return floats_; + } + inline ::google::protobuf::RepeatedField * + OpDesc_Attr::mutable_floats() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.floats) + return &floats_; + } + + // repeated string strings = 8; + inline int OpDesc_Attr::strings_size() const { + return strings_.size(); + } + inline void OpDesc_Attr::clear_strings() { strings_.Clear(); } + inline const ::std::string &OpDesc_Attr::strings(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_.Get(index); + } + inline ::std::string *OpDesc_Attr::mutable_strings(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_.Mutable(index); + } + inline void OpDesc_Attr::set_strings(int index, + const ::std::string &value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) + strings_.Mutable(index)->assign(value); + } #if LANG_CXX11 -inline void OpDesc_Attr::set_strings(int index, ::std::string &&value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) - strings_.Mutable(index)->assign(std::move(value)); -} + inline void OpDesc_Attr::set_strings(int index, + ::std::string &&value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.strings) + strings_.Mutable(index)->assign(std::move(value)); + } #endif -inline void OpDesc_Attr::set_strings(int index, const char *value) { - GOOGLE_DCHECK(value != NULL); - strings_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -inline void OpDesc_Attr::set_strings(int index, const char *value, - size_t size) { - strings_.Mutable(index)->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -inline ::std::string *OpDesc_Attr::add_strings() { - // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_.Add(); -} -inline void OpDesc_Attr::add_strings(const ::std::string &value) { - strings_.Add()->assign(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} + inline void OpDesc_Attr::set_strings(int index, const char *value) { + GOOGLE_DCHECK(value != NULL); + strings_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + inline void OpDesc_Attr::set_strings(int index, const char *value, + size_t size) { + strings_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + inline ::std::string *OpDesc_Attr::add_strings() { + // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_.Add(); + } + inline void OpDesc_Attr::add_strings(const ::std::string &value) { + strings_.Add()->assign(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } #if LANG_CXX11 -inline void OpDesc_Attr::add_strings(::std::string &&value) { - strings_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} + inline void OpDesc_Attr::add_strings(::std::string &&value) { + strings_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } #endif -inline void OpDesc_Attr::add_strings(const char *value) { - GOOGLE_DCHECK(value != NULL); - strings_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -inline void OpDesc_Attr::add_strings(const char *value, size_t size) { - strings_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string> & -OpDesc_Attr::strings() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return strings_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string> * -OpDesc_Attr::mutable_strings() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) - return &strings_; -} - -// optional bool b = 10; -inline bool OpDesc_Attr::has_b() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -inline void OpDesc_Attr::set_has_b() { _has_bits_[0] |= 0x00000020u; } -inline void OpDesc_Attr::clear_has_b() { _has_bits_[0] &= ~0x00000020u; } -inline void OpDesc_Attr::clear_b() { - b_ = false; - clear_has_b(); -} -inline bool OpDesc_Attr::b() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.b) - return b_; -} -inline void OpDesc_Attr::set_b(bool value) { - set_has_b(); - b_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.b) -} - -// repeated bool bools = 11; -inline int OpDesc_Attr::bools_size() const { return bools_.size(); } -inline void OpDesc_Attr::clear_bools() { bools_.Clear(); } -inline bool OpDesc_Attr::bools(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.bools) - return bools_.Get(index); -} -inline void OpDesc_Attr::set_bools(int index, bool value) { - bools_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.bools) -} -inline void OpDesc_Attr::add_bools(bool value) { - bools_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.bools) -} -inline const ::google::protobuf::RepeatedField & -OpDesc_Attr::bools() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) - return bools_; -} -inline ::google::protobuf::RepeatedField *OpDesc_Attr::mutable_bools() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) - return &bools_; -} - -// optional int32 block_idx = 12; -inline bool OpDesc_Attr::has_block_idx() const { - return (_has_bits_[0] & 0x00000080u) != 0; -} -inline void OpDesc_Attr::set_has_block_idx() { _has_bits_[0] |= 0x00000080u; } -inline void OpDesc_Attr::clear_has_block_idx() { - _has_bits_[0] &= ~0x00000080u; -} -inline void OpDesc_Attr::clear_block_idx() { - block_idx_ = 0; - clear_has_block_idx(); -} -inline ::google::protobuf::int32 OpDesc_Attr::block_idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) - return block_idx_; -} -inline void OpDesc_Attr::set_block_idx(::google::protobuf::int32 value) { - set_has_block_idx(); - block_idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) -} - -// optional int64 l = 13; -inline bool OpDesc_Attr::has_l() const { - return (_has_bits_[0] & 0x00000040u) != 0; -} -inline void OpDesc_Attr::set_has_l() { _has_bits_[0] |= 0x00000040u; } -inline void OpDesc_Attr::clear_has_l() { _has_bits_[0] &= ~0x00000040u; } -inline void OpDesc_Attr::clear_l() { - l_ = GOOGLE_LONGLONG(0); - clear_has_l(); -} -inline ::google::protobuf::int64 OpDesc_Attr::l() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.l) - return l_; -} -inline void OpDesc_Attr::set_l(::google::protobuf::int64 value) { - set_has_l(); - l_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.l) -} - -// ------------------------------------------------------------------- - -// OpDesc_Var - -// required string parameter = 1; -inline bool OpDesc_Var::has_parameter() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void OpDesc_Var::set_has_parameter() { _has_bits_[0] |= 0x00000001u; } -inline void OpDesc_Var::clear_has_parameter() { _has_bits_[0] &= ~0x00000001u; } -inline void OpDesc_Var::clear_parameter() { - parameter_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_parameter(); -} -inline const ::std::string &OpDesc_Var::parameter() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.parameter) - return parameter_.GetNoArena(); -} -inline void OpDesc_Var::set_parameter(const ::std::string &value) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} + inline void OpDesc_Attr::add_strings(const char *value) { + GOOGLE_DCHECK(value != NULL); + strings_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + inline void OpDesc_Attr::add_strings(const char *value, + size_t size) { + strings_.Add()->assign(reinterpret_cast(value), + size); + // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Attr.strings) + } + inline const ::google::protobuf::RepeatedPtrField<::std::string> & + OpDesc_Attr::strings() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return strings_; + } + inline ::google::protobuf::RepeatedPtrField<::std::string> * + OpDesc_Attr::mutable_strings() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.strings) + return &strings_; + } + + // optional bool b = 10; + inline bool OpDesc_Attr::has_b() const { + return (_has_bits_[0] & 0x00000020u) != 0; + } + inline void OpDesc_Attr::set_has_b() { + _has_bits_[0] |= 0x00000020u; + } + inline void OpDesc_Attr::clear_has_b() { + _has_bits_[0] &= ~0x00000020u; + } + inline void OpDesc_Attr::clear_b() { + b_ = false; + clear_has_b(); + } + inline bool OpDesc_Attr::b() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.b) + return b_; + } + inline void OpDesc_Attr::set_b(bool value) { + set_has_b(); + b_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.b) + } + + // repeated bool bools = 11; + inline int OpDesc_Attr::bools_size() const { return bools_.size(); } + inline void OpDesc_Attr::clear_bools() { bools_.Clear(); } + inline bool OpDesc_Attr::bools(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.bools) + return bools_.Get(index); + } + inline void OpDesc_Attr::set_bools(int index, bool value) { + bools_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.bools) + } + inline void OpDesc_Attr::add_bools(bool value) { + bools_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Attr.bools) + } + inline const ::google::protobuf::RepeatedField & + OpDesc_Attr::bools() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) + return bools_; + } + inline ::google::protobuf::RepeatedField * + OpDesc_Attr::mutable_bools() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Attr.bools) + return &bools_; + } + + // optional int32 block_idx = 12; + inline bool OpDesc_Attr::has_block_idx() const { + return (_has_bits_[0] & 0x00000080u) != 0; + } + inline void OpDesc_Attr::set_has_block_idx() { + _has_bits_[0] |= 0x00000080u; + } + inline void OpDesc_Attr::clear_has_block_idx() { + _has_bits_[0] &= ~0x00000080u; + } + inline void OpDesc_Attr::clear_block_idx() { + block_idx_ = 0; + clear_has_block_idx(); + } + inline ::google::protobuf::int32 OpDesc_Attr::block_idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) + return block_idx_; + } + inline void + OpDesc_Attr::set_block_idx(::google::protobuf::int32 value) { + set_has_block_idx(); + block_idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.block_idx) + } + + // optional int64 l = 13; + inline bool OpDesc_Attr::has_l() const { + return (_has_bits_[0] & 0x00000040u) != 0; + } + inline void OpDesc_Attr::set_has_l() { + _has_bits_[0] |= 0x00000040u; + } + inline void OpDesc_Attr::clear_has_l() { + _has_bits_[0] &= ~0x00000040u; + } + inline void OpDesc_Attr::clear_l() { + l_ = GOOGLE_LONGLONG(0); + clear_has_l(); + } + inline ::google::protobuf::int64 OpDesc_Attr::l() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Attr.l) + return l_; + } + inline void OpDesc_Attr::set_l(::google::protobuf::int64 value) { + set_has_l(); + l_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Attr.l) + } + + // ------------------------------------------------------------------- + + // OpDesc_Var + + // required string parameter = 1; + inline bool OpDesc_Var::has_parameter() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void OpDesc_Var::set_has_parameter() { + _has_bits_[0] |= 0x00000001u; + } + inline void OpDesc_Var::clear_has_parameter() { + _has_bits_[0] &= ~0x00000001u; + } + inline void OpDesc_Var::clear_parameter() { + parameter_.ClearToEmptyNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_parameter(); + } + inline const ::std::string &OpDesc_Var::parameter() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.parameter) + return parameter_.GetNoArena(); + } + inline void OpDesc_Var::set_parameter(const ::std::string &value) { + set_has_parameter(); + parameter_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } #if LANG_CXX11 -inline void OpDesc_Var::set_parameter(::std::string &&value) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} + inline void OpDesc_Var::set_parameter(::std::string &&value) { + set_has_parameter(); + parameter_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } #endif -inline void OpDesc_Var::set_parameter(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} -inline void OpDesc_Var::set_parameter(const char *value, size_t size) { - set_has_parameter(); - parameter_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} -inline ::std::string *OpDesc_Var::mutable_parameter() { - set_has_parameter(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.parameter) - return parameter_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpDesc_Var::release_parameter() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Var.parameter) - clear_has_parameter(); - return parameter_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpDesc_Var::set_allocated_parameter(::std::string *parameter) { - if (parameter != NULL) { - set_has_parameter(); - } else { - clear_has_parameter(); - } - parameter_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), parameter); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Var.parameter) -} - -// repeated string arguments = 2; -inline int OpDesc_Var::arguments_size() const { return arguments_.size(); } -inline void OpDesc_Var::clear_arguments() { arguments_.Clear(); } -inline const ::std::string &OpDesc_Var::arguments(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_.Get(index); -} -inline ::std::string *OpDesc_Var::mutable_arguments(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_.Mutable(index); -} -inline void OpDesc_Var::set_arguments(int index, const ::std::string &value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) - arguments_.Mutable(index)->assign(value); -} + inline void OpDesc_Var::set_parameter(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_parameter(); + parameter_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } + inline void OpDesc_Var::set_parameter(const char *value, + size_t size) { + set_has_parameter(); + parameter_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } + inline ::std::string *OpDesc_Var::mutable_parameter() { + set_has_parameter(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.parameter) + return parameter_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpDesc_Var::release_parameter() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.Var.parameter) + clear_has_parameter(); + return parameter_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void + OpDesc_Var::set_allocated_parameter(::std::string *parameter) { + if (parameter != NULL) { + set_has_parameter(); + } else { + clear_has_parameter(); + } + parameter_.SetAllocatedNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + parameter); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.Var.parameter) + } + + // repeated string arguments = 2; + inline int OpDesc_Var::arguments_size() const { + return arguments_.size(); + } + inline void OpDesc_Var::clear_arguments() { arguments_.Clear(); } + inline const ::std::string &OpDesc_Var::arguments(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_.Get(index); + } + inline ::std::string *OpDesc_Var::mutable_arguments(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_.Mutable(index); + } + inline void OpDesc_Var::set_arguments(int index, + const ::std::string &value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) + arguments_.Mutable(index)->assign(value); + } #if LANG_CXX11 -inline void OpDesc_Var::set_arguments(int index, ::std::string &&value) { - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) - arguments_.Mutable(index)->assign(std::move(value)); -} + inline void OpDesc_Var::set_arguments(int index, + ::std::string &&value) { + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.Var.arguments) + arguments_.Mutable(index)->assign(std::move(value)); + } #endif -inline void OpDesc_Var::set_arguments(int index, const char *value) { - GOOGLE_DCHECK(value != NULL); - arguments_.Mutable(index)->assign(value); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -inline void OpDesc_Var::set_arguments(int index, const char *value, - size_t size) { - arguments_.Mutable(index)->assign(reinterpret_cast(value), - size); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -inline ::std::string *OpDesc_Var::add_arguments() { - // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_.Add(); -} -inline void OpDesc_Var::add_arguments(const ::std::string &value) { - arguments_.Add()->assign(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} + inline void OpDesc_Var::set_arguments(int index, + const char *value) { + GOOGLE_DCHECK(value != NULL); + arguments_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + inline void OpDesc_Var::set_arguments(int index, const char *value, + size_t size) { + arguments_.Mutable(index)->assign( + reinterpret_cast(value), size); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + inline ::std::string *OpDesc_Var::add_arguments() { + // @@protoc_insertion_point(field_add_mutable:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_.Add(); + } + inline void OpDesc_Var::add_arguments(const ::std::string &value) { + arguments_.Add()->assign(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } #if LANG_CXX11 -inline void OpDesc_Var::add_arguments(::std::string &&value) { - arguments_.Add(std::move(value)); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} + inline void OpDesc_Var::add_arguments(::std::string &&value) { + arguments_.Add(std::move(value)); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } #endif -inline void OpDesc_Var::add_arguments(const char *value) { - GOOGLE_DCHECK(value != NULL); - arguments_.Add()->assign(value); - // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -inline void OpDesc_Var::add_arguments(const char *value, size_t size) { - arguments_.Add()->assign(reinterpret_cast(value), size); - // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) -} -inline const ::google::protobuf::RepeatedPtrField<::std::string> & -OpDesc_Var::arguments() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return arguments_; -} -inline ::google::protobuf::RepeatedPtrField<::std::string> * -OpDesc_Var::mutable_arguments() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) - return &arguments_; -} - -// ------------------------------------------------------------------- - -// OpDesc - -// required string type = 3; -inline bool OpDesc::has_type() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void OpDesc::set_has_type() { _has_bits_[0] |= 0x00000001u; } -inline void OpDesc::clear_has_type() { _has_bits_[0] &= ~0x00000001u; } -inline void OpDesc::clear_type() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_type(); -} -inline const ::std::string &OpDesc::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.type) - return type_.GetNoArena(); -} -inline void OpDesc::set_type(const ::std::string &value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.type) -} + inline void OpDesc_Var::add_arguments(const char *value) { + GOOGLE_DCHECK(value != NULL); + arguments_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + inline void OpDesc_Var::add_arguments(const char *value, + size_t size) { + arguments_.Add()->assign(reinterpret_cast(value), + size); + // @@protoc_insertion_point(field_add_pointer:paddle_mobile.framework.proto.OpDesc.Var.arguments) + } + inline const ::google::protobuf::RepeatedPtrField<::std::string> & + OpDesc_Var::arguments() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return arguments_; + } + inline ::google::protobuf::RepeatedPtrField<::std::string> * + OpDesc_Var::mutable_arguments() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.Var.arguments) + return &arguments_; + } + + // ------------------------------------------------------------------- + + // OpDesc + + // required string type = 3; + inline bool OpDesc::has_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void OpDesc::set_has_type() { _has_bits_[0] |= 0x00000001u; } + inline void OpDesc::clear_has_type() { + _has_bits_[0] &= ~0x00000001u; + } + inline void OpDesc::clear_type() { + type_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_type(); + } + inline const ::std::string &OpDesc::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.type) + return type_.GetNoArena(); + } + inline void OpDesc::set_type(const ::std::string &value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.type) + } #if LANG_CXX11 -inline void OpDesc::set_type(::std::string &&value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.type) -} + inline void OpDesc::set_type(::std::string &&value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpDesc.type) + } #endif -inline void OpDesc::set_type(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.type) -} -inline void OpDesc::set_type(const char *value, size_t size) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.type) -} -inline ::std::string *OpDesc::mutable_type() { - set_has_type(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.type) - return type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpDesc::release_type() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.type) - clear_has_type(); - return type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpDesc::set_allocated_type(::std::string *type) { - if (type != NULL) { - set_has_type(); - } else { - clear_has_type(); - } - type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.type) -} - -// repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; -inline int OpDesc::inputs_size() const { return inputs_.size(); } -inline void OpDesc::clear_inputs() { inputs_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpDesc_Var & -OpDesc::inputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpDesc_Var * -OpDesc::mutable_inputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpDesc_Var *OpDesc::add_inputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> * -OpDesc::mutable_inputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.inputs) - return &inputs_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> & -OpDesc::inputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.inputs) - return inputs_; -} - -// repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; -inline int OpDesc::outputs_size() const { return outputs_.size(); } -inline void OpDesc::clear_outputs() { outputs_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpDesc_Var & -OpDesc::outputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpDesc_Var * -OpDesc::mutable_outputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpDesc_Var *OpDesc::add_outputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> * -OpDesc::mutable_outputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.outputs) - return &outputs_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Var> & -OpDesc::outputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.outputs) - return outputs_; -} - -// repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; -inline int OpDesc::attrs_size() const { return attrs_.size(); } -inline void OpDesc::clear_attrs() { attrs_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpDesc_Attr & -OpDesc::attrs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpDesc_Attr * -OpDesc::mutable_attrs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpDesc_Attr *OpDesc::add_attrs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> * -OpDesc::mutable_attrs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.attrs) - return &attrs_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc_Attr> & -OpDesc::attrs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.attrs) - return attrs_; -} - -// optional bool is_target = 5 [default = false]; -inline bool OpDesc::has_is_target() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void OpDesc::set_has_is_target() { _has_bits_[0] |= 0x00000002u; } -inline void OpDesc::clear_has_is_target() { _has_bits_[0] &= ~0x00000002u; } -inline void OpDesc::clear_is_target() { - is_target_ = false; - clear_has_is_target(); -} -inline bool OpDesc::is_target() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.is_target) - return is_target_; -} -inline void OpDesc::set_is_target(bool value) { - set_has_is_target(); - is_target_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.is_target) -} - -// ------------------------------------------------------------------- - -// OpProto_Var - -// required string name = 1; -inline bool OpProto_Var::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void OpProto_Var::set_has_name() { _has_bits_[0] |= 0x00000001u; } -inline void OpProto_Var::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -inline void OpProto_Var::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -inline const ::std::string &OpProto_Var::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.name) - return name_.GetNoArena(); -} -inline void OpProto_Var::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.name) -} + inline void OpDesc::set_type(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpDesc.type) + } + inline void OpDesc::set_type(const char *value, size_t size) { + set_has_type(); + type_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpDesc.type) + } + inline ::std::string *OpDesc::mutable_type() { + set_has_type(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.type) + return type_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpDesc::release_type() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpDesc.type) + clear_has_type(); + return type_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpDesc::set_allocated_type(::std::string *type) { + if (type != NULL) { + set_has_type(); + } else { + clear_has_type(); + } + type_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + type); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpDesc.type) + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var inputs = 1; + inline int OpDesc::inputs_size() const { return inputs_.size(); } + inline void OpDesc::clear_inputs() { inputs_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpDesc_Var & + OpDesc::inputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::add_inputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> * + OpDesc::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.inputs) + return &inputs_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> & + OpDesc::inputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.inputs) + return inputs_; + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Var outputs = 2; + inline int OpDesc::outputs_size() const { return outputs_.size(); } + inline void OpDesc::clear_outputs() { outputs_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpDesc_Var & + OpDesc::outputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpDesc_Var * + OpDesc::add_outputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> * + OpDesc::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.outputs) + return &outputs_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Var> & + OpDesc::outputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.outputs) + return outputs_; + } + + // repeated .paddle_mobile.framework.proto.OpDesc.Attr attrs = 4; + inline int OpDesc::attrs_size() const { return attrs_.size(); } + inline void OpDesc::clear_attrs() { attrs_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpDesc_Attr & + OpDesc::attrs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpDesc_Attr * + OpDesc::mutable_attrs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpDesc_Attr * + OpDesc::add_attrs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> * + OpDesc::mutable_attrs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpDesc.attrs) + return &attrs_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc_Attr> & + OpDesc::attrs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpDesc.attrs) + return attrs_; + } + + // optional bool is_target = 5 [default = false]; + inline bool OpDesc::has_is_target() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void OpDesc::set_has_is_target() { + _has_bits_[0] |= 0x00000002u; + } + inline void OpDesc::clear_has_is_target() { + _has_bits_[0] &= ~0x00000002u; + } + inline void OpDesc::clear_is_target() { + is_target_ = false; + clear_has_is_target(); + } + inline bool OpDesc::is_target() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpDesc.is_target) + return is_target_; + } + inline void OpDesc::set_is_target(bool value) { + set_has_is_target(); + is_target_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpDesc.is_target) + } + + // ------------------------------------------------------------------- + + // OpProto_Var + + // required string name = 1; + inline bool OpProto_Var::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void OpProto_Var::set_has_name() { + _has_bits_[0] |= 0x00000001u; + } + inline void OpProto_Var::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + inline void OpProto_Var::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + inline const ::std::string &OpProto_Var::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.name) + return name_.GetNoArena(); + } + inline void OpProto_Var::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.name) + } #if LANG_CXX11 -inline void OpProto_Var::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.name) -} + inline void OpProto_Var::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.name) + } #endif -inline void OpProto_Var::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.name) -} -inline void OpProto_Var::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.name) -} -inline ::std::string *OpProto_Var::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpProto_Var::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpProto_Var::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.name) -} - -// required string comment = 2; -inline bool OpProto_Var::has_comment() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void OpProto_Var::set_has_comment() { _has_bits_[0] |= 0x00000002u; } -inline void OpProto_Var::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } -inline void OpProto_Var::clear_comment() { - comment_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_comment(); -} -inline const ::std::string &OpProto_Var::comment() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.comment) - return comment_.GetNoArena(); -} -inline void OpProto_Var::set_comment(const ::std::string &value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.comment) -} + inline void OpProto_Var::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.name) + } + inline void OpProto_Var::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.name) + } + inline ::std::string *OpProto_Var::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpProto_Var::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpProto_Var::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.name) + } + + // required string comment = 2; + inline bool OpProto_Var::has_comment() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void OpProto_Var::set_has_comment() { + _has_bits_[0] |= 0x00000002u; + } + inline void OpProto_Var::clear_has_comment() { + _has_bits_[0] &= ~0x00000002u; + } + inline void OpProto_Var::clear_comment() { + comment_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_comment(); + } + inline const ::std::string &OpProto_Var::comment() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.comment) + return comment_.GetNoArena(); + } + inline void OpProto_Var::set_comment(const ::std::string &value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.comment) + } #if LANG_CXX11 -inline void OpProto_Var::set_comment(::std::string &&value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.comment) -} + inline void OpProto_Var::set_comment(::std::string &&value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Var.comment) + } #endif -inline void OpProto_Var::set_comment(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.comment) -} -inline void OpProto_Var::set_comment(const char *value, size_t size) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.comment) -} -inline ::std::string *OpProto_Var::mutable_comment() { - set_has_comment(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.comment) - return comment_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpProto_Var::release_comment() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.comment) - clear_has_comment(); - return comment_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpProto_Var::set_allocated_comment(::std::string *comment) { - if (comment != NULL) { - set_has_comment(); - } else { - clear_has_comment(); - } - comment_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), comment); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.comment) -} - -// optional bool duplicable = 3 [default = false]; -inline bool OpProto_Var::has_duplicable() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void OpProto_Var::set_has_duplicable() { _has_bits_[0] |= 0x00000004u; } -inline void OpProto_Var::clear_has_duplicable() { - _has_bits_[0] &= ~0x00000004u; -} -inline void OpProto_Var::clear_duplicable() { - duplicable_ = false; - clear_has_duplicable(); -} -inline bool OpProto_Var::duplicable() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.duplicable) - return duplicable_; -} -inline void OpProto_Var::set_duplicable(bool value) { - set_has_duplicable(); - duplicable_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.duplicable) -} - -// optional bool intermediate = 4 [default = false]; -inline bool OpProto_Var::has_intermediate() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void OpProto_Var::set_has_intermediate() { - _has_bits_[0] |= 0x00000008u; -} -inline void OpProto_Var::clear_has_intermediate() { - _has_bits_[0] &= ~0x00000008u; -} -inline void OpProto_Var::clear_intermediate() { - intermediate_ = false; - clear_has_intermediate(); -} -inline bool OpProto_Var::intermediate() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.intermediate) - return intermediate_; -} -inline void OpProto_Var::set_intermediate(bool value) { - set_has_intermediate(); - intermediate_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.intermediate) -} - -// optional bool dispensable = 5 [default = false]; -inline bool OpProto_Var::has_dispensable() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -inline void OpProto_Var::set_has_dispensable() { _has_bits_[0] |= 0x00000010u; } -inline void OpProto_Var::clear_has_dispensable() { - _has_bits_[0] &= ~0x00000010u; -} -inline void OpProto_Var::clear_dispensable() { - dispensable_ = false; - clear_has_dispensable(); -} -inline bool OpProto_Var::dispensable() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.dispensable) - return dispensable_; -} -inline void OpProto_Var::set_dispensable(bool value) { - set_has_dispensable(); - dispensable_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.dispensable) -} - -// ------------------------------------------------------------------- - -// OpProto_Attr - -// required string name = 1; -inline bool OpProto_Attr::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void OpProto_Attr::set_has_name() { _has_bits_[0] |= 0x00000001u; } -inline void OpProto_Attr::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -inline void OpProto_Attr::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -inline const ::std::string &OpProto_Attr::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.name) - return name_.GetNoArena(); -} -inline void OpProto_Attr::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.name) -} + inline void OpProto_Var::set_comment(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Var.comment) + } + inline void OpProto_Var::set_comment(const char *value, + size_t size) { + set_has_comment(); + comment_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Var.comment) + } + inline ::std::string *OpProto_Var::mutable_comment() { + set_has_comment(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Var.comment) + return comment_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpProto_Var::release_comment() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Var.comment) + clear_has_comment(); + return comment_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void + OpProto_Var::set_allocated_comment(::std::string *comment) { + if (comment != NULL) { + set_has_comment(); + } else { + clear_has_comment(); + } + comment_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + comment); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Var.comment) + } + + // optional bool duplicable = 3 [default = false]; + inline bool OpProto_Var::has_duplicable() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + inline void OpProto_Var::set_has_duplicable() { + _has_bits_[0] |= 0x00000004u; + } + inline void OpProto_Var::clear_has_duplicable() { + _has_bits_[0] &= ~0x00000004u; + } + inline void OpProto_Var::clear_duplicable() { + duplicable_ = false; + clear_has_duplicable(); + } + inline bool OpProto_Var::duplicable() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.duplicable) + return duplicable_; + } + inline void OpProto_Var::set_duplicable(bool value) { + set_has_duplicable(); + duplicable_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.duplicable) + } + + // optional bool intermediate = 4 [default = false]; + inline bool OpProto_Var::has_intermediate() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + inline void OpProto_Var::set_has_intermediate() { + _has_bits_[0] |= 0x00000008u; + } + inline void OpProto_Var::clear_has_intermediate() { + _has_bits_[0] &= ~0x00000008u; + } + inline void OpProto_Var::clear_intermediate() { + intermediate_ = false; + clear_has_intermediate(); + } + inline bool OpProto_Var::intermediate() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.intermediate) + return intermediate_; + } + inline void OpProto_Var::set_intermediate(bool value) { + set_has_intermediate(); + intermediate_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.intermediate) + } + + // optional bool dispensable = 5 [default = false]; + inline bool OpProto_Var::has_dispensable() const { + return (_has_bits_[0] & 0x00000010u) != 0; + } + inline void OpProto_Var::set_has_dispensable() { + _has_bits_[0] |= 0x00000010u; + } + inline void OpProto_Var::clear_has_dispensable() { + _has_bits_[0] &= ~0x00000010u; + } + inline void OpProto_Var::clear_dispensable() { + dispensable_ = false; + clear_has_dispensable(); + } + inline bool OpProto_Var::dispensable() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Var.dispensable) + return dispensable_; + } + inline void OpProto_Var::set_dispensable(bool value) { + set_has_dispensable(); + dispensable_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Var.dispensable) + } + + // ------------------------------------------------------------------- + + // OpProto_Attr + + // required string name = 1; + inline bool OpProto_Attr::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void OpProto_Attr::set_has_name() { + _has_bits_[0] |= 0x00000001u; + } + inline void OpProto_Attr::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + inline void OpProto_Attr::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + inline const ::std::string &OpProto_Attr::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.name) + return name_.GetNoArena(); + } + inline void OpProto_Attr::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.name) + } #if LANG_CXX11 -inline void OpProto_Attr::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.name) -} + inline void OpProto_Attr::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.name) + } #endif -inline void OpProto_Attr::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.name) -} -inline void OpProto_Attr::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.name) -} -inline ::std::string *OpProto_Attr::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpProto_Attr::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpProto_Attr::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.name) -} - -// required .paddle_mobile.framework.proto.AttrType type = 2; -inline bool OpProto_Attr::has_type() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void OpProto_Attr::set_has_type() { _has_bits_[0] |= 0x00000004u; } -inline void OpProto_Attr::clear_has_type() { _has_bits_[0] &= ~0x00000004u; } -inline void OpProto_Attr::clear_type() { - type_ = 0; - clear_has_type(); -} -inline ::paddle_mobile::framework::proto::AttrType OpProto_Attr::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.type) - return static_cast<::paddle_mobile::framework::proto::AttrType>(type_); -} -inline void -OpProto_Attr::set_type(::paddle_mobile::framework::proto::AttrType value) { - assert(::paddle_mobile::framework::proto::AttrType_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.type) -} - -// required string comment = 3; -inline bool OpProto_Attr::has_comment() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void OpProto_Attr::set_has_comment() { _has_bits_[0] |= 0x00000002u; } -inline void OpProto_Attr::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } -inline void OpProto_Attr::clear_comment() { - comment_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_comment(); -} -inline const ::std::string &OpProto_Attr::comment() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.comment) - return comment_.GetNoArena(); -} -inline void OpProto_Attr::set_comment(const ::std::string &value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.comment) -} + inline void OpProto_Attr::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.name) + } + inline void OpProto_Attr::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.name) + } + inline ::std::string *OpProto_Attr::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpProto_Attr::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpProto_Attr::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.name) + } + + // required .paddle_mobile.framework.proto.AttrType type = 2; + inline bool OpProto_Attr::has_type() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + inline void OpProto_Attr::set_has_type() { + _has_bits_[0] |= 0x00000004u; + } + inline void OpProto_Attr::clear_has_type() { + _has_bits_[0] &= ~0x00000004u; + } + inline void OpProto_Attr::clear_type() { + type_ = 0; + clear_has_type(); + } + inline ::paddle_mobile::framework::proto::AttrType + OpProto_Attr::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.type) + return static_cast<::paddle_mobile::framework::proto::AttrType>( + type_); + } + inline void OpProto_Attr::set_type( + ::paddle_mobile::framework::proto::AttrType value) { + assert( + ::paddle_mobile::framework::proto::AttrType_IsValid(value)); + set_has_type(); + type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.type) + } + + // required string comment = 3; + inline bool OpProto_Attr::has_comment() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void OpProto_Attr::set_has_comment() { + _has_bits_[0] |= 0x00000002u; + } + inline void OpProto_Attr::clear_has_comment() { + _has_bits_[0] &= ~0x00000002u; + } + inline void OpProto_Attr::clear_comment() { + comment_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_comment(); + } + inline const ::std::string &OpProto_Attr::comment() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.comment) + return comment_.GetNoArena(); + } + inline void OpProto_Attr::set_comment(const ::std::string &value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.comment) + } #if LANG_CXX11 -inline void OpProto_Attr::set_comment(::std::string &&value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.comment) -} + inline void OpProto_Attr::set_comment(::std::string &&value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.Attr.comment) + } #endif -inline void OpProto_Attr::set_comment(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.comment) -} -inline void OpProto_Attr::set_comment(const char *value, size_t size) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.comment) -} -inline ::std::string *OpProto_Attr::mutable_comment() { - set_has_comment(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.comment) - return comment_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpProto_Attr::release_comment() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.comment) - clear_has_comment(); - return comment_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpProto_Attr::set_allocated_comment(::std::string *comment) { - if (comment != NULL) { - set_has_comment(); - } else { - clear_has_comment(); - } - comment_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), comment); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.comment) -} - -// optional bool generated = 4 [default = false]; -inline bool OpProto_Attr::has_generated() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void OpProto_Attr::set_has_generated() { _has_bits_[0] |= 0x00000008u; } -inline void OpProto_Attr::clear_has_generated() { - _has_bits_[0] &= ~0x00000008u; -} -inline void OpProto_Attr::clear_generated() { - generated_ = false; - clear_has_generated(); -} -inline bool OpProto_Attr::generated() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.generated) - return generated_; -} -inline void OpProto_Attr::set_generated(bool value) { - set_has_generated(); - generated_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.generated) -} - -// ------------------------------------------------------------------- - -// OpProto - -// required string type = 1; -inline bool OpProto::has_type() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void OpProto::set_has_type() { _has_bits_[0] |= 0x00000001u; } -inline void OpProto::clear_has_type() { _has_bits_[0] &= ~0x00000001u; } -inline void OpProto::clear_type() { - type_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_type(); -} -inline const ::std::string &OpProto::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.type) - return type_.GetNoArena(); -} -inline void OpProto::set_type(const ::std::string &value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.type) -} + inline void OpProto_Attr::set_comment(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.Attr.comment) + } + inline void OpProto_Attr::set_comment(const char *value, + size_t size) { + set_has_comment(); + comment_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.Attr.comment) + } + inline ::std::string *OpProto_Attr::mutable_comment() { + set_has_comment(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.Attr.comment) + return comment_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpProto_Attr::release_comment() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.Attr.comment) + clear_has_comment(); + return comment_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void + OpProto_Attr::set_allocated_comment(::std::string *comment) { + if (comment != NULL) { + set_has_comment(); + } else { + clear_has_comment(); + } + comment_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + comment); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.Attr.comment) + } + + // optional bool generated = 4 [default = false]; + inline bool OpProto_Attr::has_generated() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + inline void OpProto_Attr::set_has_generated() { + _has_bits_[0] |= 0x00000008u; + } + inline void OpProto_Attr::clear_has_generated() { + _has_bits_[0] &= ~0x00000008u; + } + inline void OpProto_Attr::clear_generated() { + generated_ = false; + clear_has_generated(); + } + inline bool OpProto_Attr::generated() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.Attr.generated) + return generated_; + } + inline void OpProto_Attr::set_generated(bool value) { + set_has_generated(); + generated_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.Attr.generated) + } + + // ------------------------------------------------------------------- + + // OpProto + + // required string type = 1; + inline bool OpProto::has_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void OpProto::set_has_type() { + _has_bits_[0] |= 0x00000001u; + } + inline void OpProto::clear_has_type() { + _has_bits_[0] &= ~0x00000001u; + } + inline void OpProto::clear_type() { + type_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_type(); + } + inline const ::std::string &OpProto::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.type) + return type_.GetNoArena(); + } + inline void OpProto::set_type(const ::std::string &value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.type) + } #if LANG_CXX11 -inline void OpProto::set_type(::std::string &&value) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.type) -} + inline void OpProto::set_type(::std::string &&value) { + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.type) + } #endif -inline void OpProto::set_type(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.type) -} -inline void OpProto::set_type(const char *value, size_t size) { - set_has_type(); - type_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.type) -} -inline ::std::string *OpProto::mutable_type() { - set_has_type(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.type) - return type_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpProto::release_type() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.type) - clear_has_type(); - return type_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpProto::set_allocated_type(::std::string *type) { - if (type != NULL) { - set_has_type(); - } else { - clear_has_type(); - } - type_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), type); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.type) -} - -// repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; -inline int OpProto::inputs_size() const { return inputs_.size(); } -inline void OpProto::clear_inputs() { inputs_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpProto_Var & -OpProto::inputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpProto_Var * -OpProto::mutable_inputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpProto_Var *OpProto::add_inputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> * -OpProto::mutable_inputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.inputs) - return &inputs_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> & -OpProto::inputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.inputs) - return inputs_; -} - -// repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; -inline int OpProto::outputs_size() const { return outputs_.size(); } -inline void OpProto::clear_outputs() { outputs_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpProto_Var & -OpProto::outputs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpProto_Var * -OpProto::mutable_outputs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpProto_Var *OpProto::add_outputs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> * -OpProto::mutable_outputs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.outputs) - return &outputs_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Var> & -OpProto::outputs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.outputs) - return outputs_; -} - -// repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; -inline int OpProto::attrs_size() const { return attrs_.size(); } -inline void OpProto::clear_attrs() { attrs_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpProto_Attr & -OpProto::attrs(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpProto_Attr * -OpProto::mutable_attrs(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpProto_Attr *OpProto::add_attrs() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> * -OpProto::mutable_attrs() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.attrs) - return &attrs_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpProto_Attr> & -OpProto::attrs() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.attrs) - return attrs_; -} - -// required string comment = 5; -inline bool OpProto::has_comment() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void OpProto::set_has_comment() { _has_bits_[0] |= 0x00000002u; } -inline void OpProto::clear_has_comment() { _has_bits_[0] &= ~0x00000002u; } -inline void OpProto::clear_comment() { - comment_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_comment(); -} -inline const ::std::string &OpProto::comment() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.comment) - return comment_.GetNoArena(); -} -inline void OpProto::set_comment(const ::std::string &value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.comment) -} + inline void OpProto::set_type(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_type(); + type_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.type) + } + inline void OpProto::set_type(const char *value, size_t size) { + set_has_type(); + type_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.type) + } + inline ::std::string *OpProto::mutable_type() { + set_has_type(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.type) + return type_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpProto::release_type() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.type) + clear_has_type(); + return type_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpProto::set_allocated_type(::std::string *type) { + if (type != NULL) { + set_has_type(); + } else { + clear_has_type(); + } + type_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + type); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.type) + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var inputs = 2; + inline int OpProto::inputs_size() const { return inputs_.size(); } + inline void OpProto::clear_inputs() { inputs_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpProto_Var & + OpProto::inputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::add_inputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> * + OpProto::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.inputs) + return &inputs_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> & + OpProto::inputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.inputs) + return inputs_; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Var outputs = 3; + inline int OpProto::outputs_size() const { return outputs_.size(); } + inline void OpProto::clear_outputs() { outputs_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpProto_Var & + OpProto::outputs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpProto_Var * + OpProto::add_outputs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> * + OpProto::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.outputs) + return &outputs_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Var> & + OpProto::outputs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.outputs) + return outputs_; + } + + // repeated .paddle_mobile.framework.proto.OpProto.Attr attrs = 4; + inline int OpProto::attrs_size() const { return attrs_.size(); } + inline void OpProto::clear_attrs() { attrs_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpProto_Attr & + OpProto::attrs(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpProto_Attr * + OpProto::mutable_attrs(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpProto_Attr * + OpProto::add_attrs() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> * + OpProto::mutable_attrs() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.OpProto.attrs) + return &attrs_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpProto_Attr> & + OpProto::attrs() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.OpProto.attrs) + return attrs_; + } + + // required string comment = 5; + inline bool OpProto::has_comment() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void OpProto::set_has_comment() { + _has_bits_[0] |= 0x00000002u; + } + inline void OpProto::clear_has_comment() { + _has_bits_[0] &= ~0x00000002u; + } + inline void OpProto::clear_comment() { + comment_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_comment(); + } + inline const ::std::string &OpProto::comment() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.OpProto.comment) + return comment_.GetNoArena(); + } + inline void OpProto::set_comment(const ::std::string &value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.OpProto.comment) + } #if LANG_CXX11 -inline void OpProto::set_comment(::std::string &&value) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.comment) -} + inline void OpProto::set_comment(::std::string &&value) { + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.OpProto.comment) + } #endif -inline void OpProto::set_comment(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.comment) -} -inline void OpProto::set_comment(const char *value, size_t size) { - set_has_comment(); - comment_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.comment) -} -inline ::std::string *OpProto::mutable_comment() { - set_has_comment(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.comment) - return comment_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *OpProto::release_comment() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.comment) - clear_has_comment(); - return comment_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void OpProto::set_allocated_comment(::std::string *comment) { - if (comment != NULL) { - set_has_comment(); - } else { - clear_has_comment(); - } - comment_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), comment); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.comment) -} - -// ------------------------------------------------------------------- - -// VarType_TensorDesc - -// required .paddle_mobile.framework.proto.VarType.Type data_type = 1; -inline bool VarType_TensorDesc::has_data_type() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void VarType_TensorDesc::set_has_data_type() { - _has_bits_[0] |= 0x00000001u; -} -inline void VarType_TensorDesc::clear_has_data_type() { - _has_bits_[0] &= ~0x00000001u; -} -inline void VarType_TensorDesc::clear_data_type() { - data_type_ = 0; - clear_has_data_type(); -} -inline ::paddle_mobile::framework::proto::VarType_Type -VarType_TensorDesc::data_type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>( - data_type_); -} -inline void VarType_TensorDesc::set_data_type( - ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - set_has_data_type(); - data_type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) -} - -// repeated int64 dims = 2; -inline int VarType_TensorDesc::dims_size() const { return dims_.size(); } -inline void VarType_TensorDesc::clear_dims() { dims_.Clear(); } -inline ::google::protobuf::int64 VarType_TensorDesc::dims(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.dims) - return dims_.Get(index); -} -inline void VarType_TensorDesc::set_dims(int index, + inline void OpProto::set_comment(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_comment(); + comment_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.OpProto.comment) + } + inline void OpProto::set_comment(const char *value, size_t size) { + set_has_comment(); + comment_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.OpProto.comment) + } + inline ::std::string *OpProto::mutable_comment() { + set_has_comment(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.OpProto.comment) + return comment_.MutableNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *OpProto::release_comment() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.OpProto.comment) + clear_has_comment(); + return comment_.ReleaseNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void OpProto::set_allocated_comment(::std::string *comment) { + if (comment != NULL) { + set_has_comment(); + } else { + clear_has_comment(); + } + comment_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + comment); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.OpProto.comment) + } + + // ------------------------------------------------------------------- + + // VarType_TensorDesc + + // required .paddle_mobile.framework.proto.VarType.Type data_type = + // 1; + inline bool VarType_TensorDesc::has_data_type() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void VarType_TensorDesc::set_has_data_type() { + _has_bits_[0] |= 0x00000001u; + } + inline void VarType_TensorDesc::clear_has_data_type() { + _has_bits_[0] &= ~0x00000001u; + } + inline void VarType_TensorDesc::clear_data_type() { + data_type_ = 0; + clear_has_data_type(); + } + inline ::paddle_mobile::framework::proto::VarType_Type + VarType_TensorDesc::data_type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>( + data_type_); + } + inline void VarType_TensorDesc::set_data_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + set_has_data_type(); + data_type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.data_type) + } + + // repeated int64 dims = 2; + inline int VarType_TensorDesc::dims_size() const { + return dims_.size(); + } + inline void VarType_TensorDesc::clear_dims() { dims_.Clear(); } + inline ::google::protobuf::int64 + VarType_TensorDesc::dims(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + return dims_.Get(index); + } + inline void + VarType_TensorDesc::set_dims(int index, ::google::protobuf::int64 value) { - dims_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.dims) -} -inline void VarType_TensorDesc::add_dims(::google::protobuf::int64 value) { - dims_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.TensorDesc.dims) -} -inline const ::google::protobuf::RepeatedField<::google::protobuf::int64> & -VarType_TensorDesc::dims() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) - return dims_; -} -inline ::google::protobuf::RepeatedField<::google::protobuf::int64> * -VarType_TensorDesc::mutable_dims() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) - return &dims_; -} - -// ------------------------------------------------------------------- - -// VarType_LoDTensorDesc - -// required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; -inline bool VarType_LoDTensorDesc::has_tensor() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void VarType_LoDTensorDesc::set_has_tensor() { - _has_bits_[0] |= 0x00000001u; -} -inline void VarType_LoDTensorDesc::clear_has_tensor() { - _has_bits_[0] &= ~0x00000001u; -} -inline void VarType_LoDTensorDesc::clear_tensor() { - if (tensor_ != NULL) - tensor_->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - clear_has_tensor(); -} -inline const ::paddle_mobile::framework::proto::VarType_TensorDesc & -VarType_LoDTensorDesc::tensor() const { - const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = tensor_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_TensorDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_TensorDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorDesc::mutable_tensor() { - set_has_tensor(); - if (tensor_ == NULL) { - tensor_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) - return tensor_; -} -inline ::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorDesc::release_tensor() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) - clear_has_tensor(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = tensor_; - tensor_ = NULL; - return temp; -} -inline void VarType_LoDTensorDesc::set_allocated_tensor( - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { - delete tensor_; - tensor_ = tensor; - if (tensor) { - set_has_tensor(); - } else { - clear_has_tensor(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) -} - -// optional int32 lod_level = 2 [default = 0]; -inline bool VarType_LoDTensorDesc::has_lod_level() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void VarType_LoDTensorDesc::set_has_lod_level() { - _has_bits_[0] |= 0x00000002u; -} -inline void VarType_LoDTensorDesc::clear_has_lod_level() { - _has_bits_[0] &= ~0x00000002u; -} -inline void VarType_LoDTensorDesc::clear_lod_level() { - lod_level_ = 0; - clear_has_lod_level(); -} -inline ::google::protobuf::int32 VarType_LoDTensorDesc::lod_level() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) - return lod_level_; -} -inline void -VarType_LoDTensorDesc::set_lod_level(::google::protobuf::int32 value) { - set_has_lod_level(); - lod_level_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) -} - -// ------------------------------------------------------------------- - -// VarType_LoDTensorArrayDesc - -// required .paddle_mobile.framework.proto.VarType.TensorDesc tensor = 1; -inline bool VarType_LoDTensorArrayDesc::has_tensor() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void VarType_LoDTensorArrayDesc::set_has_tensor() { - _has_bits_[0] |= 0x00000001u; -} -inline void VarType_LoDTensorArrayDesc::clear_has_tensor() { - _has_bits_[0] &= ~0x00000001u; -} -inline void VarType_LoDTensorArrayDesc::clear_tensor() { - if (tensor_ != NULL) - tensor_->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - clear_has_tensor(); -} -inline const ::paddle_mobile::framework::proto::VarType_TensorDesc & -VarType_LoDTensorArrayDesc::tensor() const { - const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = tensor_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_TensorDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_TensorDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorArrayDesc::mutable_tensor() { - set_has_tensor(); - if (tensor_ == NULL) { - tensor_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) - return tensor_; -} -inline ::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType_LoDTensorArrayDesc::release_tensor() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) - clear_has_tensor(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = tensor_; - tensor_ = NULL; - return temp; -} -inline void VarType_LoDTensorArrayDesc::set_allocated_tensor( - ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { - delete tensor_; - tensor_ = tensor; - if (tensor) { - set_has_tensor(); - } else { - clear_has_tensor(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) -} - -// optional int32 lod_level = 2 [default = 0]; -inline bool VarType_LoDTensorArrayDesc::has_lod_level() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void VarType_LoDTensorArrayDesc::set_has_lod_level() { - _has_bits_[0] |= 0x00000002u; -} -inline void VarType_LoDTensorArrayDesc::clear_has_lod_level() { - _has_bits_[0] &= ~0x00000002u; -} -inline void VarType_LoDTensorArrayDesc::clear_lod_level() { - lod_level_ = 0; - clear_has_lod_level(); -} -inline ::google::protobuf::int32 VarType_LoDTensorArrayDesc::lod_level() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) - return lod_level_; -} -inline void -VarType_LoDTensorArrayDesc::set_lod_level(::google::protobuf::int32 value) { - set_has_lod_level(); - lod_level_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) -} - -// ------------------------------------------------------------------- - -// VarType_ReaderDesc - -// repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = 1; -inline int VarType_ReaderDesc::lod_tensor_size() const { - return lod_tensor_.size(); -} -inline void VarType_ReaderDesc::clear_lod_tensor() { lod_tensor_.Clear(); } -inline const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & -VarType_ReaderDesc::lod_tensor(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_.Get(index); -} -inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType_ReaderDesc::mutable_lod_tensor(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType_ReaderDesc::add_lod_tensor() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> * -VarType_ReaderDesc::mutable_lod_tensor() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return &lod_tensor_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> & -VarType_ReaderDesc::lod_tensor() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) - return lod_tensor_; -} - -// ------------------------------------------------------------------- - -// VarType_ChannelDesc - -// required .paddle_mobile.framework.proto.VarType.Type data_type = 1; -inline bool VarType_ChannelDesc::has_data_type() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void VarType_ChannelDesc::set_has_data_type() { - _has_bits_[0] |= 0x00000002u; -} -inline void VarType_ChannelDesc::clear_has_data_type() { - _has_bits_[0] &= ~0x00000002u; -} -inline void VarType_ChannelDesc::clear_data_type() { - data_type_ = 0; - clear_has_data_type(); -} -inline ::paddle_mobile::framework::proto::VarType_Type -VarType_ChannelDesc::data_type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>( - data_type_); -} -inline void VarType_ChannelDesc::set_data_type( - ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - set_has_data_type(); - data_type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) -} - -// required int64 capacity = 2; -inline bool VarType_ChannelDesc::has_capacity() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void VarType_ChannelDesc::set_has_capacity() { - _has_bits_[0] |= 0x00000001u; -} -inline void VarType_ChannelDesc::clear_has_capacity() { - _has_bits_[0] &= ~0x00000001u; -} -inline void VarType_ChannelDesc::clear_capacity() { - capacity_ = GOOGLE_LONGLONG(0); - clear_has_capacity(); -} -inline ::google::protobuf::int64 VarType_ChannelDesc::capacity() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) - return capacity_; -} -inline void VarType_ChannelDesc::set_capacity(::google::protobuf::int64 value) { - set_has_capacity(); - capacity_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) -} - -// ------------------------------------------------------------------- - -// VarType_Tuple - -// repeated .paddle_mobile.framework.proto.VarType.Type element_type = 1; -inline int VarType_Tuple::element_type_size() const { - return element_type_.size(); -} -inline void VarType_Tuple::clear_element_type() { element_type_.Clear(); } -inline ::paddle_mobile::framework::proto::VarType_Type -VarType_Tuple::element_type(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.Tuple.element_type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>( - element_type_.Get(index)); -} -inline void VarType_Tuple::set_element_type( - int index, ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - element_type_.Set(index, value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.Tuple.element_type) -} -inline void VarType_Tuple::add_element_type( - ::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - element_type_.Add(value); - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.Tuple.element_type) -} -inline const ::google::protobuf::RepeatedField & -VarType_Tuple::element_type() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) - return element_type_; -} -inline ::google::protobuf::RepeatedField * -VarType_Tuple::mutable_element_type() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) - return &element_type_; -} - -// ------------------------------------------------------------------- - -// VarType - -// required .paddle_mobile.framework.proto.VarType.Type type = 1; -inline bool VarType::has_type() const { - return (_has_bits_[0] & 0x00000040u) != 0; -} -inline void VarType::set_has_type() { _has_bits_[0] |= 0x00000040u; } -inline void VarType::clear_has_type() { _has_bits_[0] &= ~0x00000040u; } -inline void VarType::clear_type() { - type_ = 0; - clear_has_type(); -} -inline ::paddle_mobile::framework::proto::VarType_Type VarType::type() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.type) - return static_cast<::paddle_mobile::framework::proto::VarType_Type>(type_); -} -inline void -VarType::set_type(::paddle_mobile::framework::proto::VarType_Type value) { - assert(::paddle_mobile::framework::proto::VarType_Type_IsValid(value)); - set_has_type(); - type_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.type) -} - -// optional .paddle_mobile.framework.proto.VarType.TensorDesc selected_rows = 2; -inline bool VarType::has_selected_rows() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void VarType::set_has_selected_rows() { _has_bits_[0] |= 0x00000001u; } -inline void VarType::clear_has_selected_rows() { - _has_bits_[0] &= ~0x00000001u; -} -inline void VarType::clear_selected_rows() { - if (selected_rows_ != NULL) - selected_rows_ - ->::paddle_mobile::framework::proto::VarType_TensorDesc::Clear(); - clear_has_selected_rows(); -} -inline const ::paddle_mobile::framework::proto::VarType_TensorDesc & -VarType::selected_rows() const { - const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = - selected_rows_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.selected_rows) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_TensorDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_TensorDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType::mutable_selected_rows() { - set_has_selected_rows(); - if (selected_rows_ == NULL) { - selected_rows_ = new ::paddle_mobile::framework::proto::VarType_TensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.selected_rows) - return selected_rows_; -} -inline ::paddle_mobile::framework::proto::VarType_TensorDesc * -VarType::release_selected_rows() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.selected_rows) - clear_has_selected_rows(); - ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = selected_rows_; - selected_rows_ = NULL; - return temp; -} -inline void VarType::set_allocated_selected_rows( - ::paddle_mobile::framework::proto::VarType_TensorDesc *selected_rows) { - delete selected_rows_; - selected_rows_ = selected_rows; - if (selected_rows) { - set_has_selected_rows(); - } else { - clear_has_selected_rows(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.selected_rows) -} - -// optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc lod_tensor = 3; -inline bool VarType::has_lod_tensor() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void VarType::set_has_lod_tensor() { _has_bits_[0] |= 0x00000002u; } -inline void VarType::clear_has_lod_tensor() { _has_bits_[0] &= ~0x00000002u; } -inline void VarType::clear_lod_tensor() { - if (lod_tensor_ != NULL) - lod_tensor_ - ->::paddle_mobile::framework::proto::VarType_LoDTensorDesc::Clear(); - clear_has_lod_tensor(); -} -inline const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc & -VarType::lod_tensor() const { - const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *p = - lod_tensor_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.lod_tensor) - return p != NULL ? *p : *reinterpret_cast( - &::paddle_mobile::framework::proto:: - _VarType_LoDTensorDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType::mutable_lod_tensor() { - set_has_lod_tensor(); - if (lod_tensor_ == NULL) { - lod_tensor_ = new ::paddle_mobile::framework::proto::VarType_LoDTensorDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.lod_tensor) - return lod_tensor_; -} -inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * -VarType::release_lod_tensor() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.lod_tensor) - clear_has_lod_tensor(); - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *temp = lod_tensor_; - lod_tensor_ = NULL; - return temp; -} -inline void VarType::set_allocated_lod_tensor( - ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *lod_tensor) { - delete lod_tensor_; - lod_tensor_ = lod_tensor; - if (lod_tensor) { - set_has_lod_tensor(); - } else { - clear_has_lod_tensor(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.lod_tensor) -} - -// optional .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc -// tensor_array = 4; -inline bool VarType::has_tensor_array() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void VarType::set_has_tensor_array() { _has_bits_[0] |= 0x00000004u; } -inline void VarType::clear_has_tensor_array() { _has_bits_[0] &= ~0x00000004u; } -inline void VarType::clear_tensor_array() { - if (tensor_array_ != NULL) - tensor_array_->::paddle_mobile::framework::proto:: - VarType_LoDTensorArrayDesc::Clear(); - clear_has_tensor_array(); -} -inline const ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc & -VarType::tensor_array() const { - const ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc *p = - tensor_array_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tensor_array) - return p != NULL ? *p - : *reinterpret_cast( - &::paddle_mobile::framework::proto:: - _VarType_LoDTensorArrayDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * -VarType::mutable_tensor_array() { - set_has_tensor_array(); - if (tensor_array_ == NULL) { - tensor_array_ = - new ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tensor_array) - return tensor_array_; -} -inline ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc * -VarType::release_tensor_array() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tensor_array) - clear_has_tensor_array(); - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc *temp = - tensor_array_; - tensor_array_ = NULL; - return temp; -} -inline void VarType::set_allocated_tensor_array( - ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc - *tensor_array) { - delete tensor_array_; - tensor_array_ = tensor_array; - if (tensor_array) { - set_has_tensor_array(); - } else { - clear_has_tensor_array(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tensor_array) -} - -// optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader = 5; -inline bool VarType::has_reader() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -inline void VarType::set_has_reader() { _has_bits_[0] |= 0x00000008u; } -inline void VarType::clear_has_reader() { _has_bits_[0] &= ~0x00000008u; } -inline void VarType::clear_reader() { - if (reader_ != NULL) - reader_->::paddle_mobile::framework::proto::VarType_ReaderDesc::Clear(); - clear_has_reader(); -} -inline const ::paddle_mobile::framework::proto::VarType_ReaderDesc & -VarType::reader() const { - const ::paddle_mobile::framework::proto::VarType_ReaderDesc *p = reader_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.reader) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_ReaderDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_ReaderDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_ReaderDesc * -VarType::mutable_reader() { - set_has_reader(); - if (reader_ == NULL) { - reader_ = new ::paddle_mobile::framework::proto::VarType_ReaderDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.reader) - return reader_; -} -inline ::paddle_mobile::framework::proto::VarType_ReaderDesc * -VarType::release_reader() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.reader) - clear_has_reader(); - ::paddle_mobile::framework::proto::VarType_ReaderDesc *temp = reader_; - reader_ = NULL; - return temp; -} -inline void VarType::set_allocated_reader( - ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader) { - delete reader_; - reader_ = reader; - if (reader) { - set_has_reader(); - } else { - clear_has_reader(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.reader) -} - -// optional .paddle_mobile.framework.proto.VarType.ChannelDesc channel = 6; -inline bool VarType::has_channel() const { - return (_has_bits_[0] & 0x00000010u) != 0; -} -inline void VarType::set_has_channel() { _has_bits_[0] |= 0x00000010u; } -inline void VarType::clear_has_channel() { _has_bits_[0] &= ~0x00000010u; } -inline void VarType::clear_channel() { - if (channel_ != NULL) - channel_->::paddle_mobile::framework::proto::VarType_ChannelDesc::Clear(); - clear_has_channel(); -} -inline const ::paddle_mobile::framework::proto::VarType_ChannelDesc & -VarType::channel() const { - const ::paddle_mobile::framework::proto::VarType_ChannelDesc *p = channel_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.channel) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_ChannelDesc - *>(&::paddle_mobile::framework::proto:: - _VarType_ChannelDesc_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_ChannelDesc * -VarType::mutable_channel() { - set_has_channel(); - if (channel_ == NULL) { - channel_ = new ::paddle_mobile::framework::proto::VarType_ChannelDesc; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.channel) - return channel_; -} -inline ::paddle_mobile::framework::proto::VarType_ChannelDesc * -VarType::release_channel() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.channel) - clear_has_channel(); - ::paddle_mobile::framework::proto::VarType_ChannelDesc *temp = channel_; - channel_ = NULL; - return temp; -} -inline void VarType::set_allocated_channel( - ::paddle_mobile::framework::proto::VarType_ChannelDesc *channel) { - delete channel_; - channel_ = channel; - if (channel) { - set_has_channel(); - } else { - clear_has_channel(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.channel) -} - -// optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; -inline bool VarType::has_tuple() const { - return (_has_bits_[0] & 0x00000020u) != 0; -} -inline void VarType::set_has_tuple() { _has_bits_[0] |= 0x00000020u; } -inline void VarType::clear_has_tuple() { _has_bits_[0] &= ~0x00000020u; } -inline void VarType::clear_tuple() { - if (tuple_ != NULL) - tuple_->::paddle_mobile::framework::proto::VarType_Tuple::Clear(); - clear_has_tuple(); -} -inline const ::paddle_mobile::framework::proto::VarType_Tuple & -VarType::tuple() const { - const ::paddle_mobile::framework::proto::VarType_Tuple *p = tuple_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tuple) - return p != NULL - ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType_Tuple *>( - &::paddle_mobile::framework::proto:: - _VarType_Tuple_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType_Tuple * -VarType::mutable_tuple() { - set_has_tuple(); - if (tuple_ == NULL) { - tuple_ = new ::paddle_mobile::framework::proto::VarType_Tuple; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tuple) - return tuple_; -} -inline ::paddle_mobile::framework::proto::VarType_Tuple * -VarType::release_tuple() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tuple) - clear_has_tuple(); - ::paddle_mobile::framework::proto::VarType_Tuple *temp = tuple_; - tuple_ = NULL; - return temp; -} -inline void VarType::set_allocated_tuple( - ::paddle_mobile::framework::proto::VarType_Tuple *tuple) { - delete tuple_; - tuple_ = tuple; - if (tuple) { - set_has_tuple(); - } else { - clear_has_tuple(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tuple) -} - -// ------------------------------------------------------------------- - -// VarDesc - -// required string name = 1; -inline bool VarDesc::has_name() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void VarDesc::set_has_name() { _has_bits_[0] |= 0x00000001u; } -inline void VarDesc::clear_has_name() { _has_bits_[0] &= ~0x00000001u; } -inline void VarDesc::clear_name() { - name_.ClearToEmptyNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_name(); -} -inline const ::std::string &VarDesc::name() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.name) - return name_.GetNoArena(); -} -inline void VarDesc::set_name(const ::std::string &value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - value); - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.name) -} + dims_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + } + inline void + VarType_TensorDesc::add_dims(::google::protobuf::int64 value) { + dims_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + } + inline const ::google::protobuf::RepeatedField< + ::google::protobuf::int64> & + VarType_TensorDesc::dims() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + return dims_; + } + inline ::google::protobuf::RepeatedField<::google::protobuf::int64> + *VarType_TensorDesc::mutable_dims() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.TensorDesc.dims) + return &dims_; + } + + // ------------------------------------------------------------------- + + // VarType_LoDTensorDesc + + // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor + // = 1; + inline bool VarType_LoDTensorDesc::has_tensor() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void VarType_LoDTensorDesc::set_has_tensor() { + _has_bits_[0] |= 0x00000001u; + } + inline void VarType_LoDTensorDesc::clear_has_tensor() { + _has_bits_[0] &= ~0x00000001u; + } + inline void VarType_LoDTensorDesc::clear_tensor() { + if (tensor_ != NULL) + tensor_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + clear_has_tensor(); + } + inline const ::paddle_mobile::framework::proto::VarType_TensorDesc & + VarType_LoDTensorDesc::tensor() const { + const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = + tensor_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_TensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_TensorDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorDesc::mutable_tensor() { + set_has_tensor(); + if (tensor_ == NULL) { + tensor_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + return tensor_; + } + inline ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorDesc::release_tensor() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + clear_has_tensor(); + ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = + tensor_; + tensor_ = NULL; + return temp; + } + inline void VarType_LoDTensorDesc::set_allocated_tensor( + ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { + delete tensor_; + tensor_ = tensor; + if (tensor) { + set_has_tensor(); + } else { + clear_has_tensor(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorDesc.tensor) + } + + // optional int32 lod_level = 2 [default = 0]; + inline bool VarType_LoDTensorDesc::has_lod_level() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void VarType_LoDTensorDesc::set_has_lod_level() { + _has_bits_[0] |= 0x00000002u; + } + inline void VarType_LoDTensorDesc::clear_has_lod_level() { + _has_bits_[0] &= ~0x00000002u; + } + inline void VarType_LoDTensorDesc::clear_lod_level() { + lod_level_ = 0; + clear_has_lod_level(); + } + inline ::google::protobuf::int32 + VarType_LoDTensorDesc::lod_level() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) + return lod_level_; + } + inline void VarType_LoDTensorDesc::set_lod_level( + ::google::protobuf::int32 value) { + set_has_lod_level(); + lod_level_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorDesc.lod_level) + } + + // ------------------------------------------------------------------- + + // VarType_LoDTensorArrayDesc + + // required .paddle_mobile.framework.proto.VarType.TensorDesc tensor + // = 1; + inline bool VarType_LoDTensorArrayDesc::has_tensor() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void VarType_LoDTensorArrayDesc::set_has_tensor() { + _has_bits_[0] |= 0x00000001u; + } + inline void VarType_LoDTensorArrayDesc::clear_has_tensor() { + _has_bits_[0] &= ~0x00000001u; + } + inline void VarType_LoDTensorArrayDesc::clear_tensor() { + if (tensor_ != NULL) + tensor_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + clear_has_tensor(); + } + inline const ::paddle_mobile::framework::proto::VarType_TensorDesc & + VarType_LoDTensorArrayDesc::tensor() const { + const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = + tensor_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_TensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_TensorDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorArrayDesc::mutable_tensor() { + set_has_tensor(); + if (tensor_ == NULL) { + tensor_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + return tensor_; + } + inline ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType_LoDTensorArrayDesc::release_tensor() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + clear_has_tensor(); + ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = + tensor_; + tensor_ = NULL; + return temp; + } + inline void VarType_LoDTensorArrayDesc::set_allocated_tensor( + ::paddle_mobile::framework::proto::VarType_TensorDesc *tensor) { + delete tensor_; + tensor_ = tensor; + if (tensor) { + set_has_tensor(); + } else { + clear_has_tensor(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.tensor) + } + + // optional int32 lod_level = 2 [default = 0]; + inline bool VarType_LoDTensorArrayDesc::has_lod_level() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void VarType_LoDTensorArrayDesc::set_has_lod_level() { + _has_bits_[0] |= 0x00000002u; + } + inline void VarType_LoDTensorArrayDesc::clear_has_lod_level() { + _has_bits_[0] &= ~0x00000002u; + } + inline void VarType_LoDTensorArrayDesc::clear_lod_level() { + lod_level_ = 0; + clear_has_lod_level(); + } + inline ::google::protobuf::int32 + VarType_LoDTensorArrayDesc::lod_level() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) + return lod_level_; + } + inline void VarType_LoDTensorArrayDesc::set_lod_level( + ::google::protobuf::int32 value) { + set_has_lod_level(); + lod_level_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc.lod_level) + } + + // ------------------------------------------------------------------- + + // VarType_ReaderDesc + + // repeated .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = 1; + inline int VarType_ReaderDesc::lod_tensor_size() const { + return lod_tensor_.size(); + } + inline void VarType_ReaderDesc::clear_lod_tensor() { + lod_tensor_.Clear(); + } + inline const ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc & + VarType_ReaderDesc::lod_tensor(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_.Get(index); + } + inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType_ReaderDesc::mutable_lod_tensor(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType_ReaderDesc::add_lod_tensor() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> * + VarType_ReaderDesc::mutable_lod_tensor() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return &lod_tensor_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc> & + VarType_ReaderDesc::lod_tensor() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.ReaderDesc.lod_tensor) + return lod_tensor_; + } + + // ------------------------------------------------------------------- + + // VarType_ChannelDesc + + // required .paddle_mobile.framework.proto.VarType.Type data_type = + // 1; + inline bool VarType_ChannelDesc::has_data_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void VarType_ChannelDesc::set_has_data_type() { + _has_bits_[0] |= 0x00000002u; + } + inline void VarType_ChannelDesc::clear_has_data_type() { + _has_bits_[0] &= ~0x00000002u; + } + inline void VarType_ChannelDesc::clear_data_type() { + data_type_ = 0; + clear_has_data_type(); + } + inline ::paddle_mobile::framework::proto::VarType_Type + VarType_ChannelDesc::data_type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>( + data_type_); + } + inline void VarType_ChannelDesc::set_data_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + set_has_data_type(); + data_type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.data_type) + } + + // required int64 capacity = 2; + inline bool VarType_ChannelDesc::has_capacity() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void VarType_ChannelDesc::set_has_capacity() { + _has_bits_[0] |= 0x00000001u; + } + inline void VarType_ChannelDesc::clear_has_capacity() { + _has_bits_[0] &= ~0x00000001u; + } + inline void VarType_ChannelDesc::clear_capacity() { + capacity_ = GOOGLE_LONGLONG(0); + clear_has_capacity(); + } + inline ::google::protobuf::int64 + VarType_ChannelDesc::capacity() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) + return capacity_; + } + inline void + VarType_ChannelDesc::set_capacity(::google::protobuf::int64 value) { + set_has_capacity(); + capacity_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.ChannelDesc.capacity) + } + + // ------------------------------------------------------------------- + + // VarType_Tuple + + // repeated .paddle_mobile.framework.proto.VarType.Type element_type + // = 1; + inline int VarType_Tuple::element_type_size() const { + return element_type_.size(); + } + inline void VarType_Tuple::clear_element_type() { + element_type_.Clear(); + } + inline ::paddle_mobile::framework::proto::VarType_Type + VarType_Tuple::element_type(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.Tuple.element_type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>( + element_type_.Get(index)); + } + inline void VarType_Tuple::set_element_type( + int index, + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + element_type_.Set(index, value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.Tuple.element_type) + } + inline void VarType_Tuple::add_element_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + element_type_.Add(value); + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.VarType.Tuple.element_type) + } + inline const ::google::protobuf::RepeatedField & + VarType_Tuple::element_type() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) + return element_type_; + } + inline ::google::protobuf::RepeatedField * + VarType_Tuple::mutable_element_type() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.VarType.Tuple.element_type) + return &element_type_; + } + + // ------------------------------------------------------------------- + + // VarType + + // required .paddle_mobile.framework.proto.VarType.Type type = 1; + inline bool VarType::has_type() const { + return (_has_bits_[0] & 0x00000040u) != 0; + } + inline void VarType::set_has_type() { + _has_bits_[0] |= 0x00000040u; + } + inline void VarType::clear_has_type() { + _has_bits_[0] &= ~0x00000040u; + } + inline void VarType::clear_type() { + type_ = 0; + clear_has_type(); + } + inline ::paddle_mobile::framework::proto::VarType_Type + VarType::type() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.type) + return static_cast< + ::paddle_mobile::framework::proto::VarType_Type>(type_); + } + inline void VarType::set_type( + ::paddle_mobile::framework::proto::VarType_Type value) { + assert(::paddle_mobile::framework::proto::VarType_Type_IsValid( + value)); + set_has_type(); + type_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarType.type) + } + + // optional .paddle_mobile.framework.proto.VarType.TensorDesc + // selected_rows = 2; + inline bool VarType::has_selected_rows() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void VarType::set_has_selected_rows() { + _has_bits_[0] |= 0x00000001u; + } + inline void VarType::clear_has_selected_rows() { + _has_bits_[0] &= ~0x00000001u; + } + inline void VarType::clear_selected_rows() { + if (selected_rows_ != NULL) + selected_rows_->::paddle_mobile::framework::proto:: + VarType_TensorDesc::Clear(); + clear_has_selected_rows(); + } + inline const ::paddle_mobile::framework::proto::VarType_TensorDesc & + VarType::selected_rows() const { + const ::paddle_mobile::framework::proto::VarType_TensorDesc *p = + selected_rows_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.selected_rows) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_TensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_TensorDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType::mutable_selected_rows() { + set_has_selected_rows(); + if (selected_rows_ == NULL) { + selected_rows_ = new ::paddle_mobile::framework::proto:: + VarType_TensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.selected_rows) + return selected_rows_; + } + inline ::paddle_mobile::framework::proto::VarType_TensorDesc * + VarType::release_selected_rows() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.selected_rows) + clear_has_selected_rows(); + ::paddle_mobile::framework::proto::VarType_TensorDesc *temp = + selected_rows_; + selected_rows_ = NULL; + return temp; + } + inline void VarType::set_allocated_selected_rows( + ::paddle_mobile::framework::proto::VarType_TensorDesc + *selected_rows) { + delete selected_rows_; + selected_rows_ = selected_rows; + if (selected_rows) { + set_has_selected_rows(); + } else { + clear_has_selected_rows(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.selected_rows) + } + + // optional .paddle_mobile.framework.proto.VarType.LoDTensorDesc + // lod_tensor = 3; + inline bool VarType::has_lod_tensor() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void VarType::set_has_lod_tensor() { + _has_bits_[0] |= 0x00000002u; + } + inline void VarType::clear_has_lod_tensor() { + _has_bits_[0] &= ~0x00000002u; + } + inline void VarType::clear_lod_tensor() { + if (lod_tensor_ != NULL) + lod_tensor_->::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc::Clear(); + clear_has_lod_tensor(); + } + inline const ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc & + VarType::lod_tensor() const { + const ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *p = lod_tensor_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.lod_tensor) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_LoDTensorDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType::mutable_lod_tensor() { + set_has_lod_tensor(); + if (lod_tensor_ == NULL) { + lod_tensor_ = new ::paddle_mobile::framework::proto:: + VarType_LoDTensorDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.lod_tensor) + return lod_tensor_; + } + inline ::paddle_mobile::framework::proto::VarType_LoDTensorDesc * + VarType::release_lod_tensor() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.lod_tensor) + clear_has_lod_tensor(); + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc *temp = + lod_tensor_; + lod_tensor_ = NULL; + return temp; + } + inline void VarType::set_allocated_lod_tensor( + ::paddle_mobile::framework::proto::VarType_LoDTensorDesc + *lod_tensor) { + delete lod_tensor_; + lod_tensor_ = lod_tensor; + if (lod_tensor) { + set_has_lod_tensor(); + } else { + clear_has_lod_tensor(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.lod_tensor) + } + + // optional + // .paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc + // tensor_array = 4; + inline bool VarType::has_tensor_array() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + inline void VarType::set_has_tensor_array() { + _has_bits_[0] |= 0x00000004u; + } + inline void VarType::clear_has_tensor_array() { + _has_bits_[0] &= ~0x00000004u; + } + inline void VarType::clear_tensor_array() { + if (tensor_array_ != NULL) + tensor_array_->::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc::Clear(); + clear_has_tensor_array(); + } + inline const ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc & + VarType::tensor_array() const { + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc *p = tensor_array_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tensor_array) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_LoDTensorArrayDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + * + VarType::mutable_tensor_array() { + set_has_tensor_array(); + if (tensor_array_ == NULL) { + tensor_array_ = new ::paddle_mobile::framework::proto:: + VarType_LoDTensorArrayDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tensor_array) + return tensor_array_; + } + inline ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + * + VarType::release_tensor_array() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tensor_array) + clear_has_tensor_array(); + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + *temp = tensor_array_; + tensor_array_ = NULL; + return temp; + } + inline void VarType::set_allocated_tensor_array( + ::paddle_mobile::framework::proto::VarType_LoDTensorArrayDesc + *tensor_array) { + delete tensor_array_; + tensor_array_ = tensor_array; + if (tensor_array) { + set_has_tensor_array(); + } else { + clear_has_tensor_array(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tensor_array) + } + + // optional .paddle_mobile.framework.proto.VarType.ReaderDesc reader + // = 5; + inline bool VarType::has_reader() const { + return (_has_bits_[0] & 0x00000008u) != 0; + } + inline void VarType::set_has_reader() { + _has_bits_[0] |= 0x00000008u; + } + inline void VarType::clear_has_reader() { + _has_bits_[0] &= ~0x00000008u; + } + inline void VarType::clear_reader() { + if (reader_ != NULL) + reader_->::paddle_mobile::framework::proto:: + VarType_ReaderDesc::Clear(); + clear_has_reader(); + } + inline const ::paddle_mobile::framework::proto::VarType_ReaderDesc & + VarType::reader() const { + const ::paddle_mobile::framework::proto::VarType_ReaderDesc *p = + reader_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.reader) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_ReaderDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_ReaderDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_ReaderDesc * + VarType::mutable_reader() { + set_has_reader(); + if (reader_ == NULL) { + reader_ = new ::paddle_mobile::framework::proto:: + VarType_ReaderDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.reader) + return reader_; + } + inline ::paddle_mobile::framework::proto::VarType_ReaderDesc * + VarType::release_reader() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.reader) + clear_has_reader(); + ::paddle_mobile::framework::proto::VarType_ReaderDesc *temp = + reader_; + reader_ = NULL; + return temp; + } + inline void VarType::set_allocated_reader( + ::paddle_mobile::framework::proto::VarType_ReaderDesc *reader) { + delete reader_; + reader_ = reader; + if (reader) { + set_has_reader(); + } else { + clear_has_reader(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.reader) + } + + // optional .paddle_mobile.framework.proto.VarType.ChannelDesc + // channel = 6; + inline bool VarType::has_channel() const { + return (_has_bits_[0] & 0x00000010u) != 0; + } + inline void VarType::set_has_channel() { + _has_bits_[0] |= 0x00000010u; + } + inline void VarType::clear_has_channel() { + _has_bits_[0] &= ~0x00000010u; + } + inline void VarType::clear_channel() { + if (channel_ != NULL) + channel_->::paddle_mobile::framework::proto:: + VarType_ChannelDesc::Clear(); + clear_has_channel(); + } + inline const ::paddle_mobile::framework::proto::VarType_ChannelDesc + & + VarType::channel() const { + const ::paddle_mobile::framework::proto::VarType_ChannelDesc + *p = channel_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.channel) + return p != NULL + ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_ChannelDesc *>( + &::paddle_mobile::framework::proto:: + _VarType_ChannelDesc_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_ChannelDesc * + VarType::mutable_channel() { + set_has_channel(); + if (channel_ == NULL) { + channel_ = new ::paddle_mobile::framework::proto:: + VarType_ChannelDesc; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.channel) + return channel_; + } + inline ::paddle_mobile::framework::proto::VarType_ChannelDesc * + VarType::release_channel() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.channel) + clear_has_channel(); + ::paddle_mobile::framework::proto::VarType_ChannelDesc *temp = + channel_; + channel_ = NULL; + return temp; + } + inline void VarType::set_allocated_channel( + ::paddle_mobile::framework::proto::VarType_ChannelDesc + *channel) { + delete channel_; + channel_ = channel; + if (channel) { + set_has_channel(); + } else { + clear_has_channel(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.channel) + } + + // optional .paddle_mobile.framework.proto.VarType.Tuple tuple = 7; + inline bool VarType::has_tuple() const { + return (_has_bits_[0] & 0x00000020u) != 0; + } + inline void VarType::set_has_tuple() { + _has_bits_[0] |= 0x00000020u; + } + inline void VarType::clear_has_tuple() { + _has_bits_[0] &= ~0x00000020u; + } + inline void VarType::clear_tuple() { + if (tuple_ != NULL) + tuple_->::paddle_mobile::framework::proto::VarType_Tuple:: + Clear(); + clear_has_tuple(); + } + inline const ::paddle_mobile::framework::proto::VarType_Tuple & + VarType::tuple() const { + const ::paddle_mobile::framework::proto::VarType_Tuple *p = + tuple_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarType.tuple) + return p != NULL ? *p + : *reinterpret_cast< + const ::paddle_mobile::framework::proto:: + VarType_Tuple *>( + &::paddle_mobile::framework::proto:: + _VarType_Tuple_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType_Tuple * + VarType::mutable_tuple() { + set_has_tuple(); + if (tuple_ == NULL) { + tuple_ = + new ::paddle_mobile::framework::proto::VarType_Tuple; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarType.tuple) + return tuple_; + } + inline ::paddle_mobile::framework::proto::VarType_Tuple * + VarType::release_tuple() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarType.tuple) + clear_has_tuple(); + ::paddle_mobile::framework::proto::VarType_Tuple *temp = tuple_; + tuple_ = NULL; + return temp; + } + inline void VarType::set_allocated_tuple( + ::paddle_mobile::framework::proto::VarType_Tuple *tuple) { + delete tuple_; + tuple_ = tuple; + if (tuple) { + set_has_tuple(); + } else { + clear_has_tuple(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarType.tuple) + } + + // ------------------------------------------------------------------- + + // VarDesc + + // required string name = 1; + inline bool VarDesc::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void VarDesc::set_has_name() { + _has_bits_[0] |= 0x00000001u; + } + inline void VarDesc::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; + } + inline void VarDesc::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + clear_has_name(); + } + inline const ::std::string &VarDesc::name() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.name) + return name_.GetNoArena(); + } + inline void VarDesc::set_name(const ::std::string &value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + value); + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.name) + } #if LANG_CXX11 -inline void VarDesc::set_name(::std::string &&value) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.VarDesc.name) -} + inline void VarDesc::set_name(::std::string &&value) { + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::move(value)); + // @@protoc_insertion_point(field_set_rvalue:paddle_mobile.framework.proto.VarDesc.name) + } #endif -inline void VarDesc::set_name(const char *value) { - GOOGLE_DCHECK(value != NULL); - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(value)); - // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.VarDesc.name) -} -inline void VarDesc::set_name(const char *value, size_t size) { - set_has_name(); - name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.VarDesc.name) -} -inline ::std::string *VarDesc::mutable_name() { - set_has_name(); - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.name) - return name_.MutableNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline ::std::string *VarDesc::release_name() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.name) - clear_has_name(); - return name_.ReleaseNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -inline void VarDesc::set_allocated_name(::std::string *name) { - if (name != NULL) { - set_has_name(); - } else { - clear_has_name(); - } - name_.SetAllocatedNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.name) -} - -// required .paddle_mobile.framework.proto.VarType type = 2; -inline bool VarDesc::has_type() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void VarDesc::set_has_type() { _has_bits_[0] |= 0x00000002u; } -inline void VarDesc::clear_has_type() { _has_bits_[0] &= ~0x00000002u; } -inline void VarDesc::clear_type() { - if (type_ != NULL) - type_->::paddle_mobile::framework::proto::VarType::Clear(); - clear_has_type(); -} -inline const ::paddle_mobile::framework::proto::VarType &VarDesc::type() const { - const ::paddle_mobile::framework::proto::VarType *p = type_; - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.type) - return p != NULL ? *p - : *reinterpret_cast< - const ::paddle_mobile::framework::proto::VarType *>( - &::paddle_mobile::framework::proto:: - _VarType_default_instance_); -} -inline ::paddle_mobile::framework::proto::VarType *VarDesc::mutable_type() { - set_has_type(); - if (type_ == NULL) { - type_ = new ::paddle_mobile::framework::proto::VarType; - } - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.type) - return type_; -} -inline ::paddle_mobile::framework::proto::VarType *VarDesc::release_type() { - // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.type) - clear_has_type(); - ::paddle_mobile::framework::proto::VarType *temp = type_; - type_ = NULL; - return temp; -} -inline void -VarDesc::set_allocated_type(::paddle_mobile::framework::proto::VarType *type) { - delete type_; - type_ = type; - if (type) { - set_has_type(); - } else { - clear_has_type(); - } - // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.type) -} - -// optional bool persistable = 3 [default = false]; -inline bool VarDesc::has_persistable() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void VarDesc::set_has_persistable() { _has_bits_[0] |= 0x00000004u; } -inline void VarDesc::clear_has_persistable() { _has_bits_[0] &= ~0x00000004u; } -inline void VarDesc::clear_persistable() { - persistable_ = false; - clear_has_persistable(); -} -inline bool VarDesc::persistable() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.persistable) - return persistable_; -} -inline void VarDesc::set_persistable(bool value) { - set_has_persistable(); - persistable_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.persistable) -} - -// ------------------------------------------------------------------- - -// BlockDesc - -// required int32 idx = 1; -inline bool BlockDesc::has_idx() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -inline void BlockDesc::set_has_idx() { _has_bits_[0] |= 0x00000001u; } -inline void BlockDesc::clear_has_idx() { _has_bits_[0] &= ~0x00000001u; } -inline void BlockDesc::clear_idx() { - idx_ = 0; - clear_has_idx(); -} -inline ::google::protobuf::int32 BlockDesc::idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.idx) - return idx_; -} -inline void BlockDesc::set_idx(::google::protobuf::int32 value) { - set_has_idx(); - idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.idx) -} - -// required int32 parent_idx = 2; -inline bool BlockDesc::has_parent_idx() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -inline void BlockDesc::set_has_parent_idx() { _has_bits_[0] |= 0x00000002u; } -inline void BlockDesc::clear_has_parent_idx() { _has_bits_[0] &= ~0x00000002u; } -inline void BlockDesc::clear_parent_idx() { - parent_idx_ = 0; - clear_has_parent_idx(); -} -inline ::google::protobuf::int32 BlockDesc::parent_idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.parent_idx) - return parent_idx_; -} -inline void BlockDesc::set_parent_idx(::google::protobuf::int32 value) { - set_has_parent_idx(); - parent_idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.parent_idx) -} - -// repeated .paddle_mobile.framework.proto.VarDesc vars = 3; -inline int BlockDesc::vars_size() const { return vars_.size(); } -inline void BlockDesc::clear_vars() { vars_.Clear(); } -inline const ::paddle_mobile::framework::proto::VarDesc & -BlockDesc::vars(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_.Get(index); -} -inline ::paddle_mobile::framework::proto::VarDesc * -BlockDesc::mutable_vars(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::VarDesc *BlockDesc::add_vars() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarDesc> * -BlockDesc::mutable_vars() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.vars) - return &vars_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::VarDesc> & -BlockDesc::vars() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.vars) - return vars_; -} - -// repeated .paddle_mobile.framework.proto.OpDesc ops = 4; -inline int BlockDesc::ops_size() const { return ops_.size(); } -inline void BlockDesc::clear_ops() { ops_.Clear(); } -inline const ::paddle_mobile::framework::proto::OpDesc & -BlockDesc::ops(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_.Get(index); -} -inline ::paddle_mobile::framework::proto::OpDesc * -BlockDesc::mutable_ops(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::OpDesc *BlockDesc::add_ops() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc> * -BlockDesc::mutable_ops() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.ops) - return &ops_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::OpDesc> & -BlockDesc::ops() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.ops) - return ops_; -} - -// optional int32 forward_block_idx = 5 [default = -1]; -inline bool BlockDesc::has_forward_block_idx() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -inline void BlockDesc::set_has_forward_block_idx() { - _has_bits_[0] |= 0x00000004u; -} -inline void BlockDesc::clear_has_forward_block_idx() { - _has_bits_[0] &= ~0x00000004u; -} -inline void BlockDesc::clear_forward_block_idx() { - forward_block_idx_ = -1; - clear_has_forward_block_idx(); -} -inline ::google::protobuf::int32 BlockDesc::forward_block_idx() const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) - return forward_block_idx_; -} -inline void BlockDesc::set_forward_block_idx(::google::protobuf::int32 value) { - set_has_forward_block_idx(); - forward_block_idx_ = value; - // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) -} - -// ------------------------------------------------------------------- - -// ProgramDesc - -// repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; -inline int ProgramDesc::blocks_size() const { return blocks_.size(); } -inline void ProgramDesc::clear_blocks() { blocks_.Clear(); } -inline const ::paddle_mobile::framework::proto::BlockDesc & -ProgramDesc::blocks(int index) const { - // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_.Get(index); -} -inline ::paddle_mobile::framework::proto::BlockDesc * -ProgramDesc::mutable_blocks(int index) { - // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_.Mutable(index); -} -inline ::paddle_mobile::framework::proto::BlockDesc *ProgramDesc::add_blocks() { - // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_.Add(); -} -inline ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> * -ProgramDesc::mutable_blocks() { - // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.ProgramDesc.blocks) - return &blocks_; -} -inline const ::google::protobuf::RepeatedPtrField< - ::paddle_mobile::framework::proto::BlockDesc> & -ProgramDesc::blocks() const { - // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.ProgramDesc.blocks) - return blocks_; -} + inline void VarDesc::set_name(const char *value) { + GOOGLE_DCHECK(value != NULL); + set_has_name(); + name_.SetNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:paddle_mobile.framework.proto.VarDesc.name) + } + inline void VarDesc::set_name(const char *value, size_t size) { + set_has_name(); + name_.SetNoArena( + &::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:paddle_mobile.framework.proto.VarDesc.name) + } + inline ::std::string *VarDesc::mutable_name() { + set_has_name(); + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.name) + return name_.MutableNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline ::std::string *VarDesc::release_name() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.name) + clear_has_name(); + return name_.ReleaseNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited()); + } + inline void VarDesc::set_allocated_name(::std::string *name) { + if (name != NULL) { + set_has_name(); + } else { + clear_has_name(); + } + name_.SetAllocatedNoArena(&::google::protobuf::internal:: + GetEmptyStringAlreadyInited(), + name); + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.name) + } + + // required .paddle_mobile.framework.proto.VarType type = 2; + inline bool VarDesc::has_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void VarDesc::set_has_type() { + _has_bits_[0] |= 0x00000002u; + } + inline void VarDesc::clear_has_type() { + _has_bits_[0] &= ~0x00000002u; + } + inline void VarDesc::clear_type() { + if (type_ != NULL) + type_->::paddle_mobile::framework::proto::VarType::Clear(); + clear_has_type(); + } + inline const ::paddle_mobile::framework::proto::VarType & + VarDesc::type() const { + const ::paddle_mobile::framework::proto::VarType *p = type_; + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.type) + return p != NULL + ? *p + : *reinterpret_cast( + &::paddle_mobile::framework::proto:: + _VarType_default_instance_); + } + inline ::paddle_mobile::framework::proto::VarType * + VarDesc::mutable_type() { + set_has_type(); + if (type_ == NULL) { + type_ = new ::paddle_mobile::framework::proto::VarType; + } + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.VarDesc.type) + return type_; + } + inline ::paddle_mobile::framework::proto::VarType * + VarDesc::release_type() { + // @@protoc_insertion_point(field_release:paddle_mobile.framework.proto.VarDesc.type) + clear_has_type(); + ::paddle_mobile::framework::proto::VarType *temp = type_; + type_ = NULL; + return temp; + } + inline void VarDesc::set_allocated_type( + ::paddle_mobile::framework::proto::VarType *type) { + delete type_; + type_ = type; + if (type) { + set_has_type(); + } else { + clear_has_type(); + } + // @@protoc_insertion_point(field_set_allocated:paddle_mobile.framework.proto.VarDesc.type) + } + + // optional bool persistable = 3 [default = false]; + inline bool VarDesc::has_persistable() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + inline void VarDesc::set_has_persistable() { + _has_bits_[0] |= 0x00000004u; + } + inline void VarDesc::clear_has_persistable() { + _has_bits_[0] &= ~0x00000004u; + } + inline void VarDesc::clear_persistable() { + persistable_ = false; + clear_has_persistable(); + } + inline bool VarDesc::persistable() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.VarDesc.persistable) + return persistable_; + } + inline void VarDesc::set_persistable(bool value) { + set_has_persistable(); + persistable_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.VarDesc.persistable) + } + + // ------------------------------------------------------------------- + + // BlockDesc + + // required int32 idx = 1; + inline bool BlockDesc::has_idx() const { + return (_has_bits_[0] & 0x00000001u) != 0; + } + inline void BlockDesc::set_has_idx() { + _has_bits_[0] |= 0x00000001u; + } + inline void BlockDesc::clear_has_idx() { + _has_bits_[0] &= ~0x00000001u; + } + inline void BlockDesc::clear_idx() { + idx_ = 0; + clear_has_idx(); + } + inline ::google::protobuf::int32 BlockDesc::idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.idx) + return idx_; + } + inline void BlockDesc::set_idx(::google::protobuf::int32 value) { + set_has_idx(); + idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.idx) + } + + // required int32 parent_idx = 2; + inline bool BlockDesc::has_parent_idx() const { + return (_has_bits_[0] & 0x00000002u) != 0; + } + inline void BlockDesc::set_has_parent_idx() { + _has_bits_[0] |= 0x00000002u; + } + inline void BlockDesc::clear_has_parent_idx() { + _has_bits_[0] &= ~0x00000002u; + } + inline void BlockDesc::clear_parent_idx() { + parent_idx_ = 0; + clear_has_parent_idx(); + } + inline ::google::protobuf::int32 BlockDesc::parent_idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.parent_idx) + return parent_idx_; + } + inline void + BlockDesc::set_parent_idx(::google::protobuf::int32 value) { + set_has_parent_idx(); + parent_idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.parent_idx) + } + + // repeated .paddle_mobile.framework.proto.VarDesc vars = 3; + inline int BlockDesc::vars_size() const { return vars_.size(); } + inline void BlockDesc::clear_vars() { vars_.Clear(); } + inline const ::paddle_mobile::framework::proto::VarDesc & + BlockDesc::vars(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_.Get(index); + } + inline ::paddle_mobile::framework::proto::VarDesc * + BlockDesc::mutable_vars(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::VarDesc * + BlockDesc::add_vars() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> * + BlockDesc::mutable_vars() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.vars) + return &vars_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::VarDesc> & + BlockDesc::vars() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.vars) + return vars_; + } + + // repeated .paddle_mobile.framework.proto.OpDesc ops = 4; + inline int BlockDesc::ops_size() const { return ops_.size(); } + inline void BlockDesc::clear_ops() { ops_.Clear(); } + inline const ::paddle_mobile::framework::proto::OpDesc & + BlockDesc::ops(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_.Get(index); + } + inline ::paddle_mobile::framework::proto::OpDesc * + BlockDesc::mutable_ops(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::OpDesc * + BlockDesc::add_ops() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> * + BlockDesc::mutable_ops() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.BlockDesc.ops) + return &ops_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::OpDesc> & + BlockDesc::ops() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.BlockDesc.ops) + return ops_; + } + + // optional int32 forward_block_idx = 5 [default = -1]; + inline bool BlockDesc::has_forward_block_idx() const { + return (_has_bits_[0] & 0x00000004u) != 0; + } + inline void BlockDesc::set_has_forward_block_idx() { + _has_bits_[0] |= 0x00000004u; + } + inline void BlockDesc::clear_has_forward_block_idx() { + _has_bits_[0] &= ~0x00000004u; + } + inline void BlockDesc::clear_forward_block_idx() { + forward_block_idx_ = -1; + clear_has_forward_block_idx(); + } + inline ::google::protobuf::int32 + BlockDesc::forward_block_idx() const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) + return forward_block_idx_; + } + inline void + BlockDesc::set_forward_block_idx(::google::protobuf::int32 value) { + set_has_forward_block_idx(); + forward_block_idx_ = value; + // @@protoc_insertion_point(field_set:paddle_mobile.framework.proto.BlockDesc.forward_block_idx) + } + + // ------------------------------------------------------------------- + + // ProgramDesc + + // repeated .paddle_mobile.framework.proto.BlockDesc blocks = 1; + inline int ProgramDesc::blocks_size() const { + return blocks_.size(); + } + inline void ProgramDesc::clear_blocks() { blocks_.Clear(); } + inline const ::paddle_mobile::framework::proto::BlockDesc & + ProgramDesc::blocks(int index) const { + // @@protoc_insertion_point(field_get:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_.Get(index); + } + inline ::paddle_mobile::framework::proto::BlockDesc * + ProgramDesc::mutable_blocks(int index) { + // @@protoc_insertion_point(field_mutable:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_.Mutable(index); + } + inline ::paddle_mobile::framework::proto::BlockDesc * + ProgramDesc::add_blocks() { + // @@protoc_insertion_point(field_add:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_.Add(); + } + inline ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> * + ProgramDesc::mutable_blocks() { + // @@protoc_insertion_point(field_mutable_list:paddle_mobile.framework.proto.ProgramDesc.blocks) + return &blocks_; + } + inline const ::google::protobuf::RepeatedPtrField< + ::paddle_mobile::framework::proto::BlockDesc> & + ProgramDesc::blocks() const { + // @@protoc_insertion_point(field_list:paddle_mobile.framework.proto.ProgramDesc.blocks) + return blocks_; + } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// ------------------------------------------------------------------- + // ------------------------------------------------------------------- -// @@protoc_insertion_point(namespace_scope) + // @@protoc_insertion_point(namespace_scope) -} // namespace proto -} // namespace framework + } // namespace proto + } // namespace framework } // namespace paddle_mobile namespace google { -namespace protobuf { + namespace protobuf { -template <> -struct is_proto_enum<::paddle_mobile::framework::proto::VarType_Type> - : ::google::protobuf::internal::true_type {}; -template <> -struct is_proto_enum<::paddle_mobile::framework::proto::AttrType> - : ::google::protobuf::internal::true_type {}; + template <> + struct is_proto_enum<::paddle_mobile::framework::proto::VarType_Type> + : ::google::protobuf::internal::true_type {}; + template <> + struct is_proto_enum<::paddle_mobile::framework::proto::AttrType> + : ::google::protobuf::internal::true_type {}; -} // namespace protobuf + } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope) diff --git a/src/framework/lod_tensor.cc b/src/framework/lod_tensor.cc index ef4badd4d4ef73825df1538a11345780060dd7e8..712264ff3729545d12662fb0229d99af19e82cac 100644 --- a/src/framework/lod_tensor.cc +++ b/src/framework/lod_tensor.cc @@ -19,280 +19,304 @@ limitations under the License. */ #include namespace paddle_mobile { -namespace framework { - -std::ostream &operator<<(std::ostream &os, const LoD &lod) { - os << "{"; - for (auto &v : lod) { - os << "{"; - bool is_first = true; - for (auto &i : v) { - if (is_first) { - os << i; - is_first = false; - } else { - os << ", " << i; - } - } - os << "}"; - } - os << "}"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const LoDTensor &t) { - // PADDLE_ENFORCE(t.type().hash_code() == typeid(float).hash_code()); - - // if (!platform::is_cpu_place(t.place())) { - // LoDTensor tt; - // framework::TensorCopy(t, platform::CPUPlace(), &tt); - // platform::DeviceContextPool &pool = - // platform::DeviceContextPool::Instance(); auto &dev_ctx = - // *pool.Get(t.place()); dev_ctx.Wait(); - // - // os << tt; - // return os; - // } - - os << "dim: " << t.dims() << "\n"; - os << "lod: " << t.lod() << "\n"; - - // only print first ten elements - int64_t size = t.numel() < 10 ? t.numel() : 10; - for (int64_t i = 0; i < size; ++i) { - os << t.data()[i] << " "; - } - - return os; -} - -std::string LoDToString(const LoD &lod) { - std::ostringstream stream; - stream << lod; - return stream.str(); -} - -LoD SliceInLevel(const LoD &in, size_t level, size_t elem_begin, - size_t elem_end) { - // PADDLE_ENFORCE_LT(level, in.size()); - // PADDLE_ENFORCE_LT(elem_end, in[level].size()); - - LoD res; - res.resize(in.size() - level); - // copy the first level - res[0].assign(in[level].begin() + elem_begin, - in[level].begin() + elem_end + 1); - for (size_t lvl = 1; lvl < res.size(); lvl++) { - const auto &in_level = in[level + lvl]; - const auto &above_level = res[lvl - 1]; - auto &out_level = res[lvl]; - out_level.assign(in_level.begin() + above_level.front(), - in_level.begin() + above_level.back() + 1); - } - for (size_t lvl = 0; lvl < res.size(); lvl++) { - // to make the first offset equals 0, all the elements minus the first - // element - size_t front = res[lvl].front(); - for (auto &ele : res[lvl]) { - ele -= front; - } - } - return res; -} - -LoD ToAbsOffset(const LoD &in) { - // the lowest level stores relative offsets - if (in.empty() || in.size() == 1) - return in; - LoD result = in; - for (auto level = static_cast(in.size() - 2); level >= 0; level--) { - for (size_t i = 0; i < in[level].size(); ++i) { - size_t index = in[level][i]; - result[level][i] = result[level + 1][index]; - } - } - return result; -} - -bool operator==(const LoD &a, const LoD &b) { - if (a.size() != b.size()) { - return false; - } - - for (size_t i = 0; i < a.size(); i++) { - const auto &a_level = a[i]; - const auto &b_level = b[i]; - if (a_level.size() != b_level.size()) { - return false; - } - for (size_t j = 0; j < a_level.size(); j++) { - if (a_level[j] != b_level[j]) { - return false; - } - } - } - return true; -} - -bool CheckLoD(const LoD &in, int tensor_height) { - if (in.empty()) - return true; - for (const auto &level : in) { - // check: there should be more than 2 offsets existing in each level. - if (level.size() < 2) - return false; - // check: the first offset(the begin offset) of each level should be 0. - if (level.front() != 0) - return false; - // check: all the offsets in a level should be ascending(no same items - // allows). - if (!std::is_sorted(level.begin(), level.begin(), [](size_t a, size_t b) { - if (a < b) + namespace framework { + + std::ostream &operator<<(std::ostream &os, const LoD &lod) { + os << "{"; + for (auto &v : lod) { + os << "{"; + bool is_first = true; + for (auto &i : v) { + if (is_first) { + os << i; + is_first = false; + } else { + os << ", " << i; + } + } + os << "}"; + } + os << "}"; + + return os; + } + + std::ostream &operator<<(std::ostream &os, const LoDTensor &t) { + // PADDLE_ENFORCE(t.type().hash_code() == + // typeid(float).hash_code()); + + // if (!platform::is_cpu_place(t.place())) { + // LoDTensor tt; + // framework::TensorCopy(t, platform::CPUPlace(), &tt); + // platform::DeviceContextPool &pool = + // platform::DeviceContextPool::Instance(); auto &dev_ctx = + // *pool.Get(t.place()); dev_ctx.Wait(); + // + // os << tt; + // return os; + // } + + os << "dim: " << t.dims() << "\n"; + os << "lod: " << t.lod() << "\n"; + + // only print first ten elements + int64_t size = t.numel() < 10 ? t.numel() : 10; + for (int64_t i = 0; i < size; ++i) { + os << t.data()[i] << " "; + } + + return os; + } + + std::string LoDToString(const LoD &lod) { + std::ostringstream stream; + stream << lod; + return stream.str(); + } + + LoD SliceInLevel(const LoD &in, size_t level, size_t elem_begin, + size_t elem_end) { + // PADDLE_ENFORCE_LT(level, in.size()); + // PADDLE_ENFORCE_LT(elem_end, in[level].size()); + + LoD res; + res.resize(in.size() - level); + // copy the first level + res[0].assign(in[level].begin() + elem_begin, + in[level].begin() + elem_end + 1); + for (size_t lvl = 1; lvl < res.size(); lvl++) { + const auto &in_level = in[level + lvl]; + const auto &above_level = res[lvl - 1]; + auto &out_level = res[lvl]; + out_level.assign(in_level.begin() + above_level.front(), + in_level.begin() + above_level.back() + 1); + } + for (size_t lvl = 0; lvl < res.size(); lvl++) { + // to make the first offset equals 0, all the elements minus the + // first + // element + size_t front = res[lvl].front(); + for (auto &ele : res[lvl]) { + ele -= front; + } + } + return res; + } + + LoD ToAbsOffset(const LoD &in) { + // the lowest level stores relative offsets + if (in.empty() || in.size() == 1) + return in; + LoD result = in; + for (auto level = static_cast(in.size() - 2); level >= 0; + level--) { + for (size_t i = 0; i < in[level].size(); ++i) { + size_t index = in[level][i]; + result[level][i] = result[level + 1][index]; + } + } + return result; + } + + bool operator==(const LoD &a, const LoD &b) { + if (a.size() != b.size()) { + return false; + } + + for (size_t i = 0; i < a.size(); i++) { + const auto &a_level = a[i]; + const auto &b_level = b[i]; + if (a_level.size() != b_level.size()) { + return false; + } + for (size_t j = 0; j < a_level.size(); j++) { + if (a_level[j] != b_level[j]) { + return false; + } + } + } return true; - return false; - })) { - std::cout << "ascending error"; - return false; - } - } - // check: the lowest level's last offset should equals `tensor_height` if - // tensor_height>0. - if (tensor_height > 0 && (size_t)tensor_height != in.back().back()) - return false; - - // check: the higher level's last offset should equals the lower level's - // size-1. - // NOTE LoD store the levels from top to bottom, so the higher level goes - // first. - for (size_t level = 0; level < in.size() - 1; level++) { - if (in[level].back() != in[level + 1].size() - 1) - return false; - } - return true; -} - -bool CheckAbsLoD(const LoD &in, int tensor_height) { - if (in.empty()) - return true; - for (const auto &level : in) { - // check: all the offsets in a level should be ascending(no same items - // allows). - if (!std::is_sorted(level.begin(), level.begin(), [](size_t a, size_t b) { - if (a < b) + } + + bool CheckLoD(const LoD &in, int tensor_height) { + if (in.empty()) + return true; + for (const auto &level : in) { + // check: there should be more than 2 offsets existing in each + // level. + if (level.size() < 2) + return false; + // check: the first offset(the begin offset) of each level + // should be 0. + if (level.front() != 0) + return false; + // check: all the offsets in a level should be ascending(no same + // items + // allows). + if (!std::is_sorted(level.begin(), level.begin(), + [](size_t a, size_t b) { + if (a < b) + return true; + return false; + })) { + std::cout << "ascending error"; + return false; + } + } + // check: the lowest level's last offset should equals + // `tensor_height` if + // tensor_height>0. + if (tensor_height > 0 && (size_t)tensor_height != in.back().back()) + return false; + + // check: the higher level's last offset should equals the lower + // level's + // size-1. + // NOTE LoD store the levels from top to bottom, so the higher level + // goes + // first. + for (size_t level = 0; level < in.size() - 1; level++) { + if (in[level].back() != in[level + 1].size() - 1) + return false; + } return true; - return false; - })) { - return false; - } - - // check: there should be more than 2 offsets existing in each level. - if (level.size() < 2) - return false; - - // check: the first offset of each level should be 0, and the last should be - // the same(the height of underlying tensor). - if (level.front() != 0) - return false; - if (tensor_height < 0) { - tensor_height = level.back(); - } else if ((size_t)tensor_height != level.back()) { - return false; - } - } - return true; -} - -using LoDAndOffset = std::pair>; - -LoDAndOffset GetSubLoDAndAbsoluteOffset(const LoD &lod, size_t start_idx, - size_t end_idx, size_t start_level) { - LoD sub_lod; - - for (size_t level_idx = start_level; level_idx < lod.size(); ++level_idx) { - // PADDLE_ENFORCE_LE(start_idx, end_idx); - // PADDLE_ENFORCE_LT(end_idx, lod[level_idx].size()); - std::vector level_lens; - for (size_t i = start_idx; i < end_idx; ++i) { - level_lens.push_back(lod[level_idx][i + 1] - lod[level_idx][i]); - } - sub_lod.emplace_back(level_lens); - start_idx = lod[level_idx][start_idx]; - end_idx = lod[level_idx][end_idx]; - } - - return LoDAndOffset{sub_lod, {start_idx, end_idx}}; -} - -void AppendLoD(LoD *lod, const LoD &lod_length) { - // PADDLE_ENFORCE( - // lod->empty() || lod->size() == lod_length.size(), - // "The lod_length should has the same size with the appended lod."); - if (lod->empty()) { - for (size_t i = 0; i < lod_length.size(); ++i) { - lod->emplace_back(1, 0); // size = 1, value = 0; - } - *lod = LoD(lod_length.size(), std::vector({0})); - } - for (size_t i = 0; i < lod->size(); ++i) { - auto &level = (*lod)[i]; - for (size_t len : lod_length[i]) { - level.push_back(level.back() + len); - } - } -} - -void SerializeToStream(std::ostream &os, const LoDTensor &tensor) { - { // the 1st field, uint32_t version for LoDTensor - constexpr uint32_t version = 0; - os.write(reinterpret_cast(&version), sizeof(version)); - } - { - // the 2st field, LoD information - // uint64_t lod_level - // uint64_t lod_level_1 size in byte. - // int* lod_level_1 data - // ... - auto lod = tensor.lod(); - uint64_t size = lod.size(); - os.write(reinterpret_cast(&size), sizeof(size)); - - for (auto &each : lod) { - size = each.size() * sizeof(framework::LoD::value_type::value_type); - os.write(reinterpret_cast(&size), sizeof(size)); - os.write(reinterpret_cast(each.data()), - static_cast(size)); - } - } - // the 3st field, Tensor - TensorToStream(os, static_cast(tensor)); -} - -void DeserializeFromStream(std::istream &is, LoDTensor *tensor) { - { - // the 1st field, unit32_t version for LoDTensor - uint32_t version; - is.read(reinterpret_cast(&version), sizeof(version)); - // PADDLE_ENFORCE_EQ(version, 0U, "Only version 0 is supported"); - } - { - // the 2st field, LoD information - uint64_t lod_level; - is.read(reinterpret_cast(&lod_level), sizeof(lod_level)); - auto &lod = *tensor->mutable_lod(); - lod.resize(lod_level); - for (uint64_t i = 0; i < lod_level; ++i) { - uint64_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - std::vector tmp(size / sizeof(size_t)); - is.read(reinterpret_cast(tmp.data()), - static_cast(size)); - lod[i] = tmp; - } - } - // the 3st filed, Tensor - TensorFromStream(is, static_cast(tensor)); -} - -} // namespace framework + } + + bool CheckAbsLoD(const LoD &in, int tensor_height) { + if (in.empty()) + return true; + for (const auto &level : in) { + // check: all the offsets in a level should be ascending(no same + // items + // allows). + if (!std::is_sorted(level.begin(), level.begin(), + [](size_t a, size_t b) { + if (a < b) + return true; + return false; + })) { + return false; + } + + // check: there should be more than 2 offsets existing in each + // level. + if (level.size() < 2) + return false; + + // check: the first offset of each level should be 0, and the + // last should be + // the same(the height of underlying tensor). + if (level.front() != 0) + return false; + if (tensor_height < 0) { + tensor_height = level.back(); + } else if ((size_t)tensor_height != level.back()) { + return false; + } + } + return true; + } + + using LoDAndOffset = std::pair>; + + LoDAndOffset GetSubLoDAndAbsoluteOffset(const LoD &lod, + size_t start_idx, + size_t end_idx, + size_t start_level) { + LoD sub_lod; + + for (size_t level_idx = start_level; level_idx < lod.size(); + ++level_idx) { + // PADDLE_ENFORCE_LE(start_idx, end_idx); + // PADDLE_ENFORCE_LT(end_idx, lod[level_idx].size()); + std::vector level_lens; + for (size_t i = start_idx; i < end_idx; ++i) { + level_lens.push_back(lod[level_idx][i + 1] - + lod[level_idx][i]); + } + sub_lod.emplace_back(level_lens); + start_idx = lod[level_idx][start_idx]; + end_idx = lod[level_idx][end_idx]; + } + + return LoDAndOffset{sub_lod, {start_idx, end_idx}}; + } + + void AppendLoD(LoD *lod, const LoD &lod_length) { + // PADDLE_ENFORCE( + // lod->empty() || lod->size() == lod_length.size(), + // "The lod_length should has the same size with the appended + // lod."); + if (lod->empty()) { + for (size_t i = 0; i < lod_length.size(); ++i) { + lod->emplace_back(1, 0); // size = 1, value = 0; + } + *lod = LoD(lod_length.size(), std::vector({0})); + } + for (size_t i = 0; i < lod->size(); ++i) { + auto &level = (*lod)[i]; + for (size_t len : lod_length[i]) { + level.push_back(level.back() + len); + } + } + } + + void SerializeToStream(std::ostream &os, const LoDTensor &tensor) { + { // the 1st field, uint32_t version for LoDTensor + constexpr uint32_t version = 0; + os.write(reinterpret_cast(&version), + sizeof(version)); + } + { + // the 2st field, LoD information + // uint64_t lod_level + // uint64_t lod_level_1 size in byte. + // int* lod_level_1 data + // ... + auto lod = tensor.lod(); + uint64_t size = lod.size(); + os.write(reinterpret_cast(&size), sizeof(size)); + + for (auto &each : lod) { + size = each.size() * + sizeof(framework::LoD::value_type::value_type); + os.write(reinterpret_cast(&size), + sizeof(size)); + os.write(reinterpret_cast(each.data()), + static_cast(size)); + } + } + // the 3st field, Tensor + TensorToStream(os, static_cast(tensor)); + } + + void DeserializeFromStream(std::istream &is, LoDTensor *tensor) { + { + // the 1st field, unit32_t version for LoDTensor + uint32_t version; + is.read(reinterpret_cast(&version), sizeof(version)); + // PADDLE_ENFORCE_EQ(version, 0U, "Only version 0 is + // supported"); + } + { + // the 2st field, LoD information + uint64_t lod_level; + is.read(reinterpret_cast(&lod_level), + sizeof(lod_level)); + auto &lod = *tensor->mutable_lod(); + lod.resize(lod_level); + for (uint64_t i = 0; i < lod_level; ++i) { + uint64_t size; + is.read(reinterpret_cast(&size), sizeof(size)); + std::vector tmp(size / sizeof(size_t)); + is.read(reinterpret_cast(tmp.data()), + static_cast(size)); + lod[i] = tmp; + } + } + // the 3st filed, Tensor + TensorFromStream(is, static_cast(tensor)); + } + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/lod_tensor.h b/src/framework/lod_tensor.h index ce93b78eb650035a7c9bf0a70d343eebca6e0277..251a569c4c60857058f9958af69eb75e5039b6b1 100644 --- a/src/framework/lod_tensor.h +++ b/src/framework/lod_tensor.h @@ -23,178 +23,190 @@ limitations under the License. */ namespace paddle_mobile { -namespace framework { - -/* - * LoD is short for Level of Details. - * - * - in a level, each element indicates relative offset of the lower level - * - the first element should be 0 and that indicates that this sequence start - * from 0 - * - each sequence's begin and end(no-inclusive) is level[id, id+1] - * - * For example: - * 3-level LoD stores - * - * 0 2 3 - * 0 2 4 7 - * 0 2 5 7 10 12 15 20 - */ -using LoD = std::vector>; - -std::ostream &operator<<(std::ostream &os, const LoD &lod); - -std::ostream &operator<<(std::ostream &os, const LoDTensor &t); - -std::string LoDToString(const LoD &lod); - -LoD SliceInLevel(const LoD &in, size_t level, size_t elem_begin, - size_t elem_end); - -/* - * Transform an LoD from relative offsets to absolute offsets. - */ -LoD ToAbsOffset(const LoD &in); - -bool operator==(const LoD &a, const LoD &b); - -/* - * Check whether this lod's format is valid. - * - * ATTENTION: - * - Empty lod is treated as valid. - * - * It will check two things: - * - * 1. all the offsets in a level should be ascending(no same items allows). - * 2. there should be more than 2 offsets existing in each level. - * 3. the higher level's last offset should equals the lower level's size-1. - * 4. the first offset(the begin offset) of each level should be 0. - * 5. the lowest level's last offset should equals `tensor_height` if - * tensor_height>0. - */ - -bool CheckLoD(const LoD &in, int tensor_height = -1); - -/* - * Check whether this absolute lod's format is valid. - * - * ATTENTION: - * - Empty lod is treated as valid. - * - * It will check two things: - * 1. all the offsets in a level should be ascending(no same items allows) - * 2. there should be more than 2 offsets existing in each level. - * 3. the first offset of each level should be 0, and the last should be the - * same(the height of underlying tensor) or `tensor_height` if - * tensor_height>0. - */ -bool CheckAbsLoD(const LoD &in, int tensor_height = -1); - -/* - * LoDTensor (Level of details Tensor) - * see https://en.wikipedia.org/wiki/Level_of_details for reference. - */ -class LoDTensor : public Tensor { -public: - LoDTensor() : Tensor() {} - - explicit LoDTensor(const LoD &lod) : lod_(lod) {} - - void set_lod(const LoD &lod) { lod_ = lod; } - - const LoD &lod() const { return lod_; } - - LoD *mutable_lod() { return &lod_; } - - /* - * Get the start offset and end offset of an element from LoD. - */ - std::pair lod_element(size_t level, size_t elem) const { - // PADDLE_ENFORCE_LT(level, NumLevels()); - // PADDLE_ENFORCE_LT(elem, NumElements(level)); - return std::make_pair((lod_)[level][elem], (lod_)[level][elem + 1]); - } - - /* - * Number of LoDTensor's levels, each level has units of data, for example, - * in the sentence's view, article, paragraph, sentence are 3 levels. - */ - size_t NumLevels() const { return lod_.size(); } - - /* - * Number of elements in a level. - */ - size_t NumElements(size_t level = 0) const { - // PADDLE_ENFORCE_LT(level, NumLevels()); - // the last offset is the end of last element - return (lod_)[level].size() - 1; - } - -private: - LoD lod_; -}; - -/* - * Expand the `source` to fit the LoD of `lod`. For example, a `source` - * LoDTensor is - * - LoD: [0, 2] - * - tensor: [a0, a1] - * a `lod` is - * - LoD: [0 3 5] - * returns a new LoDTensor - * - [a0 a0 a0 a1 a1] - */ -template -LoDTensor LodExpand(const LoDTensor &source, const LoD &lod, size_t level) { - LoD abs_lod = ToAbsOffset(lod); - const auto &lod_level = lod[level]; - size_t num_instances = source.dims()[0]; - - // new tensor - LoDTensor tensor; - tensor.set_lod(lod); - auto dims = source.dims(); - dims[0] = lod_level.back(); - tensor.Resize(dims); - tensor.mutable_data(); - - // PADDLE_ENFORCE_EQ(num_instances, lod_level.size() - 1); - for (size_t ins = 0; ins < num_instances; ins++) { - for (size_t elem = lod_level[ins]; elem < lod_level[ins + 1]; elem++) { - auto slice = tensor.Slice(elem, elem + 1); - TensorCopy(source.Slice(ins, ins + 1), &slice); - } - } - return tensor; -} - -// Get the absolute offset of a lod[start_level][start_idx:end_idx] and -// relative length of details for every levels(i.e., [start_level: ]). -// -// For example, -// lod = [[0, 3, 4, 8], [0, 9, 10, 11, 13, 17, 19, 22, 24]] -// start_level = 0 -// start_idx = 1 -// end_idx = 3 -// -// Returns: -// LoD = [[1, 4], [2, 4, 2, 3, 2]] -// pair = {11, 24} -std::pair> -GetSubLoDAndAbsoluteOffset(const LoD &lod, size_t start_idx, size_t end_idx, - size_t start_level); - -void AppendLoD(LoD *lod, const LoD &lod_length); - -/* - * Serialize/Desiralize LoDTensor to std::ostream - * You can pass ofstream or ostringstream to serilize to file - * or to a in memory string. GPU tensor will be copied to CPU. - */ -void SerializeToStream(std::ostream &os, const LoDTensor &tensor); - -void DeserializeFromStream(std::istream &is, LoDTensor *tensor); - -} // namespace framework + namespace framework { + + /* + * LoD is short for Level of Details. + * + * - in a level, each element indicates relative offset of the lower + * level + * - the first element should be 0 and that indicates that this sequence + * start + * from 0 + * - each sequence's begin and end(no-inclusive) is level[id, id+1] + * + * For example: + * 3-level LoD stores + * + * 0 2 3 + * 0 2 4 7 + * 0 2 5 7 10 12 15 20 + */ + using LoD = std::vector>; + + std::ostream &operator<<(std::ostream &os, const LoD &lod); + + std::ostream &operator<<(std::ostream &os, const LoDTensor &t); + + std::string LoDToString(const LoD &lod); + + LoD SliceInLevel(const LoD &in, size_t level, size_t elem_begin, + size_t elem_end); + + /* + * Transform an LoD from relative offsets to absolute offsets. + */ + LoD ToAbsOffset(const LoD &in); + + bool operator==(const LoD &a, const LoD &b); + + /* + * Check whether this lod's format is valid. + * + * ATTENTION: + * - Empty lod is treated as valid. + * + * It will check two things: + * + * 1. all the offsets in a level should be ascending(no same items + * allows). + * 2. there should be more than 2 offsets existing in each level. + * 3. the higher level's last offset should equals the lower level's + * size-1. + * 4. the first offset(the begin offset) of each level should be 0. + * 5. the lowest level's last offset should equals `tensor_height` if + * tensor_height>0. + */ + + bool CheckLoD(const LoD &in, int tensor_height = -1); + + /* + * Check whether this absolute lod's format is valid. + * + * ATTENTION: + * - Empty lod is treated as valid. + * + * It will check two things: + * 1. all the offsets in a level should be ascending(no same items + * allows) + * 2. there should be more than 2 offsets existing in each level. + * 3. the first offset of each level should be 0, and the last should + * be the + * same(the height of underlying tensor) or `tensor_height` if + * tensor_height>0. + */ + bool CheckAbsLoD(const LoD &in, int tensor_height = -1); + + /* + * LoDTensor (Level of details Tensor) + * see https://en.wikipedia.org/wiki/Level_of_details for reference. + */ + class LoDTensor : public Tensor { + public: + LoDTensor() : Tensor() {} + + explicit LoDTensor(const LoD &lod) : lod_(lod) {} + + void set_lod(const LoD &lod) { lod_ = lod; } + + const LoD &lod() const { return lod_; } + + LoD *mutable_lod() { return &lod_; } + + /* + * Get the start offset and end offset of an element from LoD. + */ + std::pair lod_element(size_t level, + size_t elem) const { + // PADDLE_ENFORCE_LT(level, NumLevels()); + // PADDLE_ENFORCE_LT(elem, NumElements(level)); + return std::make_pair((lod_)[level][elem], + (lod_)[level][elem + 1]); + } + + /* + * Number of LoDTensor's levels, each level has units of data, for + * example, + * in the sentence's view, article, paragraph, sentence are 3 + * levels. + */ + size_t NumLevels() const { return lod_.size(); } + + /* + * Number of elements in a level. + */ + size_t NumElements(size_t level = 0) const { + // PADDLE_ENFORCE_LT(level, NumLevels()); + // the last offset is the end of last element + return (lod_)[level].size() - 1; + } + + private: + LoD lod_; + }; + + /* + * Expand the `source` to fit the LoD of `lod`. For example, a `source` + * LoDTensor is + * - LoD: [0, 2] + * - tensor: [a0, a1] + * a `lod` is + * - LoD: [0 3 5] + * returns a new LoDTensor + * - [a0 a0 a0 a1 a1] + */ + template + LoDTensor LodExpand(const LoDTensor &source, const LoD &lod, + size_t level) { + LoD abs_lod = ToAbsOffset(lod); + const auto &lod_level = lod[level]; + size_t num_instances = source.dims()[0]; + + // new tensor + LoDTensor tensor; + tensor.set_lod(lod); + auto dims = source.dims(); + dims[0] = lod_level.back(); + tensor.Resize(dims); + tensor.mutable_data(); + + // PADDLE_ENFORCE_EQ(num_instances, lod_level.size() - 1); + for (size_t ins = 0; ins < num_instances; ins++) { + for (size_t elem = lod_level[ins]; elem < lod_level[ins + 1]; + elem++) { + auto slice = tensor.Slice(elem, elem + 1); + TensorCopy(source.Slice(ins, ins + 1), &slice); + } + } + return tensor; + } + + // Get the absolute offset of a lod[start_level][start_idx:end_idx] and + // relative length of details for every levels(i.e., [start_level: ]). + // + // For example, + // lod = [[0, 3, 4, 8], [0, 9, 10, 11, 13, 17, 19, 22, 24]] + // start_level = 0 + // start_idx = 1 + // end_idx = 3 + // + // Returns: + // LoD = [[1, 4], [2, 4, 2, 3, 2]] + // pair = {11, 24} + std::pair> + GetSubLoDAndAbsoluteOffset(const LoD &lod, size_t start_idx, + size_t end_idx, size_t start_level); + + void AppendLoD(LoD *lod, const LoD &lod_length); + + /* + * Serialize/Desiralize LoDTensor to std::ostream + * You can pass ofstream or ostringstream to serilize to file + * or to a in memory string. GPU tensor will be copied to CPU. + */ + void SerializeToStream(std::ostream &os, const LoDTensor &tensor); + + void DeserializeFromStream(std::istream &is, LoDTensor *tensor); + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/op_desc.cpp b/src/framework/op_desc.cpp index f6a5cf68ff1608eac3a771a11175e5823f318869..7d7139af651fc06bbec4cb21cd07b94690f6ee41 100644 --- a/src/framework/op_desc.cpp +++ b/src/framework/op_desc.cpp @@ -5,55 +5,58 @@ #include "op_desc.h" namespace paddle_mobile { -namespace framework { - -OpDesc::OpDesc(const proto::OpDesc &desc) : desc_(desc) { - for (int i = 0; i < desc_.inputs_size(); ++i) { - const proto::OpDesc::Var &var = desc_.inputs(i); - std::vector &args = inputs_[var.parameter()]; - int arg_size = var.arguments_size(); - for (int j = 0; j < arg_size; ++j) { - args.push_back(var.arguments(j)); - } - } - - for (int i = 0; i < desc_.outputs_size(); ++i) { - const proto::OpDesc::Var &var = desc_.outputs(i); - std::vector &args = outputs_[var.parameter()]; - int arg_size = var.arguments_size(); - for (int j = 0; j < arg_size; ++j) { - args.push_back(var.arguments(j)); - } - } - - for (const proto::OpDesc::Attr &attr : desc_.attrs()) { - std::string attr_name = attr.name(); - if (attr.type() != proto::AttrType::BLOCK) { - attrs_[attr_name] = Attribute::GetAttrValue(attr); - // if (attr.type() == proto::AttrType::INT){ - // std::cout << " attrName " << attr_name << " " << - // attrs_[attr_name].Get() << std::endl; - // } - } - } -} - -const std::vector &OpDesc::Input(const std::string &name) const { - return inputs_.find(name)->second; -} - -const std::vector &OpDesc::Output(const std::string &name) const { - return outputs_.find(name)->second; -} - -Attribute OpDesc::GetAttr(const std::string &name) const { - auto it = attrs_.find(name); - return it->second; -} - -const std::unordered_map &OpDesc::GetAttrMap() const { - return attrs_; -} - -} // namespace framework + namespace framework { + + OpDesc::OpDesc(const proto::OpDesc &desc) : desc_(desc) { + for (int i = 0; i < desc_.inputs_size(); ++i) { + const proto::OpDesc::Var &var = desc_.inputs(i); + std::vector &args = inputs_[var.parameter()]; + int arg_size = var.arguments_size(); + for (int j = 0; j < arg_size; ++j) { + args.push_back(var.arguments(j)); + } + } + + for (int i = 0; i < desc_.outputs_size(); ++i) { + const proto::OpDesc::Var &var = desc_.outputs(i); + std::vector &args = outputs_[var.parameter()]; + int arg_size = var.arguments_size(); + for (int j = 0; j < arg_size; ++j) { + args.push_back(var.arguments(j)); + } + } + + for (const proto::OpDesc::Attr &attr : desc_.attrs()) { + std::string attr_name = attr.name(); + if (attr.type() != proto::AttrType::BLOCK) { + attrs_[attr_name] = Attribute::GetAttrValue(attr); + // if (attr.type() == proto::AttrType::INT){ + // std::cout << " attrName " << attr_name << " " << + // attrs_[attr_name].Get() << std::endl; + // } + } + } + } + + const std::vector & + OpDesc::Input(const std::string &name) const { + return inputs_.find(name)->second; + } + + const std::vector & + OpDesc::Output(const std::string &name) const { + return outputs_.find(name)->second; + } + + Attribute OpDesc::GetAttr(const std::string &name) const { + auto it = attrs_.find(name); + return it->second; + } + + const std::unordered_map & + OpDesc::GetAttrMap() const { + return attrs_; + } + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/op_desc.h b/src/framework/op_desc.h index 61fe4c99899ba9d3f1c29e660a992fa443ab2163..d104c8c8fdb007fc444f0223b317e2b5a738de4a 100644 --- a/src/framework/op_desc.h +++ b/src/framework/op_desc.h @@ -23,29 +23,31 @@ SOFTWARE. #include "paddle_mobile_object.h" namespace paddle_mobile { -namespace framework { + namespace framework { -class OpDesc : PaddleMobileObject { -public: - OpDesc(const proto::OpDesc &desc); - const std::vector &Input(const std::string &name) const; - const std::vector &Output(const std::string &name) const; - Attribute GetAttr(const std::string &name) const; + class OpDesc : PaddleMobileObject { + public: + OpDesc(const proto::OpDesc &desc); + const std::vector & + Input(const std::string &name) const; + const std::vector & + Output(const std::string &name) const; + Attribute GetAttr(const std::string &name) const; - const VariableNameMap &GetInputs() { return inputs_; } + const VariableNameMap &GetInputs() { return inputs_; } - const VariableNameMap &GetOutputs() { return outputs_; } + const VariableNameMap &GetOutputs() { return outputs_; } - const AttributeMap &GetAttrMap() const; + const AttributeMap &GetAttrMap() const; - const std::string &Type() { return desc_.type(); }; + const std::string &Type() { return desc_.type(); }; -private: - proto::OpDesc desc_; - VariableNameMap inputs_; - VariableNameMap outputs_; - AttributeMap attrs_; -}; + private: + proto::OpDesc desc_; + VariableNameMap inputs_; + VariableNameMap outputs_; + AttributeMap attrs_; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/op_info.h b/src/framework/op_info.h index ed41fbd208487a0918425de225f58e3b1a330166..17714c1288a965da92c1389c84117cbba3785e78 100644 --- a/src/framework/op_info.h +++ b/src/framework/op_info.h @@ -22,70 +22,74 @@ SOFTWARE. #include "framework.pb.h" namespace paddle_mobile { -namespace framework { - -template struct OpInfo { - OpCreator creator_; - const OpCreator &Creator() const { - // PADDLE_ENFORCE_NOT_NULL(creator_, - // "Operator Creator has not been registered"); - return creator_; - } -}; - -template class OpInfoMap; - -template static OpInfoMap *g_op_info_map = nullptr; - -template class OpInfoMap { -public: - static OpInfoMap &Instance() { - if (g_op_info_map == nullptr) { - g_op_info_map = new OpInfoMap(); - } - return *g_op_info_map; - }; - - bool Has(const std::string &op_type) const { - return map_.find(op_type) != map_.end(); - } - - void Insert(const std::string &type, const OpInfo &info) { - // PADDLE_ENFORCE(!Has(type), "Operator %s has been registered", type); - map_.insert({type, info}); - } - - const OpInfo &Get(const std::string &type) const { - auto op_info_ptr = GetNullable(type); - // PADDLE_ENFORCE_NOT_NULL(op_info_ptr, "Operator %s has not been - // registered", - // type); - return *op_info_ptr; - } - - const OpInfo *GetNullable(const std::string &type) const { - auto it = map_.find(type); - if (it == map_.end()) { - return nullptr; - } else { - return &it->second; - } - } - - const std::unordered_map> &map() const { - return map_; - } - - std::unordered_map> *mutable_map() { - return &map_; - } - -private: - OpInfoMap() = default; - std::unordered_map> map_; - - // DISABLE_COPY_AND_ASSIGN(OpInfoMap); -}; - -} // namespace framework + namespace framework { + + template struct OpInfo { + OpCreator creator_; + const OpCreator &Creator() const { + // PADDLE_ENFORCE_NOT_NULL(creator_, + // "Operator Creator has not been + // registered"); + return creator_; + } + }; + + template class OpInfoMap; + + template + static OpInfoMap *g_op_info_map = nullptr; + + template class OpInfoMap { + public: + static OpInfoMap &Instance() { + if (g_op_info_map == nullptr) { + g_op_info_map = new OpInfoMap(); + } + return *g_op_info_map; + }; + + bool Has(const std::string &op_type) const { + return map_.find(op_type) != map_.end(); + } + + void Insert(const std::string &type, const OpInfo &info) { + // PADDLE_ENFORCE(!Has(type), "Operator %s has been + // registered", type); + map_.insert({type, info}); + } + + const OpInfo &Get(const std::string &type) const { + auto op_info_ptr = GetNullable(type); + // PADDLE_ENFORCE_NOT_NULL(op_info_ptr, "Operator %s has not + // been + // registered", + // type); + return *op_info_ptr; + } + + const OpInfo *GetNullable(const std::string &type) const { + auto it = map_.find(type); + if (it == map_.end()) { + return nullptr; + } else { + return &it->second; + } + } + + const std::unordered_map> &map() const { + return map_; + } + + std::unordered_map> *mutable_map() { + return &map_; + } + + private: + OpInfoMap() = default; + std::unordered_map> map_; + + // DISABLE_COPY_AND_ASSIGN(OpInfoMap); + }; + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/op_kernel_type.h b/src/framework/op_kernel_type.h index 67aa0d7ad9eab550568e5a92f557b3551afe0721..501413d1b4f875ef4b2df4db7f800f3651da45d7 100644 --- a/src/framework/op_kernel_type.h +++ b/src/framework/op_kernel_type.h @@ -22,43 +22,51 @@ SOFTWARE. #include "framework.pb.h" namespace paddle_mobile { -namespace framework { -struct OpKernelType { - struct Hash { - size_t operator()(const OpKernelType &key) const { - int data_type = static_cast(key.data_type_) << LEFT_SHIFT; - int data_layout = static_cast(key.data_layout_) << (LEFT_SHIFT * 2); + namespace framework { + struct OpKernelType { + struct Hash { + size_t operator()(const OpKernelType &key) const { + int data_type = static_cast(key.data_type_) + << LEFT_SHIFT; + int data_layout = static_cast(key.data_layout_) + << (LEFT_SHIFT * 2); - std::hash hasher; - return hasher(data_type + data_layout); - } - }; + std::hash hasher; + return hasher(data_type + data_layout); + } + }; - // place, data_type, library_type kinds less than 2^8 - constexpr static int LEFT_SHIFT = 8; + // place, data_type, library_type kinds less than 2^8 + constexpr static int LEFT_SHIFT = 8; - proto::VarType::Type data_type_; - DataLayout data_layout_; + proto::VarType::Type data_type_; + DataLayout data_layout_; - OpKernelType(proto::VarType::Type data_type, - DataLayout data_layout = DataLayout::kAnyLayout) - : data_type_(data_type), data_layout_(data_layout) {} + OpKernelType(proto::VarType::Type data_type, + DataLayout data_layout = DataLayout::kAnyLayout) + : data_type_(data_type), data_layout_(data_layout) {} - bool operator==(const OpKernelType &o) const { - return data_type_ == o.data_type_ && data_layout_ == o.data_layout_; - } + bool operator==(const OpKernelType &o) const { + return data_type_ == o.data_type_ && + data_layout_ == o.data_layout_; + } - bool operator!=(const OpKernelType &o) const { return !(*this == o); } -}; + bool operator!=(const OpKernelType &o) const { + return !(*this == o); + } + }; -inline bool NeedTransformLayout(const DataLayout &l, const DataLayout &r) { - return l != DataLayout::kAnyLayout && r != DataLayout::kAnyLayout && l != r; -} + inline bool NeedTransformLayout(const DataLayout &l, + const DataLayout &r) { + return l != DataLayout::kAnyLayout && r != DataLayout::kAnyLayout && + l != r; + } -inline bool TransFromNeeded(const OpKernelType &l, const OpKernelType &r) { - return (l.data_type_ != r.data_type_) || - NeedTransformLayout(l.data_layout_, r.data_layout_); -} + inline bool TransFromNeeded(const OpKernelType &l, + const OpKernelType &r) { + return (l.data_type_ != r.data_type_) || + NeedTransformLayout(l.data_layout_, r.data_layout_); + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/op_proto_maker.h b/src/framework/op_proto_maker.h index c4e8fed0cd9b0d86856d817cb0c699f51bec74ee..e5d4408c6eda406835cb61a38ee0f16ff458ee65 100644 --- a/src/framework/op_proto_maker.h +++ b/src/framework/op_proto_maker.h @@ -19,8 +19,8 @@ SOFTWARE. #pragma once namespace paddle_mobile { -namespace framework { -// this class not only make proto but also init attribute checkers. -class OpProtoAndCheckerMaker {}; -} // namespace framework + namespace framework { + // this class not only make proto but also init attribute checkers. + class OpProtoAndCheckerMaker {}; + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/operator.cpp b/src/framework/operator.cpp index 5fceb3f1a08813d9af52f7de9622f0a7e36c116d..7e8b9ce48e30555b5a66e6bfecffb618c83e8e41 100644 --- a/src/framework/operator.cpp +++ b/src/framework/operator.cpp @@ -20,26 +20,26 @@ SOFTWARE. #include "op_info.h" namespace paddle_mobile { -namespace framework { + namespace framework { -template -OperatorBase::OperatorBase(const std::string &type, - const VariableNameMap &inputs, - const VariableNameMap &outputs, - const AttributeMap &attrs, - std::shared_ptr scope) - : type_(type), inputs_(inputs), outputs_(outputs), attrs_(attrs), - scope_(scope) { - CheckAllInputOutputSet(); -} + template + OperatorBase::OperatorBase(const std::string &type, + const VariableNameMap &inputs, + const VariableNameMap &outputs, + const AttributeMap &attrs, + std::shared_ptr scope) + : type_(type), inputs_(inputs), outputs_(outputs), attrs_(attrs), + scope_(scope) { + CheckAllInputOutputSet(); + } -template void OperatorBase::Run() { RunImpl(); } + template void OperatorBase::Run() { RunImpl(); } -template -void OperatorBase::CheckAllInputOutputSet() const {} + template + void OperatorBase::CheckAllInputOutputSet() const {} -template class OperatorBase; -template class OperatorWithKernel; + template class OperatorBase; + template class OperatorWithKernel; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/operator.h b/src/framework/operator.h index e14e30aba8955ac04b0a3b1a0a09c92dd89f096b..782dfd0b79b8c12ffd39fe4a990fd48637689e38 100644 --- a/src/framework/operator.h +++ b/src/framework/operator.h @@ -33,53 +33,57 @@ SOFTWARE. #include "variable.h" namespace paddle_mobile { -namespace framework { + namespace framework { -template class OperatorBase : PaddleMobileObject { -public: - OperatorBase(const std::string &type, const VariableNameMap &inputs, - const VariableNameMap &outputs, const AttributeMap &attrs, - std::shared_ptr scope); - virtual ~OperatorBase() {} - virtual void Run(); - const VariableNameMap &Inputs() const { return inputs_; } - const VariableNameMap &Outputs() const { return outputs_; } - const std::string &Type() const { return type_; } - const AttributeMap &Attrs() const { return attrs_; } + template class OperatorBase : PaddleMobileObject { + public: + OperatorBase(const std::string &type, const VariableNameMap &inputs, + const VariableNameMap &outputs, + const AttributeMap &attrs, + std::shared_ptr scope); + virtual ~OperatorBase() {} + virtual void Run(); + const VariableNameMap &Inputs() const { return inputs_; } + const VariableNameMap &Outputs() const { return outputs_; } + const std::string &Type() const { return type_; } + const AttributeMap &Attrs() const { return attrs_; } -protected: - std::shared_ptr scope_; - std::string type_; - VariableNameMap inputs_; - VariableNameMap outputs_; - AttributeMap attrs_; + protected: + std::shared_ptr scope_; + std::string type_; + VariableNameMap inputs_; + VariableNameMap outputs_; + AttributeMap attrs_; -private: - void CheckAllInputOutputSet() const; - virtual void RunImpl() const = 0; -}; + private: + void CheckAllInputOutputSet() const; + virtual void RunImpl() const = 0; + }; -template -class OperatorWithKernel : public OperatorBase { -public: - OperatorWithKernel(const std::string &type, const VariableNameMap &inputs, - const VariableNameMap &outputs, const AttributeMap &attrs, - std::shared_ptr scope) - : OperatorBase(type, inputs, outputs, attrs, scope) {} - virtual void InferShape() const = 0; + template + class OperatorWithKernel : public OperatorBase { + public: + OperatorWithKernel(const std::string &type, + const VariableNameMap &inputs, + const VariableNameMap &outputs, + const AttributeMap &attrs, + std::shared_ptr scope) + : OperatorBase(type, inputs, outputs, attrs, scope) {} + virtual void InferShape() const = 0; -protected: - virtual void RunImpl() const = 0; + protected: + virtual void RunImpl() const = 0; -private: -}; + private: + }; -template class OpKernelBase : PaddleMobileObject { -public: - virtual void Compute(const P ¶) const = 0; + template + class OpKernelBase : PaddleMobileObject { + public: + virtual void Compute(const P ¶) const = 0; - virtual ~OpKernelBase() = default; -}; + virtual ~OpKernelBase() = default; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/paddle_mobile_object.h b/src/framework/paddle_mobile_object.h index 61a42f00acc8ce4ed47ce7a8a68a85c5caf347af..b9b76ef0a14f882b4f18158c3f01571557f23f89 100644 --- a/src/framework/paddle_mobile_object.h +++ b/src/framework/paddle_mobile_object.h @@ -23,14 +23,14 @@ SOFTWARE. namespace paddle_mobile { -class PaddleMobileObject { -public: - virtual inline const std::string &ToString() { - char address[128] = {0}; - sprintf(address, "%p", this); - return std::string(address); - } + class PaddleMobileObject { + public: + virtual inline const std::string &ToString() { + char address[128] = {0}; + sprintf(address, "%p", this); + return std::string(address); + } -private: -}; + private: + }; } // namespace paddle_mobile diff --git a/src/framework/program.cpp b/src/framework/program.cpp index 5050ca3aba021e8758a4d13f45c2054302e2b611..a9b297345c566d81c0b1cc7b67eb2b3cc0d74ce3 100644 --- a/src/framework/program.cpp +++ b/src/framework/program.cpp @@ -17,5 +17,5 @@ SOFTWARE. ==============================================================================*/ namespace paddle_mobile { -namespace framework {} + namespace framework {} } // namespace paddle_mobile diff --git a/src/framework/program.h b/src/framework/program.h index 8844757e2140e045fef8f6a889b501be659a3280..3a122dbd8c6f59d947b06cdf4c9f235a8fd4a10b 100644 --- a/src/framework/program.h +++ b/src/framework/program.h @@ -24,17 +24,17 @@ SOFTWARE. #include "scope.h" namespace paddle_mobile { -namespace framework { + namespace framework { -template -class Program : PaddleMobileObject { -public: - std::shared_ptr originProgram; - std::shared_ptr optimizeProgram; - std::shared_ptr scope; + template + class Program : PaddleMobileObject { + public: + std::shared_ptr originProgram; + std::shared_ptr optimizeProgram; + std::shared_ptr scope; -private: -}; + private: + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/program_desc.cpp b/src/framework/program_desc.cpp index a6a9d30a69c515ef7754b7422bfbe916257a8d8d..f03c252f0539080e16a6ca40042e5a18172c2021 100644 --- a/src/framework/program_desc.cpp +++ b/src/framework/program_desc.cpp @@ -5,18 +5,18 @@ #include "program_desc.h" namespace paddle_mobile { -namespace framework { + namespace framework { -ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) : desc_(desc) { - for (auto &block_desc : *desc_.mutable_blocks()) { - // new framework::BlockDesc(block_desc) - blocks_.emplace_back(std::make_shared(block_desc)); - } -} + ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) : desc_(desc) { + for (auto &block_desc : *desc_.mutable_blocks()) { + // new framework::BlockDesc(block_desc) + blocks_.emplace_back(std::make_shared(block_desc)); + } + } -std::shared_ptr ProgramDesc::Block(size_t idx) { - return blocks_[idx]; -} + std::shared_ptr ProgramDesc::Block(size_t idx) { + return blocks_[idx]; + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/program_desc.h b/src/framework/program_desc.h index a86d403c707c25ff1dbb9d3b048ce338338084de..50de0abd2d8e082c6610f6ec8a378a52ed476f06 100644 --- a/src/framework/program_desc.h +++ b/src/framework/program_desc.h @@ -25,18 +25,20 @@ SOFTWARE. #include "paddle_mobile_object.h" namespace paddle_mobile { -namespace framework { + namespace framework { -class ProgramDesc : PaddleMobileObject { -public: - ProgramDesc(const proto::ProgramDesc &desc); - std::shared_ptr Block(size_t idx); - const std::vector> &Blocks() { return blocks_; }; + class ProgramDesc : PaddleMobileObject { + public: + ProgramDesc(const proto::ProgramDesc &desc); + std::shared_ptr Block(size_t idx); + const std::vector> &Blocks() { + return blocks_; + }; -private: - std::vector> blocks_; - proto::ProgramDesc desc_; -}; + private: + std::vector> blocks_; + proto::ProgramDesc desc_; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/scope.cc b/src/framework/scope.cc index 97ab3020cf2af9e447ffcf34c87b798dde0e3336..b2f81fd7d0336395488632ef9d81574dfbe2e81b 100644 --- a/src/framework/scope.cc +++ b/src/framework/scope.cc @@ -4,113 +4,116 @@ #include namespace paddle_mobile { -namespace framework { + namespace framework { -Scope &Scope::NewScope() const { - std::unique_lock lock(mutex_); - kids_.push_back(new Scope(this)); - return *kids_.back(); -} + Scope &Scope::NewScope() const { + std::unique_lock lock(mutex_); + kids_.push_back(new Scope(this)); + return *kids_.back(); + } -Variable *Scope::Var(const std::string &name) { - auto *pvar = FindVarLocally(name); - if (pvar != nullptr) { - return pvar; - }; - pvar = new Variable; - vars_[name] = pvar; - pvar->name_ = &(vars_.find(name)->first); - return pvar; -} + Variable *Scope::Var(const std::string &name) { + auto *pvar = FindVarLocally(name); + if (pvar != nullptr) { + return pvar; + }; + pvar = new Variable; + vars_[name] = pvar; + pvar->name_ = &(vars_.find(name)->first); + return pvar; + } -// Variable* Scope::Var(std::string* name) { -// auto var_name = string::Sprintf("%p.%d", this, vars_.size()); -// if (name != nullptr) { -// *name = var_name; -// } -// return Var(var_name); -// } + // Variable* Scope::Var(std::string* name) { + // auto var_name = string::Sprintf("%p.%d", this, + // vars_.size()); + // if (name != nullptr) { + // *name = var_name; + // } + // return Var(var_name); + // } -Variable *Scope::FindVar(const std::string &name) const { - auto *pvar = FindVarLocally(name); - if (pvar != nullptr) { - return pvar; - } - return (parent_ == nullptr) ? nullptr : parent_->FindVar(name); -} + Variable *Scope::FindVar(const std::string &name) const { + auto *pvar = FindVarLocally(name); + if (pvar != nullptr) { + return pvar; + } + return (parent_ == nullptr) ? nullptr : parent_->FindVar(name); + } -const Scope *Scope::FindScope(const Variable *var) const { - for (auto &name_var : vars_) { - if (name_var.second == var) { - return this; - } - } - return (parent_ == nullptr) ? nullptr : parent_->FindScope(var); -} + const Scope *Scope::FindScope(const Variable *var) const { + for (auto &name_var : vars_) { + if (name_var.second == var) { + return this; + } + } + return (parent_ == nullptr) ? nullptr : parent_->FindScope(var); + } -void Scope::DropKids() { - for (Scope *s : kids_) { - delete s; - } - kids_.clear(); -} + void Scope::DropKids() { + for (Scope *s : kids_) { + delete s; + } + kids_.clear(); + } -std::vector Scope::LocalVarNames() const { - std::vector known_vars; - known_vars.reserve(vars_.size()); - for (auto &name_var : vars_) { - known_vars.emplace_back(name_var.first); - } - return known_vars; -} + std::vector Scope::LocalVarNames() const { + std::vector known_vars; + known_vars.reserve(vars_.size()); + for (auto &name_var : vars_) { + known_vars.emplace_back(name_var.first); + } + return known_vars; + } -void Scope::DeleteScope(Scope *scope) const { - std::unique_lock lock(mutex_); - auto it = std::find(kids_.begin(), kids_.end(), scope); - kids_.erase(it); - delete scope; - // deferent -} + void Scope::DeleteScope(Scope *scope) const { + std::unique_lock lock(mutex_); + auto it = std::find(kids_.begin(), kids_.end(), scope); + kids_.erase(it); + delete scope; + // deferent + } -void Scope::EraseVars(const std::vector &var_names) { - std::set var_set(var_names.begin(), var_names.end()); - for (auto it = vars_.begin(); it != vars_.end();) { - if (var_set.find(it->first) != var_set.end()) { - delete it->second; - it = vars_.erase(it); - } else { - ++it; - } - } -} + void Scope::EraseVars(const std::vector &var_names) { + std::set var_set(var_names.begin(), var_names.end()); + for (auto it = vars_.begin(); it != vars_.end();) { + if (var_set.find(it->first) != var_set.end()) { + delete it->second; + it = vars_.erase(it); + } else { + ++it; + } + } + } -void Scope::Rename(const std::string &origin_name, - const std::string &new_name) const { - auto origin_it = vars_.find(origin_name); - if (origin_it == vars_.end()) { - return; - } - auto new_it = vars_.find(new_name); - if (new_it != vars_.end()) { - return; - } - vars_[new_name] = origin_it->second; - vars_.erase(origin_it); -} -// -// std::string Scope::Rename(const std::string& origin_name) const { -// auto var_name = string::Sprintf("%p.%d", this, vars_.size()); -// Rename(origin_name, var_name); -// return var_name; -// } + void Scope::Rename(const std::string &origin_name, + const std::string &new_name) const { + auto origin_it = vars_.find(origin_name); + if (origin_it == vars_.end()) { + return; + } + auto new_it = vars_.find(new_name); + if (new_it != vars_.end()) { + return; + } + vars_[new_name] = origin_it->second; + vars_.erase(origin_it); + } + // + // std::string Scope::Rename(const std::string& origin_name) + // const { + // auto var_name = string::Sprintf("%p.%d", this, + // vars_.size()); + // Rename(origin_name, var_name); + // return var_name; + // } -Variable *Scope::FindVarLocally(const std::string &name) const { - auto it = vars_.find(name); - if (it != vars_.end()) { - return it->second; - } - return nullptr; -} + Variable *Scope::FindVarLocally(const std::string &name) const { + auto it = vars_.find(name); + if (it != vars_.end()) { + return it->second; + } + return nullptr; + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/scope.h b/src/framework/scope.h index 6da914dbd8ed39eb0c074cc569ca7c37d92f2c71..53b9bba5765527f4e2ee2bd3d3784c551d80a7ec 100644 --- a/src/framework/scope.h +++ b/src/framework/scope.h @@ -24,57 +24,58 @@ SOFTWARE. #include //std::unordered_map namespace paddle_mobile { -namespace framework { -class Scope { -public: - Scope() {} - ~Scope() {} + namespace framework { + class Scope { + public: + Scope() {} + ~Scope() {} - Scope &NewScope() const; + Scope &NewScope() const; - /// Create a variable with given name if it doesn't exist. - Variable *Var(const std::string &name); + /// Create a variable with given name if it doesn't exist. + Variable *Var(const std::string &name); - /// Create a variable with a scope-unique name. - Variable *Var(std::string *name = nullptr); + /// Create a variable with a scope-unique name. + Variable *Var(std::string *name = nullptr); - void EraseVars(const std::vector &var_names); + void EraseVars(const std::vector &var_names); - /// Find a variable in the scope or any of its ancestors. Returns - /// nullptr if cannot find. - Variable *FindVar(const std::string &name) const; + /// Find a variable in the scope or any of its ancestors. Returns + /// nullptr if cannot find. + Variable *FindVar(const std::string &name) const; - const Scope *parent() const { return parent_; } + const Scope *parent() const { return parent_; } - /// Find the scope or an ancestor scope that contains the given variable. - const Scope *FindScope(const Variable *var) const; + /// Find the scope or an ancestor scope that contains the given + /// variable. + const Scope *FindScope(const Variable *var) const; - void DeleteScope(Scope *scope) const; + void DeleteScope(Scope *scope) const; - /// Drop all kids scopes belonged to this scope. - void DropKids(); + /// Drop all kids scopes belonged to this scope. + void DropKids(); - // enumerate all the variables current contains. - std::vector LocalVarNames() const; + // enumerate all the variables current contains. + std::vector LocalVarNames() const; - // Rename variable to a new name - void Rename(const std::string &origin_name, - const std::string &new_name) const; + // Rename variable to a new name + void Rename(const std::string &origin_name, + const std::string &new_name) const; - // Rename variable to a new name and return the new name - std::string Rename(const std::string &origin_name) const; + // Rename variable to a new name and return the new name + std::string Rename(const std::string &origin_name) const; - Variable *FindVarLocally(const std::string &name) const; + Variable *FindVarLocally(const std::string &name) const; -private: - // Call Scope::NewScope for a sub-scope. - explicit Scope(Scope const *parent) : parent_(parent) {} + private: + // Call Scope::NewScope for a sub-scope. + explicit Scope(Scope const *parent) : parent_(parent) {} - mutable std::unordered_map vars_; - mutable std::list kids_; - Scope const *parent_{nullptr}; + mutable std::unordered_map vars_; + mutable std::list kids_; + Scope const *parent_{nullptr}; - mutable std::mutex mutex_; -}; -} // namespace framework + mutable std::mutex mutex_; + }; + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/selected_rows.h b/src/framework/selected_rows.h index 93e5c023c5fcbc2ccdfadefc68204fc069bf1eb6..264bb4378f7a50af338d50ba357dc5a49d6d1d33 100644 --- a/src/framework/selected_rows.h +++ b/src/framework/selected_rows.h @@ -24,57 +24,59 @@ SOFTWARE. #include "tensor.h" namespace paddle_mobile { -namespace framework { + namespace framework { -class SelectedRows { -public: - SelectedRows(const std::vector &rows, const int64_t &height) - : rows_(rows), height_(height) { - value_.reset(new Tensor()); - } + class SelectedRows { + public: + SelectedRows(const std::vector &rows, + const int64_t &height) + : rows_(rows), height_(height) { + value_.reset(new Tensor()); + } - SelectedRows() { - height_ = 0; - value_.reset(new Tensor()); - } + SelectedRows() { + height_ = 0; + value_.reset(new Tensor()); + } - const Tensor &value() const { return *value_; } + const Tensor &value() const { return *value_; } - Tensor *mutable_value() { return value_.get(); } + Tensor *mutable_value() { return value_.get(); } - int64_t height() const { return height_; } + int64_t height() const { return height_; } - void set_height(int64_t height) { height_ = height; } + void set_height(int64_t height) { height_ = height; } - const std::vector &rows() const { return rows_; } + const std::vector &rows() const { return rows_; } - std::vector *mutable_rows() { return &rows_; } + std::vector *mutable_rows() { return &rows_; } - void set_rows(const std::vector &rows) { rows_ = rows; } + void set_rows(const std::vector &rows) { rows_ = rows; } - /** - * get the index of id in rows - */ - int64_t index(int64_t id) const { - auto it = std::find(rows_.begin(), rows_.end(), id); - // PADDLE_ENFORCE(it != rows_.end(), "id should be in rows"); - return static_cast(std::distance(rows_.begin(), it)); - } + /** + * get the index of id in rows + */ + int64_t index(int64_t id) const { + auto it = std::find(rows_.begin(), rows_.end(), id); + // PADDLE_ENFORCE(it != rows_.end(), "id should be in rows"); + return static_cast(std::distance(rows_.begin(), it)); + } - DDim GetCompleteDims() const { - std::vector dims = vectorize(value_->dims()); - dims[0] = height_; - return make_ddim(dims); - } + DDim GetCompleteDims() const { + std::vector dims = vectorize(value_->dims()); + dims[0] = height_; + return make_ddim(dims); + } -private: - // Notice: rows can be duplicate. We can have {0, 4, 7, 0, 5, 7, 9} here. - // SelectedRows are simply concated when adding together. Until a - // SelectedRows add a Tensor, will the duplicate rows be handled. - std::vector rows_; - std::unique_ptr value_{nullptr}; - int64_t height_; -}; + private: + // Notice: rows can be duplicate. We can have {0, 4, 7, 0, 5, 7, 9} + // here. + // SelectedRows are simply concated when adding together. Until a + // SelectedRows add a Tensor, will the duplicate rows be handled. + std::vector rows_; + std::unique_ptr value_{nullptr}; + int64_t height_; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/tensor.h b/src/framework/tensor.h index b7182affd65baa7aa21165c3aab7b4f70ac6b2f5..0743a7bca7082b37a843ae45ea09911ce6bce104 100644 --- a/src/framework/tensor.h +++ b/src/framework/tensor.h @@ -25,287 +25,316 @@ limitations under the License. */ #include "memory/t_malloc.h" namespace paddle_mobile { -namespace framework { -template struct SizeOfTypeFunctor; - -template struct SizeOfTypeFunctor { - size_t operator()(std::type_index type) const { - if (typeid(T).hash_code() == type.hash_code()) { - return sizeof(T); - } else { - return 0UL; - } - } -}; - -template <> struct SizeOfTypeFunctor<> { - size_t operator()(std::type_index type) const { return 0UL; } -}; - -template -struct SizeOfTypeFunctor { - size_t operator()(std::type_index type) const { - SizeOfTypeFunctor head; - size_t head_size = head(type); - if (head_size != 0) { - return head_size; - } - SizeOfTypeFunctor tail; - return tail(type); - } -}; - -static inline size_t SizeOfType(std::type_index type) { - SizeOfTypeFunctor functor; - size_t size = functor(type); - // PADDLE_ENFORCE(size != 0UL, "Cannot get size of type %s", type.name()); - return size; -} - -class LoDTensor; - -class Tensor { -public: - Tensor() : offset_(0) {} - - /*! Return a pointer to mutable memory block. */ - template inline T *data() { - check_memory_size(); - // PADDLE_ENFORCE(std::is_same::value || - // holder_->type().hash_code() == typeid(T).hash_code(), - // "Tensor holds the wrong type, it holds %s", - // this->holder_->type().name()); - return reinterpret_cast(reinterpret_cast(holder_->ptr()) + - offset_); - } - - /*! Return a pointer to constant memory block. */ - template inline const T *data() const { - check_memory_size(); - // PADDLE_ENFORCE(std::is_same::value || - // holder_->type().hash_code() == typeid(T).hash_code(), - // "Tensor holds the wrong type, it holds %s", - // this->holder_->type().name()); - - return reinterpret_cast( - reinterpret_cast(holder_->ptr()) + offset_); - } - - inline bool IsInitialized() const { return holder_ != nullptr; } - - /** - * @brief Return a pointer to mutable memory block. - * @note If not exist, then allocation. - */ - template inline T *mutable_data() { - static_assert(std::is_pod::value, "T must be POD"); - return reinterpret_cast(mutable_data(typeid(T))); - } - - inline void *mutable_data(std::type_index type) { - if (holder_ != nullptr) { - holder_->set_type(type); - } - // PADDLE_ENFORCE_GE(numel(), 0, - // "When calling this method, the Tensor's numel must be - // " "equal or larger than zero. " "Please check - // Tensor::Resize has been called first."); - int64_t size = numel() * SizeOfType(type); - /* some versions of boost::variant don't have operator!= */ - if (holder_ == nullptr || holder_->size() < size + offset_) { - holder_.reset(new PlaceholderImpl(size, type)); - - offset_ = 0; - } - return reinterpret_cast( - reinterpret_cast(holder_->ptr()) + offset_); - } - - inline void *mutable_data() { - // PADDLE_ENFORCE(this->holder_ != nullptr, - // "Cannot invoke mutable data if current hold nothing."); - return mutable_data(holder_->type()); - } - - /** - * @brief Return a pointer to mutable memory block. - * - * @param[in] dims The dimensions of the memory block. - * @param[in] place The place of the memory block. - * - * @note If not exist, then allocation. - */ - template inline T *mutable_data(DDim dims) { - static_assert(std::is_pod::value, "T must be POD"); - Resize(dims); - return mutable_data(); - } - - /*! Return the dimensions of the memory block. */ - inline const DDim &dims() const { return dims_; } - - /*! Return the numel of the memory block. */ - inline int64_t numel() const { return product(dims_); } - - /*! Resize the dimensions of the memory block. */ - inline Tensor &Resize(const DDim &dims) { - dims_ = dims; - return *this; - } - - /*! The internal of two tensors share the same memory block. */ - inline Tensor &ShareDataWith(const Tensor &src) { - src.check_memory_size(); - *this = src; - return *this; - } - - /** - * @brief Return a sub-tensor of the given tensor. - * - * @param[in] begin_idx The index of the start row(inclusive) to slice. - * The index number begins from 0. - * @param[in] end_idx The index of the end row(exclusive) to slice. - * The index number begins from 0. - */ - inline Tensor Slice(int begin_idx, int end_idx) const { - check_memory_size(); - // PADDLE_ENFORCE_GE(begin_idx, 0, - // "The start row index must be greater than 0."); - // PADDLE_ENFORCE_LE(end_idx, dims_[0], "The end row index is out of - // bound."); PADDLE_ENFORCE_LT( - // begin_idx, end_idx, - // "The start row index must be lesser than the end row index."); - - if (dims_[0] == 1) { - return *this; - } else { - size_t base = numel() / dims_[0]; - Tensor dst; - dst.holder_ = holder_; - dst.set_layout(layout_); - DDim dst_dims = dims_; - dst_dims[0] = end_idx - begin_idx; - dst.Resize(dst_dims); - dst.offset_ = offset_ + begin_idx * base * SizeOfType(type()); - return dst; - } - } - - std::type_index type() const { - // PADDLE_ENFORCE_NOT_NULL( - // holder_, "Tensor not initialized yet when - // Tensor::type() is called."); - return holder_->type(); - } - - // memory size returns the holding memory size in byte. - size_t memory_size() const { - return holder_ == nullptr ? 0UL : holder_->size() - offset_; - } - - inline void check_memory_size() const { - // PADDLE_ENFORCE_NOT_NULL( - // holder_, "Tensor holds no memory. Call Tensor::mutable_data - // first."); - // PADDLE_ENFORCE_LE( - // numel() * SizeOfType(type()), memory_size(), - // "Tensor's dims_ is out of bound. Call Tensor::mutable_data " - // "first to re-allocate memory.\n" - // "or maybe the required data-type mismatches the data already - // stored."); - } - - inline DataLayout layout() const { return layout_; } - - inline void set_layout(const DataLayout layout) { layout_ = layout; } - -private: - /** - * @note Placeholder hides type T, so it doesn't appear as a template - * parameter of Variable. - */ - struct Placeholder { - virtual ~Placeholder() = default; - - virtual void *ptr() const = 0; - - virtual size_t size() const = 0; - - virtual std::type_index type() const = 0; - - virtual void set_type(std::type_index type) = 0; - }; - - struct PlaceholderImpl : public Placeholder { - PlaceholderImpl(size_t size, std::type_index type) - : ptr_(static_cast(memory::Alloc(size)), - memory::PODDeleter()), - size_(size), type_(type) { - // PADDLE_ENFORCE_NOT_NULL(ptr_, "Insufficient %s - // memory to allocation.", - // (is_cpu_place(place_) ? - // "CPU" : "GPU")); - } - - virtual size_t size() const { return size_; } - - virtual void *ptr() const { return static_cast(ptr_.get()); } - - virtual std::type_index type() const { return type_; } - - virtual void set_type(std::type_index type) { type_ = type; } - - /*! the pointer of memory block. */ - std::unique_ptr> ptr_; - - /*! the size of memory block. */ - size_t size_; - - /* the current type of memory */ - std::type_index type_; - }; - - /*! holds the memory block if allocated. */ - std::shared_ptr holder_; - - /** - * @brief points to elements dimensions. - * - * @note dims_ do not indicate the memory block size. - */ - - DDim dims_; - - /** - * @brief the layout of memory block, default is NHWC. - * - * @note the memory allocation order, describe how weight/data is stored - * For example, in 4-D Tensor(rank=4), there are three commonly - * used layout. They are - * NCHW, NHWC, CHWN. - * N,C,H,W for respectively the batch size, the number of - * feature maps, the height, the width. - */ - - DataLayout layout_ = DataLayout::kNHWC; - - /** - * @brief A PlaceHolder may be shared by more than one tensor. - * - * @note Some of them may be slices of the others. So the offset_ - * is introduced here to indicate the byte offset between - * PlaceHolder::ptr_ and where the tensor data really begins. - */ - size_t offset_; -}; - -inline Tensor ReshapeToMatrix(const Tensor &src, int num_col_dims) { - Tensor res; - res.ShareDataWith(src); - res.Resize(flatten_to_2d(src.dims(), num_col_dims)); - return res; -} - -} // namespace framework + namespace framework { + template struct SizeOfTypeFunctor; + + template struct SizeOfTypeFunctor { + size_t operator()(std::type_index type) const { + if (typeid(T).hash_code() == type.hash_code()) { + return sizeof(T); + } else { + return 0UL; + } + } + }; + + template <> struct SizeOfTypeFunctor<> { + size_t operator()(std::type_index type) const { return 0UL; } + }; + + template + struct SizeOfTypeFunctor { + size_t operator()(std::type_index type) const { + SizeOfTypeFunctor head; + size_t head_size = head(type); + if (head_size != 0) { + return head_size; + } + SizeOfTypeFunctor tail; + return tail(type); + } + }; + + static inline size_t SizeOfType(std::type_index type) { + SizeOfTypeFunctor + functor; + size_t size = functor(type); + // PADDLE_ENFORCE(size != 0UL, "Cannot get size of type %s", + // type.name()); + return size; + } + + class LoDTensor; + + class Tensor { + public: + Tensor() : offset_(0) {} + + /*! Return a pointer to mutable memory block. */ + template inline T *data() { + check_memory_size(); + // PADDLE_ENFORCE(std::is_same::value || + // holder_->type().hash_code() == + // typeid(T).hash_code(), + // "Tensor holds the wrong type, it holds %s", + // this->holder_->type().name()); + return reinterpret_cast( + reinterpret_cast(holder_->ptr()) + offset_); + } + + /*! Return a pointer to constant memory block. */ + template inline const T *data() const { + check_memory_size(); + // PADDLE_ENFORCE(std::is_same::value || + // holder_->type().hash_code() == + // typeid(T).hash_code(), + // "Tensor holds the wrong type, it holds %s", + // this->holder_->type().name()); + + return reinterpret_cast( + reinterpret_cast(holder_->ptr()) + offset_); + } + + inline bool IsInitialized() const { return holder_ != nullptr; } + + /** + * @brief Return a pointer to mutable memory block. + * @note If not exist, then allocation. + */ + template inline T *mutable_data() { + static_assert(std::is_pod::value, "T must be POD"); + return reinterpret_cast(mutable_data(typeid(T))); + } + + inline void *mutable_data(std::type_index type) { + if (holder_ != nullptr) { + holder_->set_type(type); + } + // PADDLE_ENFORCE_GE(numel(), 0, + // "When calling this method, the Tensor's + // numel must be + // " "equal or larger than zero. " "Please + // check + // Tensor::Resize has been called first."); + int64_t size = numel() * SizeOfType(type); + /* some versions of boost::variant don't have operator!= */ + if (holder_ == nullptr || holder_->size() < size + offset_) { + holder_.reset(new PlaceholderImpl(size, type)); + + offset_ = 0; + } + return reinterpret_cast( + reinterpret_cast(holder_->ptr()) + offset_); + } + + inline void *mutable_data() { + // PADDLE_ENFORCE(this->holder_ != nullptr, + // "Cannot invoke mutable data if current hold + // nothing."); + return mutable_data(holder_->type()); + } + + /** + * @brief Return a pointer to mutable memory block. + * + * @param[in] dims The dimensions of the memory block. + * @param[in] place The place of the memory block. + * + * @note If not exist, then allocation. + */ + template inline T *mutable_data(DDim dims) { + static_assert(std::is_pod::value, "T must be POD"); + Resize(dims); + return mutable_data(); + } + + /*! Return the dimensions of the memory block. */ + inline const DDim &dims() const { return dims_; } + + /*! Return the numel of the memory block. */ + inline int64_t numel() const { return product(dims_); } + + /*! Resize the dimensions of the memory block. */ + inline Tensor &Resize(const DDim &dims) { + dims_ = dims; + return *this; + } + + /*! The internal of two tensors share the same memory block. */ + inline Tensor &ShareDataWith(const Tensor &src) { + src.check_memory_size(); + *this = src; + return *this; + } + + /** + * @brief Return a sub-tensor of the given tensor. + * + * @param[in] begin_idx The index of the start row(inclusive) to + * slice. + * The index number begins from 0. + * @param[in] end_idx The index of the end row(exclusive) to + * slice. + * The index number begins from 0. + */ + inline Tensor Slice(int begin_idx, int end_idx) const { + check_memory_size(); + // PADDLE_ENFORCE_GE(begin_idx, 0, + // "The start row index must be greater than + // 0."); + // PADDLE_ENFORCE_LE(end_idx, dims_[0], "The end row index is + // out of + // bound."); PADDLE_ENFORCE_LT( + // begin_idx, end_idx, + // "The start row index must be lesser than the end row + // index."); + + if (dims_[0] == 1) { + return *this; + } else { + size_t base = numel() / dims_[0]; + Tensor dst; + dst.holder_ = holder_; + dst.set_layout(layout_); + DDim dst_dims = dims_; + dst_dims[0] = end_idx - begin_idx; + dst.Resize(dst_dims); + dst.offset_ = + offset_ + begin_idx * base * SizeOfType(type()); + return dst; + } + } + + std::type_index type() const { + // PADDLE_ENFORCE_NOT_NULL( + // holder_, "Tensor not initialized yet + // when + // Tensor::type() is called."); + return holder_->type(); + } + + // memory size returns the holding memory size in byte. + size_t memory_size() const { + return holder_ == nullptr ? 0UL : holder_->size() - offset_; + } + + inline void check_memory_size() const { + // PADDLE_ENFORCE_NOT_NULL( + // holder_, "Tensor holds no memory. Call + // Tensor::mutable_data + // first."); + // PADDLE_ENFORCE_LE( + // numel() * SizeOfType(type()), memory_size(), + // "Tensor's dims_ is out of bound. Call + // Tensor::mutable_data " + // "first to re-allocate memory.\n" + // "or maybe the required data-type mismatches the data + // already + // stored."); + } + + inline DataLayout layout() const { return layout_; } + + inline void set_layout(const DataLayout layout) { + layout_ = layout; + } + + private: + /** + * @note Placeholder hides type T, so it doesn't appear as a + * template + * parameter of Variable. + */ + struct Placeholder { + virtual ~Placeholder() = default; + + virtual void *ptr() const = 0; + + virtual size_t size() const = 0; + + virtual std::type_index type() const = 0; + + virtual void set_type(std::type_index type) = 0; + }; + + struct PlaceholderImpl : public Placeholder { + PlaceholderImpl(size_t size, std::type_index type) + : ptr_(static_cast(memory::Alloc(size)), + memory::PODDeleter()), + size_(size), type_(type) { + // PADDLE_ENFORCE_NOT_NULL(ptr_, + // "Insufficient %s + // memory to allocation.", + // (is_cpu_place(place_) + // ? + // "CPU" : + // "GPU")); + } + + virtual size_t size() const { return size_; } + + virtual void *ptr() const { + return static_cast(ptr_.get()); + } + + virtual std::type_index type() const { return type_; } + + virtual void set_type(std::type_index type) { type_ = type; } + + /*! the pointer of memory block. */ + std::unique_ptr> ptr_; + + /*! the size of memory block. */ + size_t size_; + + /* the current type of memory */ + std::type_index type_; + }; + + /*! holds the memory block if allocated. */ + std::shared_ptr holder_; + + /** + * @brief points to elements dimensions. + * + * @note dims_ do not indicate the memory block size. + */ + + DDim dims_; + + /** + * @brief the layout of memory block, default is NHWC. + * + * @note the memory allocation order, describe how weight/data is + * stored + * For example, in 4-D Tensor(rank=4), there are three + * commonly + * used layout. They are + * NCHW, NHWC, CHWN. + * N,C,H,W for respectively the batch size, the number of + * feature maps, the height, the width. + */ + + DataLayout layout_ = DataLayout::kNHWC; + + /** + * @brief A PlaceHolder may be shared by more than one tensor. + * + * @note Some of them may be slices of the others. So the offset_ + * is introduced here to indicate the byte offset between + * PlaceHolder::ptr_ and where the tensor data really + * begins. + */ + size_t offset_; + }; + + inline Tensor ReshapeToMatrix(const Tensor &src, int num_col_dims) { + Tensor res; + res.ShareDataWith(src); + res.Resize(flatten_to_2d(src.dims(), num_col_dims)); + return res; + } + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/tensor_util.cc b/src/framework/tensor_util.cc index a5f6a6a6d44b8b15768b863130d1ee3bbb72de09..bec717e5edb980c11b73b74872aaece94378da94 100644 --- a/src/framework/tensor_util.cc +++ b/src/framework/tensor_util.cc @@ -18,183 +18,189 @@ #include namespace paddle_mobile { -namespace framework { - -void TensorCopy(const Tensor &src, Tensor *dst) { - // VLOG(3) << "TensorCopy " << src.dims() << " from " << src.place() << " to - // " - // << dst_place; - src.check_memory_size(); - - dst->Resize(src.dims()); - dst->set_layout(src.layout()); - auto src_ptr = src.data(); - - auto dst_ptr = dst->mutable_data(src.type()); - - auto size = src.numel() * SizeOfType(src.type()); - - memory::Copy(dst_ptr, src_ptr, size); -} - -void TensorCopySync(const Tensor &src, Tensor *dst) { - // VLOG(3) << "TensorCopySync " << src.dims() << " from " << src.place() - // << " to " << dst_place; - src.check_memory_size(); - dst->Resize(src.dims()); - dst->set_layout(src.layout()); - auto src_ptr = src.data(); - auto dst_ptr = dst->mutable_data(src.type()); - auto size = src.numel() * SizeOfType(src.type()); - memory::Copy(dst_ptr, src_ptr, size); -} - -template struct AnyDTypeVisitor { - Predicate predicate_; - const Tensor &tensor_; - Tensor *out_; - - AnyDTypeVisitor(Predicate predicate, const Tensor &tensor, Tensor *out) - : predicate_(predicate), tensor_(tensor), out_(out) {} - - template void operator()() const { - // auto t = EigenVector::Flatten(tensor_); - // auto o = EigenScalar::From(*out_); - // return any of predicate_(t) is true. - // o.device(*ctx_.eigen_device()) = predicate_(t).any(); - } -}; - -template -inline void AnyImpl(Predicate predicate, const Tensor &tensor, - framework::Tensor *out) { - VisitDataType(ToDataType(tensor.type()), - AnyDTypeVisitor(predicate, tensor, out)); -} - -template struct AnyVisitor { - const framework::Tensor &tensor_; - Predicate predicate_; - - AnyVisitor(const framework::Tensor &tensor, Predicate predicate) - : tensor_(tensor), predicate_(std::move(predicate)) {} - - bool operator()(void) const { - framework::Tensor out; - out.Resize({1}); - out.mutable_data(); - AnyImpl(predicate_, tensor_, &out); - return this->GetResult(out); - } - - bool GetResult(const framework::Tensor &out) const { - return *out.data(); - } -}; - -template -inline bool Any(const framework::Tensor &tensor, Predicate predicate) { - AnyVisitor visitor(tensor, predicate); - // return platform::VisitPlace(visitor); - return visitor(); -} - -struct ContainsNANPredicate { - template - auto operator()(const T &eigen_vec) const - -> decltype(std::declval().isnan()) { - // Cast eigen_vector to vector of bool. true if is inf. - return eigen_vec.isnan(); - } -}; - -bool TensorContainsNAN(const framework::Tensor &tensor) { - ContainsNANPredicate predicate; - return Any(tensor, predicate); -} - -struct ContainsInfPredicate { - template - auto operator()(const T &eigen_vec) const - -> decltype(std::declval().isinf()) { - // Cast eigen_vector to vector of bool. true if is inf. - return eigen_vec.isinf(); - } -}; - -bool TensorContainsInf(const framework::Tensor &tensor) { - ContainsInfPredicate predicate; - return Any(tensor, predicate); -} - -void TensorToStream(std::ostream &os, const Tensor &tensor) { - { // the 1st field, uint32_t version - constexpr uint32_t version = 0; - os.write(reinterpret_cast(&version), sizeof(version)); - } - { // the 2nd field, tensor description - // int32_t size - // void* protobuf message - proto::VarType::TensorDesc desc; - desc.set_data_type(framework::ToDataType(tensor.type())); - auto dims = framework::vectorize(tensor.dims()); - auto *pb_dims = desc.mutable_dims(); - pb_dims->Resize(static_cast(dims.size()), 0); - std::copy(dims.begin(), dims.end(), pb_dims->begin()); - int32_t size = desc.ByteSize(); - os.write(reinterpret_cast(&size), sizeof(size)); - auto out = desc.SerializeAsString(); - os.write(out.data(), size); - } - { // the 3rd field, tensor data - uint64_t size = tensor.memory_size(); - auto *data_ptr = tensor.data(); - // PADDLE_ENFORCE(size < std::numeric_limits::max(), - // "Index overflow when writing tensor"); - - os.write(static_cast(data_ptr), - static_cast(size)); - } -} - -struct DeserializedDataFunctor { - DeserializedDataFunctor(void **buf, Tensor *tensor) - : buf_(buf), tensor_(tensor) {} - - template void operator()() { - *buf_ = tensor_->mutable_data(); - } - - void **buf_; - Tensor *tensor_; -}; - -void TensorFromStream(std::istream &is, framework::Tensor *tensor) { - uint32_t version; - is.read(reinterpret_cast(&version), sizeof(version)); - // PADDLE_ENFORCE_EQ(version, 0U, "Only version 0 is supported"); - proto::VarType::TensorDesc desc; - { // int32_t size - // proto buffer - int32_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - std::unique_ptr buf(new char[size]); - is.read(reinterpret_cast(buf.get()), size); - // PADDLE_ENFORCE(desc.ParseFromArray(buf.get(), size), - // "Cannot parse tensor desc"); - } - { // read tensor - std::vector dims; - dims.reserve(static_cast(desc.dims().size())); - std::copy(desc.dims().begin(), desc.dims().end(), std::back_inserter(dims)); - tensor->Resize(framework::make_ddim(dims)); - void *buf; - - framework::VisitDataType(desc.data_type(), - DeserializedDataFunctor(&buf, tensor)); - is.read(static_cast(buf), tensor->memory_size()); - } -} - -} // namespace framework + namespace framework { + + void TensorCopy(const Tensor &src, Tensor *dst) { + // VLOG(3) << "TensorCopy " << src.dims() << " from " << + // src.place() << " to + // " + // << dst_place; + src.check_memory_size(); + + dst->Resize(src.dims()); + dst->set_layout(src.layout()); + auto src_ptr = src.data(); + + auto dst_ptr = dst->mutable_data(src.type()); + + auto size = src.numel() * SizeOfType(src.type()); + + memory::Copy(dst_ptr, src_ptr, size); + } + + void TensorCopySync(const Tensor &src, Tensor *dst) { + // VLOG(3) << "TensorCopySync " << src.dims() << " from " << + // src.place() + // << " to " << dst_place; + src.check_memory_size(); + dst->Resize(src.dims()); + dst->set_layout(src.layout()); + auto src_ptr = src.data(); + auto dst_ptr = dst->mutable_data(src.type()); + auto size = src.numel() * SizeOfType(src.type()); + memory::Copy(dst_ptr, src_ptr, size); + } + + template struct AnyDTypeVisitor { + Predicate predicate_; + const Tensor &tensor_; + Tensor *out_; + + AnyDTypeVisitor(Predicate predicate, const Tensor &tensor, + Tensor *out) + : predicate_(predicate), tensor_(tensor), out_(out) {} + + template void operator()() const { + // auto t = EigenVector::Flatten(tensor_); + // auto o = EigenScalar::From(*out_); + // return any of predicate_(t) is true. + // o.device(*ctx_.eigen_device()) = predicate_(t).any(); + } + }; + + template + inline void AnyImpl(Predicate predicate, const Tensor &tensor, + framework::Tensor *out) { + VisitDataType(ToDataType(tensor.type()), + AnyDTypeVisitor(predicate, tensor, out)); + } + + template struct AnyVisitor { + const framework::Tensor &tensor_; + Predicate predicate_; + + AnyVisitor(const framework::Tensor &tensor, Predicate predicate) + : tensor_(tensor), predicate_(std::move(predicate)) {} + + bool operator()(void) const { + framework::Tensor out; + out.Resize({1}); + out.mutable_data(); + AnyImpl(predicate_, tensor_, &out); + return this->GetResult(out); + } + + bool GetResult(const framework::Tensor &out) const { + return *out.data(); + } + }; + + template + inline bool Any(const framework::Tensor &tensor, Predicate predicate) { + AnyVisitor visitor(tensor, predicate); + // return platform::VisitPlace(visitor); + return visitor(); + } + + struct ContainsNANPredicate { + template + auto operator()(const T &eigen_vec) const + -> decltype(std::declval().isnan()) { + // Cast eigen_vector to vector of bool. true if is inf. + return eigen_vec.isnan(); + } + }; + + bool TensorContainsNAN(const framework::Tensor &tensor) { + ContainsNANPredicate predicate; + return Any(tensor, predicate); + } + + struct ContainsInfPredicate { + template + auto operator()(const T &eigen_vec) const + -> decltype(std::declval().isinf()) { + // Cast eigen_vector to vector of bool. true if is inf. + return eigen_vec.isinf(); + } + }; + + bool TensorContainsInf(const framework::Tensor &tensor) { + ContainsInfPredicate predicate; + return Any(tensor, predicate); + } + + void TensorToStream(std::ostream &os, const Tensor &tensor) { + { // the 1st field, uint32_t version + constexpr uint32_t version = 0; + os.write(reinterpret_cast(&version), + sizeof(version)); + } + { // the 2nd field, tensor description + // int32_t size + // void* protobuf message + proto::VarType::TensorDesc desc; + desc.set_data_type(framework::ToDataType(tensor.type())); + auto dims = framework::vectorize(tensor.dims()); + auto *pb_dims = desc.mutable_dims(); + pb_dims->Resize(static_cast(dims.size()), 0); + std::copy(dims.begin(), dims.end(), pb_dims->begin()); + int32_t size = desc.ByteSize(); + os.write(reinterpret_cast(&size), sizeof(size)); + auto out = desc.SerializeAsString(); + os.write(out.data(), size); + } + { // the 3rd field, tensor data + uint64_t size = tensor.memory_size(); + auto *data_ptr = tensor.data(); + // PADDLE_ENFORCE(size < + // std::numeric_limits::max(), + // "Index overflow when writing tensor"); + + os.write(static_cast(data_ptr), + static_cast(size)); + } + } + + struct DeserializedDataFunctor { + DeserializedDataFunctor(void **buf, Tensor *tensor) + : buf_(buf), tensor_(tensor) {} + + template void operator()() { + *buf_ = tensor_->mutable_data(); + } + + void **buf_; + Tensor *tensor_; + }; + + void TensorFromStream(std::istream &is, framework::Tensor *tensor) { + uint32_t version; + is.read(reinterpret_cast(&version), sizeof(version)); + // PADDLE_ENFORCE_EQ(version, 0U, "Only version 0 is supported"); + proto::VarType::TensorDesc desc; + { // int32_t size + // proto buffer + int32_t size; + is.read(reinterpret_cast(&size), sizeof(size)); + std::unique_ptr buf(new char[size]); + is.read(reinterpret_cast(buf.get()), size); + // PADDLE_ENFORCE(desc.ParseFromArray(buf.get(), size), + // "Cannot parse tensor desc"); + } + { // read tensor + std::vector dims; + dims.reserve(static_cast(desc.dims().size())); + std::copy(desc.dims().begin(), desc.dims().end(), + std::back_inserter(dims)); + tensor->Resize(framework::make_ddim(dims)); + void *buf; + + framework::VisitDataType(desc.data_type(), + DeserializedDataFunctor(&buf, tensor)); + is.read(static_cast(buf), tensor->memory_size()); + } + } + + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/tensor_util.h b/src/framework/tensor_util.h index 2d91febf6129e94a29801ddd5df031329e604f68..c6e04d6244191955873163db45463bdbe63f7a45 100644 --- a/src/framework/tensor_util.h +++ b/src/framework/tensor_util.h @@ -20,47 +20,47 @@ limitations under the License. */ #include namespace paddle_mobile { -namespace framework { + namespace framework { -void TensorCopy(const Tensor &src, Tensor *dst); -void TensorCopySync(const Tensor &src, Tensor *dst); + void TensorCopy(const Tensor &src, Tensor *dst); + void TensorCopySync(const Tensor &src, Tensor *dst); -template -void TensorFromVector(const std::vector &src, Tensor *dst); + template + void TensorFromVector(const std::vector &src, Tensor *dst); -template -void TesnorToVector(const Tensor &src, std::vector *dst); + template + void TesnorToVector(const Tensor &src, std::vector *dst); -bool TensorContainsNAN(const framework::Tensor &tensor); -bool TensorContainsInf(const framework::Tensor &tensor); + bool TensorContainsNAN(const framework::Tensor &tensor); + bool TensorContainsInf(const framework::Tensor &tensor); -void TensorToStream(std::ostream &os, const Tensor &tensor); -void TensorFromStream(std::istream &is, Tensor *tensor); + void TensorToStream(std::ostream &os, const Tensor &tensor); + void TensorFromStream(std::istream &is, Tensor *tensor); -// -// The implementation of template functions. -// + // + // The implementation of template functions. + // -template -void TensorFromVector(const std::vector &src, Tensor *dst) { - auto src_ptr = static_cast(src.data()); - dst->Resize({static_cast(src.size())}); - auto dst_ptr = static_cast(dst->mutable_data()); - auto size = src.size() * sizeof(T); + template + void TensorFromVector(const std::vector &src, Tensor *dst) { + auto src_ptr = static_cast(src.data()); + dst->Resize({static_cast(src.size())}); + auto dst_ptr = static_cast(dst->mutable_data()); + auto size = src.size() * sizeof(T); - memory::Copy(dst_ptr, src_ptr, size); -} + memory::Copy(dst_ptr, src_ptr, size); + } -template -void TensorToVector(const Tensor &src, std::vector *dst) { - auto src_ptr = static_cast(src.data()); - auto size = src.numel() * sizeof(T); + template + void TensorToVector(const Tensor &src, std::vector *dst) { + auto src_ptr = static_cast(src.data()); + auto size = src.numel() * sizeof(T); - dst->resize(src.numel()); - auto dst_ptr = static_cast(dst->data()); + dst->resize(src.numel()); + auto dst_ptr = static_cast(dst->data()); - memory::Copy(dst_ptr, src_ptr, size); -} + memory::Copy(dst_ptr, src_ptr, size); + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/var_desc.cpp b/src/framework/var_desc.cpp index 4e2fa2be2b2baa009d16c03e699273a973d081b0..345f05e89fd3fa370137f290ff1cd33f4198739e 100644 --- a/src/framework/var_desc.cpp +++ b/src/framework/var_desc.cpp @@ -20,9 +20,9 @@ SOFTWARE. namespace paddle_mobile { -namespace framework { + namespace framework { -VarDesc::VarDesc(const proto::VarDesc &desc) : desc_(desc) {} + VarDesc::VarDesc(const proto::VarDesc &desc) : desc_(desc) {} -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/var_desc.h b/src/framework/var_desc.h index 6852966a878c5be81de406b77b147f32d53de570..4a1c72a1add7fa4a13fbe2a2d2af6c900ba30b20 100644 --- a/src/framework/var_desc.h +++ b/src/framework/var_desc.h @@ -22,67 +22,68 @@ SOFTWARE. #include "paddle_mobile_object.h" namespace paddle_mobile { -namespace framework { + namespace framework { -class VarDesc { -public: - VarDesc(const proto::VarDesc &desc); + class VarDesc { + public: + VarDesc(const proto::VarDesc &desc); - std::string Name() const { return desc_.name(); } + std::string Name() const { return desc_.name(); } - proto::VarType::Type GetType() const { return desc_.type().type(); } + proto::VarType::Type GetType() const { return desc_.type().type(); } - bool Persistable() const { return desc_.persistable(); } + bool Persistable() const { return desc_.persistable(); } - const proto::VarType::ChannelDesc &channel_desc() const { - switch (desc_.type().type()) { - case proto::VarType::CHANNEL: - return desc_.type().channel(); - default: - break; - } - } + const proto::VarType::ChannelDesc &channel_desc() const { + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + return desc_.type().channel(); + default: + break; + } + } - const proto::VarType::TensorDesc &tensor_desc() const { - switch (desc_.type().type()) { - case proto::VarType::SELECTED_ROWS: - return desc_.type().selected_rows(); - case proto::VarType::LOD_TENSOR: - return desc_.type().lod_tensor().tensor(); - case proto::VarType::LOD_TENSOR_ARRAY: - return desc_.type().tensor_array().tensor(); - default: - break; - } - } + const proto::VarType::TensorDesc &tensor_desc() const { + switch (desc_.type().type()) { + case proto::VarType::SELECTED_ROWS: + return desc_.type().selected_rows(); + case proto::VarType::LOD_TENSOR: + return desc_.type().lod_tensor().tensor(); + case proto::VarType::LOD_TENSOR_ARRAY: + return desc_.type().tensor_array().tensor(); + default: + break; + } + } - proto::VarType::Type GetDataType() const { - switch (desc_.type().type()) { - case proto::VarType::CHANNEL: - return channel_desc().data_type(); - break; - default: - return tensor_desc().data_type(); - } - } + proto::VarType::Type GetDataType() const { + switch (desc_.type().type()) { + case proto::VarType::CHANNEL: + return channel_desc().data_type(); + break; + default: + return tensor_desc().data_type(); + } + } - template - std::vector RepeatedToVector( - const google::protobuf::RepeatedField &repeated_field) const { - std::vector ret; - ret.reserve(repeated_field.size()); - std::copy(repeated_field.begin(), repeated_field.end(), - std::back_inserter(ret)); - return ret; - } + template + std::vector RepeatedToVector( + const google::protobuf::RepeatedField &repeated_field) + const { + std::vector ret; + ret.reserve(repeated_field.size()); + std::copy(repeated_field.begin(), repeated_field.end(), + std::back_inserter(ret)); + return ret; + } - std::vector GetShape() const { - return this->RepeatedToVector(tensor_desc().dims()); - } + std::vector GetShape() const { + return this->RepeatedToVector(tensor_desc().dims()); + } -private: - proto::VarDesc desc_; -}; + private: + proto::VarDesc desc_; + }; -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/var_type.h b/src/framework/var_type.h index bfe43a11f7a43c7966ebd5564ac2ee1a9ecea6b3..f408f8050709c58d67550afb5c7f4a60f2e898e3 100644 --- a/src/framework/var_type.h +++ b/src/framework/var_type.h @@ -23,16 +23,17 @@ SOFTWARE. #include "variable.h" namespace paddle_mobile { -namespace framework { -inline proto::VarType::Type ToVarType(std::type_index type) { - if (type.hash_code() == typeid(LoDTensor).hash_code()) { - return proto::VarType_Type_LOD_TENSOR; - } else if (type.hash_code() == typeid(SelectedRows).hash_code()) { - return proto::VarType_Type_SELECTED_ROWS; - } else { - // PADDLE_THROW("ToVarType:Unsupported type %s", type.name()); - } -} + namespace framework { + inline proto::VarType::Type ToVarType(std::type_index type) { + if (type.hash_code() == typeid(LoDTensor).hash_code()) { + return proto::VarType_Type_LOD_TENSOR; + } else if (type.hash_code() == typeid(SelectedRows).hash_code()) { + return proto::VarType_Type_SELECTED_ROWS; + } else { + // PADDLE_THROW("ToVarType:Unsupported type %s", + // type.name()); + } + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/variable.h b/src/framework/variable.h index d30429d4c5c88a58188a23bddc95de8795f02479..55b1bb0449fb07728a23de325967822e94100275 100644 --- a/src/framework/variable.h +++ b/src/framework/variable.h @@ -26,72 +26,74 @@ SOFTWARE. #include namespace paddle_mobile { -namespace framework { -class Variable : public PaddleMobileObject { -public: - Variable() {} - ~Variable() {} - - template const T *Get() const { - return static_cast(holder_->Ptr()); - } - - bool IsInitialized() const { return holder_ != nullptr; } - - const std::string *Name() { return name_; } - - template T *GetMutable() { - if (!IsType()) { - if (*Name() == "pixel") { - // std::cout << " reset " << *Name() << std::endl; - } - holder_.reset(new PlaceholderImp(new T())); - } - return static_cast(holder_->Ptr()); - } - - template bool IsType() const { - if (holder_) { - // printf("not null \n"); - printf(" holder type : %s, this type %s \n", holder_->Type().name(), - typeid(T).name()); - } - - // std::cout << " " << holder_->Type() << " " << typeid(T) << - // std::endl; - return holder_ != nullptr && holder_->Type() == typeid(T); - } - - void Clear() { holder_.reset(); } - - std::type_index Type() const { return holder_->Type(); } - - void SetName(const std::string *name) { name_ = name; } - -private: - struct Placeholder { - Placeholder() = default; - virtual ~Placeholder() = default; - - virtual const std::type_info &Type() const = 0; - virtual void *Ptr() const = 0; - }; - - template struct PlaceholderImp : public Placeholder { - explicit PlaceholderImp(T *ptr) : ptr_(ptr), type_(typeid(T)) {} - - virtual const std::type_info &Type() const { return type_; } - virtual void *Ptr() const override { - return static_cast(ptr_.get()); - } - - std::unique_ptr ptr_; - const std::type_info &type_; - }; - - std::unique_ptr holder_; - friend class Scope; - const std::string *name_; -}; -} // namespace framework + namespace framework { + class Variable : public PaddleMobileObject { + public: + Variable() {} + ~Variable() {} + + template const T *Get() const { + return static_cast(holder_->Ptr()); + } + + bool IsInitialized() const { return holder_ != nullptr; } + + const std::string *Name() { return name_; } + + template T *GetMutable() { + if (!IsType()) { + if (*Name() == "pixel") { + // std::cout << " reset " << *Name() << + // std::endl; + } + holder_.reset(new PlaceholderImp(new T())); + } + return static_cast(holder_->Ptr()); + } + + template bool IsType() const { + if (holder_) { + // printf("not null \n"); + printf(" holder type : %s, this type %s \n", + holder_->Type().name(), typeid(T).name()); + } + + // std::cout << " " << holder_->Type() << " " << + // typeid(T) << + // std::endl; + return holder_ != nullptr && holder_->Type() == typeid(T); + } + + void Clear() { holder_.reset(); } + + std::type_index Type() const { return holder_->Type(); } + + void SetName(const std::string *name) { name_ = name; } + + private: + struct Placeholder { + Placeholder() = default; + virtual ~Placeholder() = default; + + virtual const std::type_info &Type() const = 0; + virtual void *Ptr() const = 0; + }; + + template struct PlaceholderImp : public Placeholder { + explicit PlaceholderImp(T *ptr) : ptr_(ptr), type_(typeid(T)) {} + + virtual const std::type_info &Type() const { return type_; } + virtual void *Ptr() const override { + return static_cast(ptr_.get()); + } + + std::unique_ptr ptr_; + const std::type_info &type_; + }; + + std::unique_ptr holder_; + friend class Scope; + const std::string *name_; + }; + } // namespace framework } // namespace paddle_mobile diff --git a/src/io.cpp b/src/io.cpp index 5fb7d8b30afa029b1d0779296ed7cbd8e1e00de1..eca67b6f19c2fded2d7835ab66c7f425dc6850a1 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -28,357 +28,403 @@ SOFTWARE. namespace paddle_mobile { -void ReadBinaryFile(const std::string &filename, std::string *contents) { - std::ifstream fin(filename, std::ios::in | std::ios::binary); - fin.seekg(0, std::ios::end); - contents->clear(); - contents->resize(fin.tellg()); - fin.seekg(0, std::ios::beg); - fin.read(&(contents->at(0)), contents->size()); - fin.close(); -} - -template -void Loader::LoadVar(framework::LoDTensor *tensor, - const std::string &file_path) { - // std::cout << " to load " << file_path << std::endl; - - std::ifstream is(file_path); - - std::streampos pos = is.tellg(); // save current position - is.seekg(0, std::ios::end); - // std::cout << " file length = " << is.tellg() << std::endl; - is.seekg(pos); // restore saved position - - // 1. version - uint32_t version; - is.read(reinterpret_cast(&version), sizeof(version)); - // std::cout << " version: " << version << std::endl; - - // 2 Lod information - uint64_t lod_level; - is.read(reinterpret_cast(&lod_level), sizeof(lod_level)); - // std::cout << " load level: " << lod_level << std::endl; - // std::cout << " lod info: " << std::endl; - auto &lod = *tensor->mutable_lod(); - lod.resize(lod_level); - for (uint64_t i = 0; i < lod_level; ++i) { - uint64_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - std::vector tmp(size / sizeof(size_t)); - is.read(reinterpret_cast(tmp.data()), - static_cast(size)); - for (int j = 0; j < tmp.size(); ++j) { - // std::cout << " lod - " << tmp[j] << std::endl; - } - lod[i] = tmp; - } - - // 3. tensor version - uint32_t tensor_version; - is.read(reinterpret_cast(&tensor_version), sizeof(tensor_version)); - // std::cout << " tensor_version: " << tensor_version << std::endl; - - // 4. tensor desc - int32_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - // std::cout << " tensor desc size: " << size << std::endl; - std::unique_ptr buf(new char[size]); - is.read(reinterpret_cast(buf.get()), size); - - framework::proto::VarType::TensorDesc desc; - desc.ParseFromArray(buf.get(), size); - - // std::cout << " desc dims size " << desc.dims().size() << std::endl; - int memory_size = 1; - for (int l = 0; l < desc.dims().size(); ++l) { - // std::cout << " dim " << l << " value: " << desc.dims()[l] << - // std::endl; - memory_size *= desc.dims()[l]; - } - - std::vector dims; - dims.reserve(static_cast(desc.dims().size())); - std::copy(desc.dims().begin(), desc.dims().end(), std::back_inserter(dims)); - tensor->Resize(framework::make_ddim(dims)); - - void *memory; - int type_size = 0; - // std::cout << " desc pre type: "; - switch (desc.data_type()) { - case framework::proto::VarType::FP16: - // std::cout << "FP16" << std::endl; - type_size = 2; - break; - case framework::proto::VarType::FP32: - type_size = 4; - memory = tensor->mutable_data(); - // std::cout << "FP32" << std::endl; - break; - case framework::proto::VarType::FP64: - type_size = 8; - // std::cout << "FP64" << std::endl; - break; - case framework::proto::VarType::INT32: - type_size = 4; - // std::cout << "INT32" << std::endl; - break; - case framework::proto::VarType::INT64: - type_size = 8; - // std::cout << "INT64" << std::endl; - break; - case framework::proto::VarType::BOOL: - type_size = 1; - // std::cout << "BOOL" << std::endl; - break; - default: - break; - // std::cout << " not support" << std::endl; - } - - // std::cout << " malloc size: " << memory_size * type_size << std::endl; - is.read(static_cast(memory), memory_size * type_size); - // std::cout << " memory: " << memory << std::endl; - is.close(); -}; - -template -const framework::Program -Loader::Load(const std::string &dirname) { - std::string model_filename = dirname + "/__model__"; - std::string program_desc_str; - ReadBinaryFile(model_filename, &program_desc_str); - framework::proto::ProgramDesc program_desc_proto; - program_desc_proto.ParseFromString(program_desc_str); - - std::shared_ptr originProgramDesc = - std::make_shared(program_desc_proto); - - framework::Program program; - program.originProgram = originProgramDesc; - - std::shared_ptr scope = - std::make_shared(); - program.scope = scope; - - auto block = originProgramDesc->Block(0); - - for (auto block : originProgramDesc->Blocks()) { - // std::cout << "for block" << std::endl; - for (int i = 0; i < block->Vars().size(); ++i) { - std::shared_ptr var_desc = block->Vars()[i]; - auto var = scope->Var(var_desc->Name()); - if (var_desc->GetType() == framework::proto::VarType::LOD_TENSOR) { - if (var_desc->Persistable() && - var_desc->GetType() != framework::proto::VarType::FEED_MINIBATCH && - var_desc->GetType() != framework::proto::VarType::FETCH_LIST) { - framework::LoDTensor *tensor = - var->GetMutable(); - // to load - LoadVar(tensor, dirname + "/" + var_desc->Name()); - } - } else { - // std::cout << "非 lod" << std::endl; - } - } - } - -#ifdef PADDLE_MOBILE_DEBUG - for (int i = 0; i < program_desc_proto.blocks().size(); ++i) { - framework::proto::BlockDesc block = program_desc_proto.blocks()[i]; - // std::cout << "block: " << block.idx() << std::endl; - for (int j = 0; j < block.ops().size(); ++j) { - framework::proto::OpDesc op = block.ops()[j]; - - // std::cout << " op: " << op.type() << std::endl; - for (int m = 0; m < op.inputs_size(); ++m) { - const framework::proto::OpDesc::Var &var = op.inputs(m); - // std::cout << " input parameter: " << var.parameter() << - // std::endl; - for (int n = 0; n < var.arguments().size(); ++n) { - // std::cout << " argument - " << var.arguments()[n] << - // std::endl; - } - } - - for (int y = 0; y < op.outputs_size(); ++y) { - const framework::proto::OpDesc::Var &var = op.outputs(y); - // std::cout << " output parameter: " << var.parameter() << - // std::endl; - for (int z = 0; z < var.arguments().size(); ++z) { - // std::cout << " argument - " << var.arguments()[z] << - // std::endl; - } - } - - for (int x = 0; x < op.attrs().size(); ++x) { - const framework::proto::OpDesc_Attr attr = op.attrs()[x]; - // std::cout << " attr name: " << attr.name() << std::endl; - // std::cout << " attr type: " << attr.type() << std::endl; - - switch (attr.type()) { - case framework::proto::AttrType::BOOLEAN: - // std::cout << " boolen: " << attr.b() << std::endl; - break; - case framework::proto::AttrType::INT: - // std::cout << " int: " << attr.i() << std::endl; - break; - case framework::proto::AttrType::FLOAT: - // std::cout << " float: " << attr.f() << std::endl; - case framework::proto::AttrType::STRING: - // std::cout << " string: " << attr.s() << std::endl; - case framework::proto::AttrType::BOOLEANS: - // std::vector - // bools(attr.bools_size()); - for (int y = 0; y < attr.bools_size(); ++y) { - // std::cout << " bool - " << attr.bools(y) << - // std::endl; - } - case framework::proto::AttrType::LONG: - // std::cout << " long: " << attr.l() << std::endl; - case framework::proto::AttrType::FLOATS: - for (int y = 0; y < attr.floats_size(); ++y) { - // std::cout << " float - " << y << ": " << - // attr.floats(y) - // << std::endl; - } - case framework::proto::AttrType::INTS: - for (int y = 0; y < attr.ints_size(); ++y) { - // std::cout << " int - " << y << ": " << - // attr.ints(y) - // << std::endl; - } - case framework::proto::AttrType::STRINGS: - for (int y = 0; y < attr.strings_size(); ++y) { - // std::cout << " string - " << y << ": " << - // attr.strings(y) - // << std::endl; - } - } - } + void ReadBinaryFile(const std::string &filename, std::string *contents) { + std::ifstream fin(filename, std::ios::in | std::ios::binary); + fin.seekg(0, std::ios::end); + contents->clear(); + contents->resize(fin.tellg()); + fin.seekg(0, std::ios::beg); + fin.read(&(contents->at(0)), contents->size()); + fin.close(); } - for (int k = 0; k < block.vars().size(); ++k) { - framework::proto::VarDesc var = block.vars()[k]; - if (var.type().type() == framework::proto::VarType::LOD_TENSOR) { - // std::cout << " var name: " << var.name() << std::endl; - const framework::proto::VarType::TensorDesc &tensor_desc = - var.type().lod_tensor().tensor(); - // std::cout << " in var tensor desc dims size " - // << tensor_desc.dims().size() << std::endl; - int memory_size = 1; - for (int l = 0; l < tensor_desc.dims().size(); ++l) { - // std::cout << " var tensor desc dim " << l - // << " value: " << tensor_desc.dims()[l] << - // std::endl; - } - } + template + void Loader::LoadVar(framework::LoDTensor *tensor, + const std::string &file_path) { + // std::cout << " to load " << file_path << std::endl; - if (var.persistable() && - var.type().type() != framework::proto::VarType::FEED_MINIBATCH && - var.type().type() != framework::proto::VarType::FETCH_LIST) { - // std::cout << " to load " << var.name() << std::endl; - std::string file_path = dirname + "/" + var.name(); std::ifstream is(file_path); + std::streampos pos = is.tellg(); // save current position is.seekg(0, std::ios::end); - // std::cout << " file length = " << is.tellg() << std::endl; + // std::cout << " file length = " << is.tellg() << std::endl; is.seekg(pos); // restore saved position // 1. version uint32_t version; is.read(reinterpret_cast(&version), sizeof(version)); - // std::cout << " version: " << version << std::endl; + // std::cout << " version: " << version << std::endl; // 2 Lod information uint64_t lod_level; is.read(reinterpret_cast(&lod_level), sizeof(lod_level)); - // std::cout << " load level: " << lod_level << std::endl; - // std::cout << " lod info: " << std::endl; + // std::cout << " load level: " << lod_level << std::endl; + // std::cout << " lod info: " << std::endl; + auto &lod = *tensor->mutable_lod(); + lod.resize(lod_level); for (uint64_t i = 0; i < lod_level; ++i) { - uint64_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - std::vector tmp(size / sizeof(size_t)); - is.read(reinterpret_cast(tmp.data()), - static_cast(size)); - for (int j = 0; j < tmp.size(); ++j) { - // std::cout << " lod - " << tmp[j] << std::endl; - } + uint64_t size; + is.read(reinterpret_cast(&size), sizeof(size)); + std::vector tmp(size / sizeof(size_t)); + is.read(reinterpret_cast(tmp.data()), + static_cast(size)); + for (int j = 0; j < tmp.size(); ++j) { + // std::cout << " lod - " << tmp[j] << std::endl; + } + lod[i] = tmp; } + // 3. tensor version uint32_t tensor_version; - is.read(reinterpret_cast(&version), sizeof(version)); - // std::cout << " tensor_version: " << tensor_version << - // std::endl; + is.read(reinterpret_cast(&tensor_version), + sizeof(tensor_version)); + // std::cout << " tensor_version: " << tensor_version << std::endl; + // 4. tensor desc int32_t size; is.read(reinterpret_cast(&size), sizeof(size)); - // std::cout << " tensor desc size: " << size << std::endl; + // std::cout << " tensor desc size: " << size << std::endl; std::unique_ptr buf(new char[size]); is.read(reinterpret_cast(buf.get()), size); framework::proto::VarType::TensorDesc desc; desc.ParseFromArray(buf.get(), size); - // std::cout << " desc dims size " << desc.dims().size() << - // std::endl; + // std::cout << " desc dims size " << desc.dims().size() << + // std::endl; int memory_size = 1; for (int l = 0; l < desc.dims().size(); ++l) { - // std::cout << " dim " << l << " value: " << - // desc.dims()[l] - // << std::endl; - memory_size *= desc.dims()[l]; + // std::cout << " dim " << l << " value: " << desc.dims()[l] + // << + // std::endl; + memory_size *= desc.dims()[l]; } + std::vector dims; + dims.reserve(static_cast(desc.dims().size())); + std::copy(desc.dims().begin(), desc.dims().end(), + std::back_inserter(dims)); + tensor->Resize(framework::make_ddim(dims)); + + void *memory; int type_size = 0; - // std::cout << " desc pre type: "; + // std::cout << " desc pre type: "; switch (desc.data_type()) { case framework::proto::VarType::FP16: - // std::cout << "FP16" << std::endl; - type_size = 2; - break; + // std::cout << "FP16" << std::endl; + type_size = 2; + break; case framework::proto::VarType::FP32: - type_size = 4; - // std::cout << "FP32" << std::endl; - break; + type_size = 4; + memory = tensor->mutable_data(); + // std::cout << "FP32" << std::endl; + break; case framework::proto::VarType::FP64: - type_size = 8; - // std::cout << "FP64" << std::endl; - break; + type_size = 8; + // std::cout << "FP64" << std::endl; + break; case framework::proto::VarType::INT32: - type_size = 4; - // std::cout << "INT32" << std::endl; - break; + type_size = 4; + // std::cout << "INT32" << std::endl; + break; case framework::proto::VarType::INT64: - type_size = 8; - // std::cout << "INT64" << std::endl; - break; + type_size = 8; + // std::cout << "INT64" << std::endl; + break; case framework::proto::VarType::BOOL: - type_size = 1; - // std::cout << "BOOL" << std::endl; - break; + type_size = 1; + // std::cout << "BOOL" << std::endl; + break; default: - break; - // std::cout << " not support" << std::endl; + break; + // std::cout << " not support" << std::endl; } - // std::cout << " malloc size: " << memory_size * type_size - // << std::endl; - void *memory = malloc(memory_size * type_size); + // std::cout << " malloc size: " << memory_size * type_size << + // std::endl; is.read(static_cast(memory), memory_size * type_size); - // std::cout << " memory: " << memory << std::endl; + // std::cout << " memory: " << memory << std::endl; is.close(); - } else { - // std::cout << " *not load " - // << " var : " << var.name() << std::endl; - } - } - } + }; + + template + const framework::Program + Loader::Load(const std::string &dirname) { + std::string model_filename = dirname + "/__model__"; + std::string program_desc_str; + ReadBinaryFile(model_filename, &program_desc_str); + framework::proto::ProgramDesc program_desc_proto; + program_desc_proto.ParseFromString(program_desc_str); + + std::shared_ptr originProgramDesc = + std::make_shared(program_desc_proto); + + framework::Program program; + program.originProgram = originProgramDesc; + + std::shared_ptr scope = + std::make_shared(); + program.scope = scope; + + auto block = originProgramDesc->Block(0); + + for (auto block : originProgramDesc->Blocks()) { + // std::cout << "for block" << std::endl; + for (int i = 0; i < block->Vars().size(); ++i) { + std::shared_ptr var_desc = block->Vars()[i]; + auto var = scope->Var(var_desc->Name()); + if (var_desc->GetType() == + framework::proto::VarType::LOD_TENSOR) { + if (var_desc->Persistable() && + var_desc->GetType() != + framework::proto::VarType::FEED_MINIBATCH && + var_desc->GetType() != + framework::proto::VarType::FETCH_LIST) { + framework::LoDTensor *tensor = + var->GetMutable(); + // to load + LoadVar(tensor, dirname + "/" + var_desc->Name()); + } + } else { + // std::cout << "非 lod" << std::endl; + } + } + } + +#ifdef PADDLE_MOBILE_DEBUG + for (int i = 0; i < program_desc_proto.blocks().size(); ++i) { + framework::proto::BlockDesc block = program_desc_proto.blocks()[i]; + // std::cout << "block: " << block.idx() << std::endl; + for (int j = 0; j < block.ops().size(); ++j) { + framework::proto::OpDesc op = block.ops()[j]; + + // std::cout << " op: " << op.type() << std::endl; + for (int m = 0; m < op.inputs_size(); ++m) { + const framework::proto::OpDesc::Var &var = op.inputs(m); + // std::cout << " input parameter: " << + // var.parameter() << + // std::endl; + for (int n = 0; n < var.arguments().size(); ++n) { + // std::cout << " argument - " << + // var.arguments()[n] << + // std::endl; + } + } + + for (int y = 0; y < op.outputs_size(); ++y) { + const framework::proto::OpDesc::Var &var = op.outputs(y); + // std::cout << " output parameter: " << + // var.parameter() << + // std::endl; + for (int z = 0; z < var.arguments().size(); ++z) { + // std::cout << " argument - " << + // var.arguments()[z] << + // std::endl; + } + } + + for (int x = 0; x < op.attrs().size(); ++x) { + const framework::proto::OpDesc_Attr attr = op.attrs()[x]; + // std::cout << " attr name: " << attr.name() << + // std::endl; + // std::cout << " attr type: " << attr.type() << + // std::endl; + + switch (attr.type()) { + case framework::proto::AttrType::BOOLEAN: + // std::cout << " boolen: " << attr.b() << + // std::endl; + break; + case framework::proto::AttrType::INT: + // std::cout << " int: " << attr.i() << + // std::endl; + break; + case framework::proto::AttrType::FLOAT: + // std::cout << " float: " << attr.f() << + // std::endl; + case framework::proto::AttrType::STRING: + // std::cout << " string: " << attr.s() << + // std::endl; + case framework::proto::AttrType::BOOLEANS: + // std::vector + // bools(attr.bools_size()); + for (int y = 0; y < attr.bools_size(); ++y) { + // std::cout << " bool - " << + // attr.bools(y) << + // std::endl; + } + case framework::proto::AttrType::LONG: + // std::cout << " long: " << attr.l() << + // std::endl; + case framework::proto::AttrType::FLOATS: + for (int y = 0; y < attr.floats_size(); ++y) { + // std::cout << " float - " << y << + // ": " << + // attr.floats(y) + // << std::endl; + } + case framework::proto::AttrType::INTS: + for (int y = 0; y < attr.ints_size(); ++y) { + // std::cout << " int - " << y << ": + // " << + // attr.ints(y) + // << std::endl; + } + case framework::proto::AttrType::STRINGS: + for (int y = 0; y < attr.strings_size(); ++y) { + // std::cout << " string - " << y << + // ": " << + // attr.strings(y) + // << std::endl; + } + } + } + } + + for (int k = 0; k < block.vars().size(); ++k) { + framework::proto::VarDesc var = block.vars()[k]; + if (var.type().type() == + framework::proto::VarType::LOD_TENSOR) { + // std::cout << " var name: " << var.name() << + // std::endl; + const framework::proto::VarType::TensorDesc &tensor_desc = + var.type().lod_tensor().tensor(); + // std::cout << " in var tensor desc dims size " + // << tensor_desc.dims().size() << + // std::endl; + int memory_size = 1; + for (int l = 0; l < tensor_desc.dims().size(); ++l) { + // std::cout << " var tensor desc dim " << l + // << " value: " << + // tensor_desc.dims()[l] << + // std::endl; + } + } + + if (var.persistable() && + var.type().type() != + framework::proto::VarType::FEED_MINIBATCH && + var.type().type() != + framework::proto::VarType::FETCH_LIST) { + // std::cout << " to load " << var.name() << + // std::endl; + std::string file_path = dirname + "/" + var.name(); + std::ifstream is(file_path); + std::streampos pos = + is.tellg(); // save current position + is.seekg(0, std::ios::end); + // std::cout << " file length = " << is.tellg() << + // std::endl; + is.seekg(pos); // restore saved position + + // 1. version + uint32_t version; + is.read(reinterpret_cast(&version), + sizeof(version)); + // std::cout << " version: " << version << + // std::endl; + + // 2 Lod information + uint64_t lod_level; + is.read(reinterpret_cast(&lod_level), + sizeof(lod_level)); + // std::cout << " load level: " << lod_level << + // std::endl; + // std::cout << " lod info: " << std::endl; + for (uint64_t i = 0; i < lod_level; ++i) { + uint64_t size; + is.read(reinterpret_cast(&size), sizeof(size)); + std::vector tmp(size / sizeof(size_t)); + is.read(reinterpret_cast(tmp.data()), + static_cast(size)); + for (int j = 0; j < tmp.size(); ++j) { + // std::cout << " lod - " << tmp[j] << + // std::endl; + } + } + + uint32_t tensor_version; + is.read(reinterpret_cast(&version), + sizeof(version)); + // std::cout << " tensor_version: " << + // tensor_version << + // std::endl; + + int32_t size; + is.read(reinterpret_cast(&size), sizeof(size)); + // std::cout << " tensor desc size: " << size << + // std::endl; + std::unique_ptr buf(new char[size]); + is.read(reinterpret_cast(buf.get()), size); + + framework::proto::VarType::TensorDesc desc; + desc.ParseFromArray(buf.get(), size); + + // std::cout << " desc dims size " << + // desc.dims().size() << + // std::endl; + int memory_size = 1; + for (int l = 0; l < desc.dims().size(); ++l) { + // std::cout << " dim " << l << " value: " + // << + // desc.dims()[l] + // << std::endl; + memory_size *= desc.dims()[l]; + } + + int type_size = 0; + // std::cout << " desc pre type: "; + switch (desc.data_type()) { + case framework::proto::VarType::FP16: + // std::cout << "FP16" << std::endl; + type_size = 2; + break; + case framework::proto::VarType::FP32: + type_size = 4; + // std::cout << "FP32" << std::endl; + break; + case framework::proto::VarType::FP64: + type_size = 8; + // std::cout << "FP64" << std::endl; + break; + case framework::proto::VarType::INT32: + type_size = 4; + // std::cout << "INT32" << std::endl; + break; + case framework::proto::VarType::INT64: + type_size = 8; + // std::cout << "INT64" << std::endl; + break; + case framework::proto::VarType::BOOL: + type_size = 1; + // std::cout << "BOOL" << std::endl; + break; + default: + break; + // std::cout << " not support" << + // std::endl; + } + + // std::cout << " malloc size: " << memory_size * + // type_size + // << std::endl; + void *memory = malloc(memory_size * type_size); + is.read(static_cast(memory), + memory_size * type_size); + // std::cout << " memory: " << memory << + // std::endl; + is.close(); + } else { + // std::cout << " *not load " + // << " var : " << var.name() << std::endl; + } + } + } #endif - return program; -} + return program; + } -template class Loader; + template class Loader; } // namespace paddle_mobile diff --git a/src/io.h b/src/io.h index 25837358c2f96f6214f5b3e15ea87a85452a5853..3fb2980a2c1d19ab7d2373b10282816d50429570 100644 --- a/src/io.h +++ b/src/io.h @@ -27,13 +27,14 @@ SOFTWARE. namespace paddle_mobile { -template -class Loader : PaddleMobileObject { -public: - const framework::Program Load(const std::string &dirname); + template + class Loader : PaddleMobileObject { + public: + const framework::Program Load(const std::string &dirname); -private: - void LoadVar(framework::LoDTensor *tensor, const std::string &file_path); -}; + private: + void LoadVar(framework::LoDTensor *tensor, + const std::string &file_path); + }; } // namespace paddle_mobile diff --git a/src/memory/t_malloc.cc b/src/memory/t_malloc.cc index 5b3086a8b04fe9f10e8151d5af781c24306de180..97dba64a9469bbf90f1e96f6da64a48d3be7b475 100644 --- a/src/memory/t_malloc.cc +++ b/src/memory/t_malloc.cc @@ -22,30 +22,30 @@ SOFTWARE. #include namespace paddle_mobile { -namespace memory { -const int MALLOC_ALIGN = 16; + namespace memory { + const int MALLOC_ALIGN = 16; -void Copy(void *dst, const void *src, size_t num) { - std::memcpy(dst, src, num); -}; + void Copy(void *dst, const void *src, size_t num) { + std::memcpy(dst, src, num); + }; -void *Alloc(size_t size) { - size_t offset = sizeof(void *) + MALLOC_ALIGN - 1; - char *p = static_cast(malloc(offset + size)); - if (!p) { - return nullptr; - } - void *r = reinterpret_cast(reinterpret_cast(p + offset) & - (~(MALLOC_ALIGN - 1))); - static_cast(r)[-1] = p; - return r; -} + void *Alloc(size_t size) { + size_t offset = sizeof(void *) + MALLOC_ALIGN - 1; + char *p = static_cast(malloc(offset + size)); + if (!p) { + return nullptr; + } + void *r = reinterpret_cast( + reinterpret_cast(p + offset) & (~(MALLOC_ALIGN - 1))); + static_cast(r)[-1] = p; + return r; + } -void Free(void *ptr) { - if (ptr) { - free(static_cast(ptr)[-1]); - } -} + void Free(void *ptr) { + if (ptr) { + free(static_cast(ptr)[-1]); + } + } -} // namespace memory + } // namespace memory } // namespace paddle_mobile diff --git a/src/memory/t_malloc.h b/src/memory/t_malloc.h index cd2e0e68358d1b592d63853d3d2bfe0ae3df5a0f..4a8297c662a8894ce350b5ab0291ad617deacef5 100644 --- a/src/memory/t_malloc.h +++ b/src/memory/t_malloc.h @@ -21,44 +21,44 @@ SOFTWARE. #include namespace paddle_mobile { -namespace memory { + namespace memory { -void Copy(void *dst, const void *src, size_t num); + void Copy(void *dst, const void *src, size_t num); -void *Alloc(size_t size); + void *Alloc(size_t size); -void Free(void *ptr); + void Free(void *ptr); -/** - * \brief Free memory block in one place. - * - * \note In some cases, custom deleter is used to - * deallocate the memory automatically for - * std::unique_ptr in tensor.h. - * static_cast - */ -template class PODDeleter { - static_assert(std::is_pod::value, "T must be POD"); + /** + * \brief Free memory block in one place. + * + * \note In some cases, custom deleter is used to + * deallocate the memory automatically for + * std::unique_ptr in tensor.h. + * static_cast + */ + template class PODDeleter { + static_assert(std::is_pod::value, "T must be POD"); -public: - explicit PODDeleter(){}; + public: + explicit PODDeleter(){}; - void operator()(T *ptr) { Free(static_cast(ptr)); } -}; + void operator()(T *ptr) { Free(static_cast(ptr)); } + }; -/** - * \brief Free memory block in one place does not meet POD - * - * \note In some cases, custom deleter is used to - * deallocate the memory automatically for - * std::unique_ptr in tensor.h. - * reinterpret_cast - */ -template class PlainDeleter { -public: - explicit PlainDeleter(){}; + /** + * \brief Free memory block in one place does not meet POD + * + * \note In some cases, custom deleter is used to + * deallocate the memory automatically for + * std::unique_ptr in tensor.h. + * reinterpret_cast + */ + template class PlainDeleter { + public: + explicit PlainDeleter(){}; - void operator()(T *ptr) { Free(reinterpret_cast(ptr)); } -}; -} // namespace memory + void operator()(T *ptr) { Free(reinterpret_cast(ptr)); } + }; + } // namespace memory } // namespace paddle_mobile diff --git a/src/operators/conv_op.cpp b/src/operators/conv_op.cpp index 11947216cb16a325ab9d9e9d6f705842402d6537..e53cd99a6c77189519e4d3fc6d13071503c8f5a0 100644 --- a/src/operators/conv_op.cpp +++ b/src/operators/conv_op.cpp @@ -22,55 +22,55 @@ SOFTWARE. #include "framework/operator.h" namespace paddle_mobile { -namespace operators { + namespace operators { -int ConvOutputSize(int input_size, int filter_size, int dilation, int padding, - int stride) { - const int dkernel = dilation * (filter_size - 1) + 1; - int output_size = (input_size + 2 * padding - dkernel) / stride + 1; - return output_size; -} + int ConvOutputSize(int input_size, int filter_size, int dilation, + int padding, int stride) { + const int dkernel = dilation * (filter_size - 1) + 1; + int output_size = (input_size + 2 * padding - dkernel) / stride + 1; + return output_size; + } -template -void ConvOp::InferShape() const { - // std::cout << " begin get dims: " << std::endl; + template + void ConvOp::InferShape() const { + // std::cout << " begin get dims: " << std::endl; - auto in_dims = param_.Input()->dims(); + auto in_dims = param_.Input()->dims(); - // std::cout << " end get in dims: " << std::endl; + // std::cout << " end get in dims: " << std::endl; - // std::cout << " in_dims: " << in_dims << std::endl; + // std::cout << " in_dims: " << in_dims << std::endl; - // std::cout << " begin get Filter " << std::endl; + // std::cout << " begin get Filter " << std::endl; - auto filter_dims = param_.Filter()->dims(); + auto filter_dims = param_.Filter()->dims(); - // std::cout << " end get Filter " << std::endl; + // std::cout << " end get Filter " << std::endl; - // std::cout << " begin get Attrs " << std::endl; + // std::cout << " begin get Attrs " << std::endl; - const std::vector &strides = param_.Strides(); + const std::vector &strides = param_.Strides(); - // std::cout << " end get Attrs " << strides[0] << std::endl; + // std::cout << " end get Attrs " << strides[0] << std::endl; - std::vector paddings = param_.Paddings(); + std::vector paddings = param_.Paddings(); - int groups = param_.Groups(); + int groups = param_.Groups(); - std::vector dilations = param_.Dilations(); + std::vector dilations = param_.Dilations(); - std::vector output_shape({in_dims[0], filter_dims[0]}); - for (size_t i = 0; i < strides.size(); ++i) { - output_shape.push_back(ConvOutputSize(in_dims[i + 2], filter_dims[i + 2], - dilations[i], paddings[i], - strides[i])); - } + std::vector output_shape({in_dims[0], filter_dims[0]}); + for (size_t i = 0; i < strides.size(); ++i) { + output_shape.push_back( + ConvOutputSize(in_dims[i + 2], filter_dims[i + 2], + dilations[i], paddings[i], strides[i])); + } - framework::DDim ddim = framework::make_ddim(output_shape); - param_.Output()->Resize(ddim); -} + framework::DDim ddim = framework::make_ddim(output_shape); + param_.Output()->Resize(ddim); + } -template class ConvOp; + template class ConvOp; -} // namespace operators + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/conv_op.h b/src/operators/conv_op.h index 4126c49f9350d69044762ba8c2af10389e2f1cfc..07ac49b555af9db2906d9b537729dea4e90bcad9 100644 --- a/src/operators/conv_op.h +++ b/src/operators/conv_op.h @@ -22,31 +22,32 @@ SOFTWARE. #include "operators/kernel/conv_kernel.h" namespace paddle_mobile { -namespace operators { - -using namespace framework; - -template -class ConvOp : public framework::OperatorWithKernel { -public: - ConvOp(const std::string &type, const VariableNameMap &inputs, - const VariableNameMap &outputs, const framework::AttributeMap &attrs, - std::shared_ptr scope) - : framework::OperatorWithKernel(type, inputs, outputs, attrs, - scope), - param_(inputs, outputs, attrs, *scope) {} - - using framework::OperatorWithKernel::OperatorWithKernel; - void InferShape() const override; - -protected: - void RunImpl() const { - operators::ConvKernel kernel; - kernel.Compute(param_); - } - - ConvParam param_; -}; - -} // operators + namespace operators { + + using namespace framework; + + template + class ConvOp : public framework::OperatorWithKernel { + public: + ConvOp(const std::string &type, const VariableNameMap &inputs, + const VariableNameMap &outputs, + const framework::AttributeMap &attrs, + std::shared_ptr scope) + : framework::OperatorWithKernel( + type, inputs, outputs, attrs, scope), + param_(inputs, outputs, attrs, *scope) {} + + using framework::OperatorWithKernel::OperatorWithKernel; + void InferShape() const override; + + protected: + void RunImpl() const { + operators::ConvKernel kernel; + kernel.Compute(param_); + } + + ConvParam param_; + }; + + } // operators } // paddle_mobile diff --git a/src/operators/kernel/arm/conv_kernel.cpp b/src/operators/kernel/arm/conv_kernel.cpp index f545323291a2a5893b5dbbb5046db1d04f933db7..a50b3878b10debc748deb85a2c9ddec4bf157098 100644 --- a/src/operators/kernel/arm/conv_kernel.cpp +++ b/src/operators/kernel/arm/conv_kernel.cpp @@ -19,135 +19,150 @@ SOFTWARE. #include "operators/kernel/conv_kernel.h" namespace paddle_mobile { -namespace operators { - -bool IsExpand(const std::vector &filter_dim, - const std::vector &strides, const std::vector &paddings, - const std::vector &dilations) { - bool filter_1 = true, strides_1 = true, padding_0 = true, dilation_1 = true; - for (size_t j = 0; j < strides.size(); ++j) { - filter_1 = filter_1 && (static_cast(filter_dim[j + 2]) == 1); - strides_1 = strides_1 && (strides[j] == 1); - padding_0 = padding_0 && (paddings[j] == 0); - dilation_1 = dilation_1 && (dilations[j] == 1); - } - return !(filter_1 && strides_1 && padding_0 && dilation_1); -} - -template <> -void ConvKernel::Compute(const ConvParam ¶m) const { - const Tensor *input = param.Input(); - - std::cout << " conv param " << param << std::endl; - - // The filter will be reshaped in the calculations, - // so here use an assignment operation, - // that avoids modifying the variable in the Scope. - Tensor filter = *param.Filter(); - - Tensor *output = param.Output(); - // output->mutable_data(context.GetPlace()); - - int groups = param.Groups(); - std::vector strides = param.Strides(); - std::vector paddings = param.Paddings(); - std::vector dilations = param.Dilations(); - - std::cout << " compute end get Attrs " << strides[0] << std::endl; - - const int batch_size = static_cast(input->dims()[0]); - - // filter_shape_vec: {k_o, k_i, k_h, k_w} or {k_o, k_i, k_d, k_h, k_w} - std::vector filter_shape_vec(framework::vectorize(filter.dims())); - // output_shape_vec: {o_n, o_c, o_h, o_w} or {o_n, o_c, o_d, o_h, o_w} - std::vector output_shape_vec(framework::vectorize(output->dims())); - - // use col_shape in the im2col calculation - // col_shape_vec: {i_c/g, k_h, k_w, o_h, o_w} or {i_c/g, k_d, k_h, k_w, o_d, - // o_h, o_w} - size_t data_dim = filter_shape_vec.size() - 2; - std::vector col_shape_vec(1 + 2 * data_dim); - col_shape_vec[0] = input->dims()[1] / groups; - for (size_t j = 0; j < data_dim; ++j) { - col_shape_vec[j + 1] = filter_shape_vec[j + 2]; - col_shape_vec[j + 1 + data_dim] = output_shape_vec[j + 2]; - } - framework::DDim col_shape(framework::make_ddim(col_shape_vec)); - - // use col_matrix_shape in the gemm calculation - // size: (i_c/g * k_h * k_w, o_h * o_w) or (i_c/g * k_d * k_h * k_w, o_d * - // o_h * o_w) - framework::DDim col_matrix_shape = - framework::flatten_to_2d(col_shape, data_dim + 1); - - bool is_expand = IsExpand(filter_shape_vec, strides, paddings, dilations); - Tensor col; - // col_matrix shares the same piece of data with col, - // but will be reshaped into a two-dimensional matrix shape - // to call the matrix multiplication interface. - Tensor col_matrix; - if (is_expand) { - col.mutable_data(col_shape); - col_matrix.ShareDataWith(col); - col_matrix.Resize(col_matrix_shape); - } - - framework::DDim input_shape = framework::slice_ddim( - input->dims(), 1, static_cast(input->dims().size())); - - framework::DDim filter_matrix_shape = {filter.dims()[0], - filter.numel() / filter.dims()[0]}; - filter.Resize(filter_matrix_shape); - - std::cout << " input dim " << input->dims() << std::endl; - - std::cout << " output dim " << output->dims() << std::endl; - - framework::DDim output_matrix_shape = { - output->dims()[1], - output->numel() / (output->dims()[0] * output->dims()[1])}; - - // convolution operator: im2col(or vol2col) + gemm - int in_step = static_cast(input->dims()[1]) / groups; - int out_step = static_cast(output->dims()[1]) / groups; - - math::Vol2ColFunctor vol2col; - math::Im2ColFunctor im2col; - - // auto& dev_ctx = context.template - // device_context(); - for (int i = 0; i < batch_size; i++) { - Tensor in_batch = input->Slice(i, i + 1).Resize(input_shape); - Tensor out_batch = output->Slice(i, i + 1).Resize(output_matrix_shape); - - for (int g = 0; g < groups; g++) { - Tensor in_slice = in_batch.Slice(g * in_step, (g + 1) * in_step); - - if (!is_expand) { - col.ShareDataWith(in_slice); - col_matrix.ShareDataWith(col); - col_matrix.Resize(col_matrix_shape); - } else if (data_dim == 2U) { - // im2col - im2col(in_slice, dilations, strides, - std::vector{paddings[0], paddings[1], paddings[0], - paddings[1]}, - &col); - } else if (data_dim == 3U) { - // vol2col - vol2col(in_slice, dilations, strides, paddings, &col); - } - - // gemm - Tensor out_slice = out_batch.Slice(g * out_step, (g + 1) * out_step); - Tensor filter_slice = filter.Slice(g * out_step, (g + 1) * out_step); - math::matmul(filter_slice, false, col_matrix, false, float(1.0), - &out_slice, float(0.0)); - } - } -} - -template class ConvKernel; - -} // namespace operators + namespace operators { + + bool IsExpand(const std::vector &filter_dim, + const std::vector &strides, + const std::vector &paddings, + const std::vector &dilations) { + bool filter_1 = true, strides_1 = true, padding_0 = true, + dilation_1 = true; + for (size_t j = 0; j < strides.size(); ++j) { + filter_1 = + filter_1 && (static_cast(filter_dim[j + 2]) == 1); + strides_1 = strides_1 && (strides[j] == 1); + padding_0 = padding_0 && (paddings[j] == 0); + dilation_1 = dilation_1 && (dilations[j] == 1); + } + return !(filter_1 && strides_1 && padding_0 && dilation_1); + } + + template <> + void ConvKernel::Compute( + const ConvParam ¶m) const { + const Tensor *input = param.Input(); + + std::cout << " conv param " << param << std::endl; + + // The filter will be reshaped in the calculations, + // so here use an assignment operation, + // that avoids modifying the variable in the Scope. + Tensor filter = *param.Filter(); + + Tensor *output = param.Output(); + // output->mutable_data(context.GetPlace()); + + int groups = param.Groups(); + std::vector strides = param.Strides(); + std::vector paddings = param.Paddings(); + std::vector dilations = param.Dilations(); + + std::cout << " compute end get Attrs " << strides[0] << std::endl; + + const int batch_size = static_cast(input->dims()[0]); + + // filter_shape_vec: {k_o, k_i, k_h, k_w} or {k_o, k_i, k_d, k_h, + // k_w} + std::vector filter_shape_vec( + framework::vectorize(filter.dims())); + // output_shape_vec: {o_n, o_c, o_h, o_w} or {o_n, o_c, o_d, o_h, + // o_w} + std::vector output_shape_vec( + framework::vectorize(output->dims())); + + // use col_shape in the im2col calculation + // col_shape_vec: {i_c/g, k_h, k_w, o_h, o_w} or {i_c/g, k_d, k_h, + // k_w, o_d, + // o_h, o_w} + size_t data_dim = filter_shape_vec.size() - 2; + std::vector col_shape_vec(1 + 2 * data_dim); + col_shape_vec[0] = input->dims()[1] / groups; + for (size_t j = 0; j < data_dim; ++j) { + col_shape_vec[j + 1] = filter_shape_vec[j + 2]; + col_shape_vec[j + 1 + data_dim] = output_shape_vec[j + 2]; + } + framework::DDim col_shape(framework::make_ddim(col_shape_vec)); + + // use col_matrix_shape in the gemm calculation + // size: (i_c/g * k_h * k_w, o_h * o_w) or (i_c/g * k_d * k_h * k_w, + // o_d * + // o_h * o_w) + framework::DDim col_matrix_shape = + framework::flatten_to_2d(col_shape, data_dim + 1); + + bool is_expand = + IsExpand(filter_shape_vec, strides, paddings, dilations); + Tensor col; + // col_matrix shares the same piece of data with col, + // but will be reshaped into a two-dimensional matrix shape + // to call the matrix multiplication interface. + Tensor col_matrix; + if (is_expand) { + col.mutable_data(col_shape); + col_matrix.ShareDataWith(col); + col_matrix.Resize(col_matrix_shape); + } + + framework::DDim input_shape = framework::slice_ddim( + input->dims(), 1, static_cast(input->dims().size())); + + framework::DDim filter_matrix_shape = { + filter.dims()[0], filter.numel() / filter.dims()[0]}; + filter.Resize(filter_matrix_shape); + + std::cout << " input dim " << input->dims() << std::endl; + + std::cout << " output dim " << output->dims() << std::endl; + + framework::DDim output_matrix_shape = { + output->dims()[1], + output->numel() / (output->dims()[0] * output->dims()[1])}; + + // convolution operator: im2col(or vol2col) + gemm + int in_step = static_cast(input->dims()[1]) / groups; + int out_step = static_cast(output->dims()[1]) / groups; + + math::Vol2ColFunctor vol2col; + math::Im2ColFunctor im2col; + + // auto& dev_ctx = context.template + // device_context(); + for (int i = 0; i < batch_size; i++) { + Tensor in_batch = input->Slice(i, i + 1).Resize(input_shape); + Tensor out_batch = + output->Slice(i, i + 1).Resize(output_matrix_shape); + + for (int g = 0; g < groups; g++) { + Tensor in_slice = + in_batch.Slice(g * in_step, (g + 1) * in_step); + + if (!is_expand) { + col.ShareDataWith(in_slice); + col_matrix.ShareDataWith(col); + col_matrix.Resize(col_matrix_shape); + } else if (data_dim == 2U) { + // im2col + im2col(in_slice, dilations, strides, + std::vector{paddings[0], paddings[1], + paddings[0], paddings[1]}, + &col); + } else if (data_dim == 3U) { + // vol2col + vol2col(in_slice, dilations, strides, paddings, &col); + } + + // gemm + Tensor out_slice = + out_batch.Slice(g * out_step, (g + 1) * out_step); + Tensor filter_slice = + filter.Slice(g * out_step, (g + 1) * out_step); + math::matmul(filter_slice, false, col_matrix, false, + float(1.0), &out_slice, float(0.0)); + } + } + } + + template class ConvKernel; + + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/conv_kernel.h b/src/operators/kernel/conv_kernel.h index 14fe8cf47ebbcca33010884915dbbaccfd6b3849..28c2621ff82d2dad767d4f1ea0ae95c09675ec59 100644 --- a/src/operators/kernel/conv_kernel.h +++ b/src/operators/kernel/conv_kernel.h @@ -25,14 +25,15 @@ SOFTWARE. #pragma once; namespace paddle_mobile { -namespace operators { + namespace operators { -using namespace framework; + using namespace framework; -template -class ConvKernel : public framework::OpKernelBase { -public: - void Compute(const ConvParam ¶m) const; -}; -} + template + class ConvKernel + : public framework::OpKernelBase { + public: + void Compute(const ConvParam ¶m) const; + }; + } } diff --git a/src/operators/kernel/fpga/conv_kernel.cpp b/src/operators/kernel/fpga/conv_kernel.cpp index 9298e864da2f08068c8487f0b732ec0255b8d0c2..1c4fc9bca49929046b1d855a27b53b0bc107195c 100644 --- a/src/operators/kernel/fpga/conv_kernel.cpp +++ b/src/operators/kernel/fpga/conv_kernel.cpp @@ -19,11 +19,12 @@ SOFTWARE. #include "operators/kernel/conv_kernel.h" namespace paddle_mobile { -namespace operators { + namespace operators { -// template<> -// void ConvKernel::Compute(const ConvParam ¶m) const {} -// -// template class ConvKernel; -} + // template<> + // void ConvKernel::Compute(const ConvParam ¶m) const + // {} + // + // template class ConvKernel; + } } diff --git a/src/operators/math/im2col.cc b/src/operators/math/im2col.cc index 77e957a6b9011757dfbb8bcfb74c0af2b0f09d83..b54a0694d6725042f22c2e64580d0739b77e2fe2 100644 --- a/src/operators/math/im2col.cc +++ b/src/operators/math/im2col.cc @@ -16,275 +16,349 @@ limitations under the License. */ #include "common/types.h" namespace paddle_mobile { -namespace operators { -namespace math { + namespace operators { + namespace math { -/* - * im = [input_channels, input_height, input_width] - * col = - * [input_channels, filter_height, filter_width, output_height, output_width] - */ -template class Im2ColFunctor { -public: - void operator()(const framework::Tensor &im, const std::vector &dilation, - const std::vector &stride, - const std::vector &padding, framework::Tensor *col) { - // PADDLE_ENFORCE(im.dims().size() == 3); - // PADDLE_ENFORCE(col->dims().size() == 5); + /* + * im = [input_channels, input_height, input_width] + * col = + * [input_channels, filter_height, filter_width, output_height, + * output_width] + */ + template class Im2ColFunctor { + public: + void operator()(const framework::Tensor &im, + const std::vector &dilation, + const std::vector &stride, + const std::vector &padding, + framework::Tensor *col) { + // PADDLE_ENFORCE(im.dims().size() == 3); + // PADDLE_ENFORCE(col->dims().size() == 5); - int im_channels = im.dims()[0]; - int im_height = im.dims()[1]; - int im_width = im.dims()[2]; - int filter_height = col->dims()[1]; - int filter_width = col->dims()[2]; - int col_height = col->dims()[3]; - int col_width = col->dims()[4]; + int im_channels = im.dims()[0]; + int im_height = im.dims()[1]; + int im_width = im.dims()[2]; + int filter_height = col->dims()[1]; + int filter_width = col->dims()[2]; + int col_height = col->dims()[3]; + int col_width = col->dims()[4]; - // PADDLE_ENFORCE_EQ((im_height + padding[0] + padding[2] - - // ((dilation[0] * (filter_height - 1) + 1))) / - // stride[0] + - // 1, - // col_height, - // "Output_height and padding(padding_up, padding_down) - // are " "inconsistent."); - // PADDLE_ENFORCE_EQ((im_width + padding[1] + padding[3] - - // ((dilation[1] * (filter_width - 1) + 1))) / - // stride[1] + - // 1, - // col_width, - // "Output_height and padding(padding_up, padding_down) - // are " "inconsistent."); + // PADDLE_ENFORCE_EQ((im_height + padding[0] + padding[2] + // - + // ((dilation[0] * (filter_height - 1) + // + 1))) / + // stride[0] + + // 1, + // col_height, + // "Output_height and + // padding(padding_up, padding_down) + // are " "inconsistent."); + // PADDLE_ENFORCE_EQ((im_width + padding[1] + padding[3] + // - + // ((dilation[1] * (filter_width - 1) + // + 1))) / + // stride[1] + + // 1, + // col_width, + // "Output_height and + // padding(padding_up, padding_down) + // are " "inconsistent."); - int channels_col = im_channels * filter_height * filter_width; + int channels_col = + im_channels * filter_height * filter_width; - const T *im_data = im.data(); - T *col_data = col->data(); - for (int c = 0; c < channels_col; ++c) { - int w_offset = c % filter_width; - int h_offset = (c / filter_width) % filter_height; - int c_im = c / (filter_width * filter_height); - for (int h = 0; h < col_height; ++h) { - int im_row_idx = h * stride[0] - padding[0] + h_offset * dilation[0]; - for (int w = 0; w < col_width; ++w) { - int im_col_idx = w * stride[1] - padding[1] + w_offset * dilation[1]; - int col_idx = (c * col_height + h) * col_width + w; - int im_idx = (im_row_idx + c_im * im_height) * im_width + im_col_idx; + const T *im_data = im.data(); + T *col_data = col->data(); + for (int c = 0; c < channels_col; ++c) { + int w_offset = c % filter_width; + int h_offset = (c / filter_width) % filter_height; + int c_im = c / (filter_width * filter_height); + for (int h = 0; h < col_height; ++h) { + int im_row_idx = h * stride[0] - padding[0] + + h_offset * dilation[0]; + for (int w = 0; w < col_width; ++w) { + int im_col_idx = w * stride[1] - padding[1] + + w_offset * dilation[1]; + int col_idx = + (c * col_height + h) * col_width + w; + int im_idx = + (im_row_idx + c_im * im_height) * im_width + + im_col_idx; - col_data[col_idx] = (im_row_idx < 0 || im_row_idx >= im_height || - im_col_idx < 0 || im_col_idx >= im_width) - ? static_cast(0) - : im_data[im_idx]; - } - } - } - } -}; + col_data[col_idx] = + (im_row_idx < 0 || + im_row_idx >= im_height || + im_col_idx < 0 || im_col_idx >= im_width) + ? static_cast(0) + : im_data[im_idx]; + } + } + } + } + }; -/* - * im = [input_channels, input_height, input_width] - * col = - * [input_channels, filter_height, filter_width, output_height, output_width] - */ -template class Col2ImFunctor { -public: - void operator()(const framework::Tensor &col, - const std::vector &dilation, - const std::vector &stride, - const std::vector &padding, framework::Tensor *im) { - // PADDLE_ENFORCE(im->dims().size() == 3); - // PADDLE_ENFORCE(col.dims().size() == 5); - int im_channels = im->dims()[0]; - int im_height = im->dims()[1]; - int im_width = im->dims()[2]; - int filter_height = col.dims()[1]; - int filter_width = col.dims()[2]; - int col_height = col.dims()[3]; - int col_width = col.dims()[4]; + /* + * im = [input_channels, input_height, input_width] + * col = + * [input_channels, filter_height, filter_width, output_height, + * output_width] + */ + template class Col2ImFunctor { + public: + void operator()(const framework::Tensor &col, + const std::vector &dilation, + const std::vector &stride, + const std::vector &padding, + framework::Tensor *im) { + // PADDLE_ENFORCE(im->dims().size() == 3); + // PADDLE_ENFORCE(col.dims().size() == 5); + int im_channels = im->dims()[0]; + int im_height = im->dims()[1]; + int im_width = im->dims()[2]; + int filter_height = col.dims()[1]; + int filter_width = col.dims()[2]; + int col_height = col.dims()[3]; + int col_width = col.dims()[4]; - // PADDLE_ENFORCE_EQ((im_height + padding[0] + padding[2] - - // ((dilation[0] * (filter_height - 1) + 1))) / - // stride[0] + - // 1, - // col_height, - // "Output_height and padding(padding_up, padding_down) - // are " "inconsistent."); - // PADDLE_ENFORCE_EQ((im_width + padding[1] + padding[3] - - // ((dilation[1] * (filter_width - 1) + 1))) / - // stride[1] + - // 1, - // col_width, - // "Output_height and padding(padding_up, padding_down) - // are " "inconsistent."); + // PADDLE_ENFORCE_EQ((im_height + padding[0] + padding[2] + // - + // ((dilation[0] * (filter_height - 1) + // + 1))) / + // stride[0] + + // 1, + // col_height, + // "Output_height and + // padding(padding_up, padding_down) + // are " "inconsistent."); + // PADDLE_ENFORCE_EQ((im_width + padding[1] + padding[3] + // - + // ((dilation[1] * (filter_width - 1) + // + 1))) / + // stride[1] + + // 1, + // col_width, + // "Output_height and + // padding(padding_up, padding_down) + // are " "inconsistent."); - int channels_col = im_channels * filter_height * filter_width; + int channels_col = + im_channels * filter_height * filter_width; - T *im_data = im->data(); - const T *col_data = col.data(); + T *im_data = im->data(); + const T *col_data = col.data(); - for (int c = 0; c < channels_col; ++c) { - int w_offset = c % filter_width; - int h_offset = (c / filter_width) % filter_height; - int c_im = c / (filter_width * filter_height); - for (int h = 0; h < col_height; ++h) { - int im_row_idx = h * stride[0] - padding[0] + h_offset * dilation[0]; - for (int w = 0; w < col_width; ++w) { - int im_col_idx = w * stride[1] - padding[1] + w_offset * dilation[1]; - if ((im_row_idx) >= 0 && (im_row_idx) < im_height && - (im_col_idx) >= 0 && (im_col_idx) < im_width) { - im_data[(im_row_idx + c_im * im_height) * im_width + im_col_idx] += - col_data[(c * col_height + h) * col_width + w]; - } - } - } - } - } -}; + for (int c = 0; c < channels_col; ++c) { + int w_offset = c % filter_width; + int h_offset = (c / filter_width) % filter_height; + int c_im = c / (filter_width * filter_height); + for (int h = 0; h < col_height; ++h) { + int im_row_idx = h * stride[0] - padding[0] + + h_offset * dilation[0]; + for (int w = 0; w < col_width; ++w) { + int im_col_idx = w * stride[1] - padding[1] + + w_offset * dilation[1]; + if ((im_row_idx) >= 0 && + (im_row_idx) < im_height && + (im_col_idx) >= 0 && + (im_col_idx) < im_width) { + im_data[(im_row_idx + c_im * im_height) * + im_width + + im_col_idx] += + col_data[(c * col_height + h) * + col_width + + w]; + } + } + } + } + } + }; -template class Im2ColFunctor; -template class Im2ColFunctor; -template class Col2ImFunctor; -template class Col2ImFunctor; + template class Im2ColFunctor; + template class Im2ColFunctor; + template class Col2ImFunctor; + template class Col2ImFunctor; -/* - * im = [input_channels, input_height, input_width] - * col = - * [output_height, output_width, input_channels, filter_height, filter_width] - */ -template class Im2ColFunctor { -public: - void operator()(const framework::Tensor &im, const std::vector &dilation, - const std::vector &stride, - const std::vector &padding, framework::Tensor *col) { - // PADDLE_ENFORCE(im.dims().size() == 3); - // PADDLE_ENFORCE(col->dims().size() == 5); - int im_channels = im.dims()[0]; - int im_height = im.dims()[1]; - int im_width = im.dims()[2]; - int filter_height = col->dims()[3]; - int filter_width = col->dims()[4]; - int col_height = col->dims()[0]; - int col_width = col->dims()[1]; + /* + * im = [input_channels, input_height, input_width] + * col = + * [output_height, output_width, input_channels, filter_height, + * filter_width] + */ + template class Im2ColFunctor { + public: + void operator()(const framework::Tensor &im, + const std::vector &dilation, + const std::vector &stride, + const std::vector &padding, + framework::Tensor *col) { + // PADDLE_ENFORCE(im.dims().size() == 3); + // PADDLE_ENFORCE(col->dims().size() == 5); + int im_channels = im.dims()[0]; + int im_height = im.dims()[1]; + int im_width = im.dims()[2]; + int filter_height = col->dims()[3]; + int filter_width = col->dims()[4]; + int col_height = col->dims()[0]; + int col_width = col->dims()[1]; - // PADDLE_ENFORCE_EQ( - // (im_height + padding[0] + padding[2] - filter_height) / stride[0] - // + 1, col_height, "Output_height and padding(padding_up, - // padding_down) are " "inconsistent."); - // PADDLE_ENFORCE_EQ( - // (im_width + padding[1] + padding[3] - filter_width) / stride[1] + - // 1, col_width, "col_width and padding(padding_left, padding_right) - // are " "inconsistent."); + // PADDLE_ENFORCE_EQ( + // (im_height + padding[0] + padding[2] - + // filter_height) / stride[0] + // + 1, col_height, "Output_height and + // padding(padding_up, + // padding_down) are " "inconsistent."); + // PADDLE_ENFORCE_EQ( + // (im_width + padding[1] + padding[3] - + // filter_width) / stride[1] + + // 1, col_width, "col_width and padding(padding_left, + // padding_right) + // are " "inconsistent."); - const T *im_data = im.data(); - T *col_data = col->data(); + const T *im_data = im.data(); + T *col_data = col->data(); - for (int col_row_idx = 0; col_row_idx < col_height; ++col_row_idx) { - for (int col_col_idx = 0; col_col_idx < col_width; ++col_col_idx) { - for (int channel = 0; channel < im_channels; ++channel) { - for (int filter_row_idx = 0; filter_row_idx < filter_height; - ++filter_row_idx) { - int im_row_offset = - col_row_idx * stride[0] + filter_row_idx - padding[0]; - for (int filter_col_idx = 0; filter_col_idx < filter_width; - ++filter_col_idx) { - int im_col_offset = - col_col_idx * stride[1] + filter_col_idx - padding[1]; + for (int col_row_idx = 0; col_row_idx < col_height; + ++col_row_idx) { + for (int col_col_idx = 0; col_col_idx < col_width; + ++col_col_idx) { + for (int channel = 0; channel < im_channels; + ++channel) { + for (int filter_row_idx = 0; + filter_row_idx < filter_height; + ++filter_row_idx) { + int im_row_offset = + col_row_idx * stride[0] + + filter_row_idx - padding[0]; + for (int filter_col_idx = 0; + filter_col_idx < filter_width; + ++filter_col_idx) { + int im_col_offset = + col_col_idx * stride[1] + + filter_col_idx - padding[1]; - int col_offset = - ((((col_row_idx)*col_width + col_col_idx) * im_channels + - channel) * - filter_height + - filter_row_idx) * - filter_width + - filter_col_idx; + int col_offset = + ((((col_row_idx)*col_width + + col_col_idx) * + im_channels + + channel) * + filter_height + + filter_row_idx) * + filter_width + + filter_col_idx; - int im_offset = (channel * im_height + im_row_offset) * im_width + - im_col_offset; - col_data[col_offset] = - (im_row_offset < 0 || im_row_offset >= im_height || - im_col_offset < 0 || im_col_offset >= im_width) - ? static_cast(0) - : im_data[im_offset]; - } - } - } - } - } - } -}; + int im_offset = (channel * im_height + + im_row_offset) * + im_width + + im_col_offset; + col_data[col_offset] = + (im_row_offset < 0 || + im_row_offset >= im_height || + im_col_offset < 0 || + im_col_offset >= im_width) + ? static_cast(0) + : im_data[im_offset]; + } + } + } + } + } + } + }; -/* - * im = [input_channels, input_height, input_width] - * col = - * [output_height, output_width, input_channels, filter_height, filter_width] - */ -template class Col2ImFunctor { -public: - void operator()(const framework::Tensor &col, - const std::vector &dilation, - const std::vector &stride, - const std::vector &padding, framework::Tensor *im) { - // PADDLE_ENFORCE(im->dims().size() == 3); - // PADDLE_ENFORCE(col.dims().size() == 5); - int im_channels = im->dims()[0]; - int im_height = im->dims()[1]; - int im_width = im->dims()[2]; - int filter_height = col.dims()[3]; - int filter_width = col.dims()[4]; - int col_height = col.dims()[0]; - int col_width = col.dims()[1]; + /* + * im = [input_channels, input_height, input_width] + * col = + * [output_height, output_width, input_channels, filter_height, + * filter_width] + */ + template class Col2ImFunctor { + public: + void operator()(const framework::Tensor &col, + const std::vector &dilation, + const std::vector &stride, + const std::vector &padding, + framework::Tensor *im) { + // PADDLE_ENFORCE(im->dims().size() == 3); + // PADDLE_ENFORCE(col.dims().size() == 5); + int im_channels = im->dims()[0]; + int im_height = im->dims()[1]; + int im_width = im->dims()[2]; + int filter_height = col.dims()[3]; + int filter_width = col.dims()[4]; + int col_height = col.dims()[0]; + int col_width = col.dims()[1]; - // PADDLE_ENFORCE_EQ( - // (im_height + padding[0] + padding[2] - filter_height) / stride[0] - // + 1, col_height, "Output_height and padding(padding_up, - // padding_down) are " "inconsistent."); - // PADDLE_ENFORCE_EQ( - // (im_width + padding[1] + padding[3] - filter_width) / stride[1] + - // 1, col_width, "col_width and padding(padding_left, padding_right) - // are " "inconsistent."); + // PADDLE_ENFORCE_EQ( + // (im_height + padding[0] + padding[2] - + // filter_height) / stride[0] + // + 1, col_height, "Output_height and + // padding(padding_up, + // padding_down) are " "inconsistent."); + // PADDLE_ENFORCE_EQ( + // (im_width + padding[1] + padding[3] - + // filter_width) / stride[1] + + // 1, col_width, "col_width and padding(padding_left, + // padding_right) + // are " "inconsistent."); - T *im_data = im->data(); - const T *col_data = col.data(); + T *im_data = im->data(); + const T *col_data = col.data(); - for (int col_row_idx = 0; col_row_idx < col_height; ++col_row_idx) { - for (int col_col_idx = 0; col_col_idx < col_width; ++col_col_idx) { - for (int channel = 0; channel < im_channels; ++channel) { - for (int filter_row_idx = 0; filter_row_idx < filter_height; - ++filter_row_idx) { - int im_row_offset = - col_row_idx * stride[0] + filter_row_idx - padding[0]; - for (int filter_col_idx = 0; filter_col_idx < filter_width; - ++filter_col_idx) { - int im_col_offset = - col_col_idx * stride[1] + filter_col_idx - padding[1]; + for (int col_row_idx = 0; col_row_idx < col_height; + ++col_row_idx) { + for (int col_col_idx = 0; col_col_idx < col_width; + ++col_col_idx) { + for (int channel = 0; channel < im_channels; + ++channel) { + for (int filter_row_idx = 0; + filter_row_idx < filter_height; + ++filter_row_idx) { + int im_row_offset = + col_row_idx * stride[0] + + filter_row_idx - padding[0]; + for (int filter_col_idx = 0; + filter_col_idx < filter_width; + ++filter_col_idx) { + int im_col_offset = + col_col_idx * stride[1] + + filter_col_idx - padding[1]; - int col_offset = - (((col_row_idx * col_width + col_col_idx) * im_channels + - channel) * - filter_height + - filter_row_idx) * - filter_width + - filter_col_idx; + int col_offset = + (((col_row_idx * col_width + + col_col_idx) * + im_channels + + channel) * + filter_height + + filter_row_idx) * + filter_width + + filter_col_idx; - if (im_row_offset >= 0 && im_row_offset < im_height && - im_col_offset >= 0 && im_col_offset < im_width) { - int im_offset = - (channel * im_height + im_row_offset) * im_width + - im_col_offset; - im_data[im_offset] += col_data[col_offset]; - } - } - } - } - } - } - } -}; + if (im_row_offset >= 0 && + im_row_offset < im_height && + im_col_offset >= 0 && + im_col_offset < im_width) { + int im_offset = + (channel * im_height + + im_row_offset) * + im_width + + im_col_offset; + im_data[im_offset] += + col_data[col_offset]; + } + } + } + } + } + } + } + }; -template class Im2ColFunctor; -template class Im2ColFunctor; -template class Col2ImFunctor; -template class Col2ImFunctor; + template class Im2ColFunctor; + template class Im2ColFunctor; + template class Col2ImFunctor; + template class Col2ImFunctor; -} // namespace math -} // namespace operators + } // namespace math + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/math/im2col.h b/src/operators/math/im2col.h index 0bb8ed12647c1d629e786191e5e23263dd2c8690..e9657e84cdcfec3a84e1920a5793d31c6468f930 100644 --- a/src/operators/math/im2col.h +++ b/src/operators/math/im2col.h @@ -17,83 +17,96 @@ limitations under the License. */ #include "framework/tensor.h" namespace paddle_mobile { -namespace operators { -namespace math { + namespace operators { + namespace math { -/* The storage format of the coldata in the Im2ColFunctor and Col2ImFunctor. */ -enum class ColFormat { kCFO = 0, kOCF = 1 }; + /* The storage format of the coldata in the Im2ColFunctor and + * Col2ImFunctor. */ + enum class ColFormat { kCFO = 0, kOCF = 1 }; -/* - * \brief Converts the image data of three dimensions(CHW) into a colData of - * five dimensions in the Im2ColFunctor calculation, - * And in the Col2ImFunctor calculation, it is reversed. - * - * \param imData Image data. - * \param imShape The shape of imData, - * [input_channels, input_height, input_width]. - * \param colData Column data. - * \param colShape The shape of colData. - * - * \param dilations dilation data. - * \param 2-dimension [dilation_height, dilation_width]. - * - * \param strides stride data. - * \param 2-dimension [stride_height, stride_width]. - * - * \param paddings padding data. - * \param 4-dimension [up_pad, left_pad, down_pad, right_pad]. - * - * If the template argument Format is kCFO, the shape of colData is: - * [input_channels, filter_height, filter_width, output_height, output_width] - * So, it is easy to reshape into a convolution matrix for convolution - * calculation based on matrix multiplication. - * The shape of convolution matrix is [height, width], where the height is equal - * input_channels * filter_height * filter_width, and the width is equal - * output_height * output_width. - * - * Reshape: - * shape of colData shape of convolution matrix - * [input_channels, - * filter_height, - * filter_width, ======> [height, width] - * output_height, - * output_width] - * - * If the template argument Format is kOCF, the shape of colData is: - * [output_height, output_width, input_channels, filter_height, filter_width] - * So, it is easy to reshape into a sequence matrix for rnn calculation. - * The shape of sequence matrix is [seq_length, step_size], where the seq_length - * is equal output_height * output_width, and the step_size is equal - * input_channels * filter_height * filter_width. - * - * Reshape: - * shape of colData shape of sequence matrix - * [output_height, - * output_width, - * input_channels, ======> [seqLength, stepSize] - * filter_height, - * filter_width] - * - * \note The caller needs to ensure that imShape.inputChannels is equal to - * colShape.inputChannels. - */ -template -class Im2ColFunctor { -public: - void operator()(const framework::Tensor &im, const std::vector &dilation, - const std::vector &stride, - const std::vector &padding, framework::Tensor *col); -}; + /* + * \brief Converts the image data of three dimensions(CHW) into a + * colData of + * five dimensions in the Im2ColFunctor calculation, + * And in the Col2ImFunctor calculation, it is reversed. + * + * \param imData Image data. + * \param imShape The shape of imData, + * [input_channels, input_height, input_width]. + * \param colData Column data. + * \param colShape The shape of colData. + * + * \param dilations dilation data. + * \param 2-dimension [dilation_height, dilation_width]. + * + * \param strides stride data. + * \param 2-dimension [stride_height, stride_width]. + * + * \param paddings padding data. + * \param 4-dimension [up_pad, left_pad, down_pad, right_pad]. + * + * If the template argument Format is kCFO, the shape of colData is: + * [input_channels, filter_height, filter_width, output_height, + * output_width] + * So, it is easy to reshape into a convolution matrix for + * convolution + * calculation based on matrix multiplication. + * The shape of convolution matrix is [height, width], where the + * height is equal + * input_channels * filter_height * filter_width, and the width is + * equal + * output_height * output_width. + * + * Reshape: + * shape of colData shape of convolution matrix + * [input_channels, + * filter_height, + * filter_width, ======> [height, width] + * output_height, + * output_width] + * + * If the template argument Format is kOCF, the shape of colData is: + * [output_height, output_width, input_channels, filter_height, + * filter_width] + * So, it is easy to reshape into a sequence matrix for rnn + * calculation. + * The shape of sequence matrix is [seq_length, step_size], where + * the seq_length + * is equal output_height * output_width, and the step_size is equal + * input_channels * filter_height * filter_width. + * + * Reshape: + * shape of colData shape of sequence matrix + * [output_height, + * output_width, + * input_channels, ======> [seqLength, stepSize] + * filter_height, + * filter_width] + * + * \note The caller needs to ensure that imShape.inputChannels is + * equal to + * colShape.inputChannels. + */ + template + class Im2ColFunctor { + public: + void operator()(const framework::Tensor &im, + const std::vector &dilation, + const std::vector &stride, + const std::vector &padding, + framework::Tensor *col); + }; -template -class Col2ImFunctor { -public: - void operator()(const framework::Tensor &col, - const std::vector &dilation, - const std::vector &stride, - const std::vector &padding, framework::Tensor *im); -}; + template + class Col2ImFunctor { + public: + void operator()(const framework::Tensor &col, + const std::vector &dilation, + const std::vector &stride, + const std::vector &padding, + framework::Tensor *im); + }; -} // namespace math -} // namespace operators + } // namespace math + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/math/math_function.cc b/src/operators/math/math_function.cc index 554275c499c184239f29fa02836650a642dba69d..4fa5470710f72a8b07dcffd6d771f1db85a053d5 100644 --- a/src/operators/math/math_function.cc +++ b/src/operators/math/math_function.cc @@ -15,106 +15,125 @@ limitations under the License. */ #include "math_function.h" namespace paddle_mobile { -namespace operators { -namespace math { - -template <> -void gemm(const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, - const int M, const int N, const int K, const float alpha, - const float *A, const float *B, const float beta, float *C) { - int lda = (transA == CblasNoTrans) ? K : M; - int ldb = (transB == CblasNoTrans) ? N : K; - int ldc = N; - cblas_sgemm(CblasRowMajor, transA, transB, M, N, K, alpha, A, lda, B, ldb, - beta, C, ldc); -} - -template <> -void gemm(const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, - const int M, const int N, const int K, const double alpha, - const double *A, const double *B, const double beta, - double *C) { - int lda = (transA == CblasNoTrans) ? K : M; - int ldb = (transB == CblasNoTrans) ? N : K; - int ldc = N; - cblas_dgemm(CblasRowMajor, transA, transB, M, N, K, alpha, A, lda, B, ldb, - beta, C, ldc); -} - -template <> -void gemm(const bool transA, const bool transB, const int M, const int N, - const int K, const float alpha, const float *A, const int lda, - const float *B, const int ldb, const float beta, float *C, - const int ldc) { - cblas_sgemm(CblasRowMajor, transA == false ? CblasNoTrans : CblasTrans, - transB == false ? CblasNoTrans : CblasTrans, M, N, K, alpha, A, - lda, B, ldb, beta, C, ldc); -} - -template <> -void gemm(const bool transA, const bool transB, const int M, - const int N, const int K, const double alpha, const double *A, - const int lda, const double *B, const int ldb, - const double beta, double *C, const int ldc) { - cblas_dgemm(CblasRowMajor, transA == false ? CblasNoTrans : CblasTrans, - transB == false ? CblasNoTrans : CblasTrans, M, N, K, alpha, A, - lda, B, ldb, beta, C, ldc); -} - -template <> -void matmul(const framework::Tensor &matrix_a, bool trans_a, - const framework::Tensor &matrix_b, bool trans_b, float alpha, - framework::Tensor *matrix_out, float beta) { - auto dim_a = matrix_a.dims(); - auto dim_b = matrix_b.dims(); - auto dim_out = matrix_out->dims(); - // PADDLE_ENFORCE(dim_a.size() == 2 && dim_b.size() == 2 && dim_out.size() == - // 2, - // "The input and output of matmul be matrix"); - // - // PADDLE_ENFORCE(platform::is_cpu_place(matrix_a.place()) && - // platform::is_cpu_place(matrix_b.place()) && - // platform::is_cpu_place(matrix_out->place()), - // "Matrix must all be in CPUPlace"); - - int M = dim_out[0]; - int N = dim_out[1]; - int K = (trans_a == false) ? dim_a[1] : dim_a[0]; - - CBLAS_TRANSPOSE transA = (trans_a == false) ? CblasNoTrans : CblasTrans; - CBLAS_TRANSPOSE transB = (trans_b == false) ? CblasNoTrans : CblasTrans; - - gemm(transA, transB, M, N, K, alpha, matrix_a.data(), - matrix_b.data(), beta, matrix_out->data()); -} - -template <> -void matmul(const framework::Tensor &matrix_a, bool trans_a, - const framework::Tensor &matrix_b, bool trans_b, - double alpha, framework::Tensor *matrix_out, double beta) { - auto dim_a = matrix_a.dims(); - auto dim_b = matrix_b.dims(); - auto dim_out = matrix_out->dims(); - // PADDLE_ENFORCE(dim_a.size() == 2 && dim_b.size() == 2 && dim_out.size() == - // 2, - // "The input and output of matmul be matrix"); - // - // PADDLE_ENFORCE(platform::is_cpu_place(matrix_a.place()) && - // platform::is_cpu_place(matrix_b.place()) && - // platform::is_cpu_place(matrix_out->place()), - // "Matrix must all be in CPUPlace"); - - int M = dim_out[0]; - int N = dim_out[1]; - int K = (trans_a == false) ? dim_a[1] : dim_a[0]; - - CBLAS_TRANSPOSE transA = (trans_a == false) ? CblasNoTrans : CblasTrans; - CBLAS_TRANSPOSE transB = (trans_b == false) ? CblasNoTrans : CblasTrans; - - gemm(transA, transB, M, N, K, alpha, matrix_a.data(), - matrix_b.data(), beta, matrix_out->data()); -} - -} // namespace math -} // namespace operators + namespace operators { + namespace math { + + template <> + void gemm(const CBLAS_TRANSPOSE transA, + const CBLAS_TRANSPOSE transB, const int M, + const int N, const int K, const float alpha, + const float *A, const float *B, const float beta, + float *C) { + int lda = (transA == CblasNoTrans) ? K : M; + int ldb = (transB == CblasNoTrans) ? N : K; + int ldc = N; + cblas_sgemm(CblasRowMajor, transA, transB, M, N, K, alpha, A, + lda, B, ldb, beta, C, ldc); + } + + template <> + void gemm(const CBLAS_TRANSPOSE transA, + const CBLAS_TRANSPOSE transB, const int M, + const int N, const int K, const double alpha, + const double *A, const double *B, + const double beta, double *C) { + int lda = (transA == CblasNoTrans) ? K : M; + int ldb = (transB == CblasNoTrans) ? N : K; + int ldc = N; + cblas_dgemm(CblasRowMajor, transA, transB, M, N, K, alpha, A, + lda, B, ldb, beta, C, ldc); + } + + template <> + void gemm(const bool transA, const bool transB, const int M, + const int N, const int K, const float alpha, + const float *A, const int lda, const float *B, + const int ldb, const float beta, float *C, + const int ldc) { + cblas_sgemm(CblasRowMajor, + transA == false ? CblasNoTrans : CblasTrans, + transB == false ? CblasNoTrans : CblasTrans, M, N, + K, alpha, A, lda, B, ldb, beta, C, ldc); + } + + template <> + void gemm(const bool transA, const bool transB, const int M, + const int N, const int K, const double alpha, + const double *A, const int lda, const double *B, + const int ldb, const double beta, double *C, + const int ldc) { + cblas_dgemm(CblasRowMajor, + transA == false ? CblasNoTrans : CblasTrans, + transB == false ? CblasNoTrans : CblasTrans, M, N, + K, alpha, A, lda, B, ldb, beta, C, ldc); + } + + template <> + void matmul(const framework::Tensor &matrix_a, bool trans_a, + const framework::Tensor &matrix_b, bool trans_b, + float alpha, framework::Tensor *matrix_out, + float beta) { + auto dim_a = matrix_a.dims(); + auto dim_b = matrix_b.dims(); + auto dim_out = matrix_out->dims(); + // PADDLE_ENFORCE(dim_a.size() == 2 && dim_b.size() == 2 && + // dim_out.size() == + // 2, + // "The input and output of matmul be matrix"); + // + // PADDLE_ENFORCE(platform::is_cpu_place(matrix_a.place()) && + // platform::is_cpu_place(matrix_b.place()) + // && + // platform::is_cpu_place(matrix_out->place()), + // "Matrix must all be in CPUPlace"); + + int M = dim_out[0]; + int N = dim_out[1]; + int K = (trans_a == false) ? dim_a[1] : dim_a[0]; + + CBLAS_TRANSPOSE transA = + (trans_a == false) ? CblasNoTrans : CblasTrans; + CBLAS_TRANSPOSE transB = + (trans_b == false) ? CblasNoTrans : CblasTrans; + + gemm(transA, transB, M, N, K, alpha, + matrix_a.data(), matrix_b.data(), + beta, matrix_out->data()); + } + + template <> + void matmul(const framework::Tensor &matrix_a, bool trans_a, + const framework::Tensor &matrix_b, bool trans_b, + double alpha, framework::Tensor *matrix_out, + double beta) { + auto dim_a = matrix_a.dims(); + auto dim_b = matrix_b.dims(); + auto dim_out = matrix_out->dims(); + // PADDLE_ENFORCE(dim_a.size() == 2 && dim_b.size() == 2 && + // dim_out.size() == + // 2, + // "The input and output of matmul be matrix"); + // + // PADDLE_ENFORCE(platform::is_cpu_place(matrix_a.place()) && + // platform::is_cpu_place(matrix_b.place()) + // && + // platform::is_cpu_place(matrix_out->place()), + // "Matrix must all be in CPUPlace"); + + int M = dim_out[0]; + int N = dim_out[1]; + int K = (trans_a == false) ? dim_a[1] : dim_a[0]; + + CBLAS_TRANSPOSE transA = + (trans_a == false) ? CblasNoTrans : CblasTrans; + CBLAS_TRANSPOSE transB = + (trans_b == false) ? CblasNoTrans : CblasTrans; + + gemm(transA, transB, M, N, K, alpha, + matrix_a.data(), matrix_b.data(), + beta, matrix_out->data()); + } + + } // namespace math + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/math/math_function.h b/src/operators/math/math_function.h index c6cfea885601846123ab026d823d885d600ac77c..0db08aa6b1796feb41e444a2cd656e1a62d8e5c2 100644 --- a/src/operators/math/math_function.h +++ b/src/operators/math/math_function.h @@ -19,24 +19,26 @@ limitations under the License. */ #include namespace paddle_mobile { -namespace operators { -namespace math { - -template -void gemm(const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, - const int M, const int N, const int K, const T alpha, const T *A, - const T *B, const T beta, T *C); - -template -void gemm(const bool transA, const bool transB, const int M, const int N, - const int K, const T alpha, const T *A, const int lda, const T *B, - const int ldb, const T beta, T *C, const int ldc); - -// matrix multiply with continuous memory -template -void matmul(const framework::Tensor &matrix_a, bool trans_a, - const framework::Tensor &matrix_b, bool trans_b, T alpha, - framework::Tensor *matrix_out, T beta); -} // namespace math -} // namespace operators + namespace operators { + namespace math { + + template + void gemm(const CBLAS_TRANSPOSE transA, + const CBLAS_TRANSPOSE transB, const int M, const int N, + const int K, const T alpha, const T *A, const T *B, + const T beta, T *C); + + template + void gemm(const bool transA, const bool transB, const int M, + const int N, const int K, const T alpha, const T *A, + const int lda, const T *B, const int ldb, const T beta, + T *C, const int ldc); + + // matrix multiply with continuous memory + template + void matmul(const framework::Tensor &matrix_a, bool trans_a, + const framework::Tensor &matrix_b, bool trans_b, + T alpha, framework::Tensor *matrix_out, T beta); + } // namespace math + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/math/vol2col.cc b/src/operators/math/vol2col.cc index 26e146a087bc5b9e0ea755cfeba341c29028d17b..485b94e4371e9a6008940e8bff44dea671d02a22 100644 --- a/src/operators/math/vol2col.cc +++ b/src/operators/math/vol2col.cc @@ -15,179 +15,212 @@ limitations under the License. */ #include "vol2col.h" namespace paddle_mobile { -namespace operators { -namespace math { - -using Tensor = paddle_mobile::framework::Tensor; -/* - * vol = [input_channels, input_depth, input_height, input_width] - * col = - * [input_channels, filter_depth, filter_height, filter_width, - * output_depth, output_height, output_width] - */ -template class Vol2ColFunctor { -public: - void operator()(const Tensor &vol, const std::vector &dilations, - const std::vector &strides, - const std::vector &paddings, Tensor *col) const { - // PADDLE_ENFORCE(vol.dims().size() == 4); - // PADDLE_ENFORCE(col->dims().size() == 7); - - int input_channels = vol.dims()[0]; - int input_depth = vol.dims()[1]; - int input_height = vol.dims()[2]; - int input_width = vol.dims()[3]; - int filter_depth = col->dims()[1]; - int filter_height = col->dims()[2]; - int filter_width = col->dims()[3]; - int output_depth = col->dims()[4]; - int output_height = col->dims()[5]; - int output_width = col->dims()[6]; - int channels_col = - input_channels * filter_depth * filter_height * filter_width; - - // PADDLE_ENFORCE_EQ((input_depth + 2 * paddings[0] - - // ((dilations[0] * (filter_depth - 1) + 1))) / - // strides[0] + - // 1, - // output_depth, - // "input_depth and output_depth are " - // "mismatching."); - // PADDLE_ENFORCE_EQ((input_height + 2 * paddings[1] - - // ((dilations[1] * (filter_height - 1) + 1))) / - // strides[1] + - // 1, - // output_height, - // "input_height and output_height are " - // "mismatching."); - // PADDLE_ENFORCE_EQ((input_width + 2 * paddings[2] - - // ((dilations[2] * (filter_width - 1) + 1))) / - // strides[2] + - // 1, - // output_width, - // "input_width and output_width are " - // "mismatching."); - - const T *vol_data = vol.data(); - T *col_data = col->data(); - - for (int c = 0; c < channels_col; ++c) { - int w_offset = c % filter_width; - int h_offset = (c / filter_width) % filter_height; - int d_offset = (c / filter_width / filter_height) % filter_depth; - int c_in = c / filter_width / filter_height / filter_depth; - for (int d = 0; d < output_depth; ++d) { - int d_pad = d * strides[0] - paddings[0] + d_offset * dilations[0]; - for (int h = 0; h < output_height; ++h) { - int h_pad = h * strides[1] - paddings[1] + h_offset * dilations[1]; - for (int w = 0; w < output_width; ++w) { - int w_pad = w * strides[2] - paddings[2] + w_offset * dilations[2]; - - int col_idx = - ((c * output_depth + d) * output_height + h) * output_width + w; - int vol_idx = - ((c_in * input_depth + d_pad) * input_height + h_pad) * - input_width + - w_pad; - col_data[col_idx] = - (h_pad < 0 || h_pad >= input_height || w_pad < 0 || - w_pad >= input_width || d_pad < 0 || d_pad >= input_depth) - ? static_cast(0) - : vol_data[vol_idx]; - } - } - } - } - } -}; - -/* - * vol = [input_channels,input_depth, input_height, input_width] - * col = - * [input_channels, filter_depth, filter_height, filter_width, - * output_depth, output_height, output_width] - */ -template class Col2VolFunctor { -public: - void operator()(const Tensor &col, const std::vector &dilations, - const std::vector &strides, - const std::vector &paddings, Tensor *vol) const { - // PADDLE_ENFORCE(vol->dims().size() == 4); - // PADDLE_ENFORCE(col.dims().size() == 7); - - int input_channels = vol->dims()[0]; - int input_depth = vol->dims()[1]; - int input_height = vol->dims()[2]; - int input_width = vol->dims()[3]; - int filter_depth = col.dims()[1]; - int filter_height = col.dims()[2]; - int filter_width = col.dims()[3]; - int output_depth = col.dims()[4]; - int output_height = col.dims()[5]; - int output_width = col.dims()[6]; - int channels_col = - input_channels * filter_depth * filter_height * filter_width; - - // PADDLE_ENFORCE_EQ((input_depth + 2 * paddings[0] - - // ((dilations[0] * (filter_depth - 1) + 1))) / - // strides[0] + - // 1, - // output_depth, - // "input_depth and output_depth are " - // "mismatching."); - // PADDLE_ENFORCE_EQ((input_height + 2 * paddings[1] - - // ((dilations[1] * (filter_height - 1) + 1))) / - // strides[1] + - // 1, - // output_height, - // "input_height and output_height are " - // "mismatching."); - // PADDLE_ENFORCE_EQ((input_width + 2 * paddings[2] - - // ((dilations[2] * (filter_width - 1) + 1))) / - // strides[2] + - // 1, - // output_width, - // "input_width and output_width are " - // "mismatching."); - T *vol_data = vol->data(); - const T *col_data = col.data(); - - for (int c = 0; c < channels_col; ++c) { - int w_offset = c % filter_width; - int h_offset = (c / filter_width) % filter_height; - int d_offset = (c / filter_width / filter_height) % filter_depth; - int cIm = c / filter_width / filter_height / filter_depth; - for (int d = 0; d < output_depth; ++d) { - int d_pad = d * strides[0] - paddings[0] + d_offset * dilations[0]; - for (int h = 0; h < output_height; ++h) { - int h_pad = h * strides[1] - paddings[1] + h_offset * dilations[1]; - for (int w = 0; w < output_width; ++w) { - int w_pad = w * strides[2] - paddings[2] + w_offset * dilations[2]; - - if (h_pad >= 0 && h_pad < input_height && w_pad >= 0 && - w_pad < input_width && d_pad >= 0 && d_pad < input_depth) { - int vol_idx = - ((cIm * input_depth + d_pad) * input_height + h_pad) * - input_width + - w_pad; - - int col_idx = - ((c * output_depth + d) * output_height + h) * output_width + - w; - vol_data[vol_idx] += col_data[col_idx]; - } - } - } - } - } - } -}; - -template class Vol2ColFunctor; -template class Vol2ColFunctor; -template class Col2VolFunctor; -template class Col2VolFunctor; - -} // namespace math -} // namespace operators + namespace operators { + namespace math { + + using Tensor = paddle_mobile::framework::Tensor; + /* + * vol = [input_channels, input_depth, input_height, input_width] + * col = + * [input_channels, filter_depth, filter_height, filter_width, + * output_depth, output_height, output_width] + */ + template class Vol2ColFunctor { + public: + void operator()(const Tensor &vol, + const std::vector &dilations, + const std::vector &strides, + const std::vector &paddings, + Tensor *col) const { + // PADDLE_ENFORCE(vol.dims().size() == 4); + // PADDLE_ENFORCE(col->dims().size() == 7); + + int input_channels = vol.dims()[0]; + int input_depth = vol.dims()[1]; + int input_height = vol.dims()[2]; + int input_width = vol.dims()[3]; + int filter_depth = col->dims()[1]; + int filter_height = col->dims()[2]; + int filter_width = col->dims()[3]; + int output_depth = col->dims()[4]; + int output_height = col->dims()[5]; + int output_width = col->dims()[6]; + int channels_col = input_channels * filter_depth * + filter_height * filter_width; + + // PADDLE_ENFORCE_EQ((input_depth + 2 * paddings[0] - + // ((dilations[0] * (filter_depth - 1) + // + 1))) / + // strides[0] + + // 1, + // output_depth, + // "input_depth and output_depth are " + // "mismatching."); + // PADDLE_ENFORCE_EQ((input_height + 2 * paddings[1] - + // ((dilations[1] * (filter_height - + // 1) + 1))) / + // strides[1] + + // 1, + // output_height, + // "input_height and output_height are + // " + // "mismatching."); + // PADDLE_ENFORCE_EQ((input_width + 2 * paddings[2] - + // ((dilations[2] * (filter_width - 1) + // + 1))) / + // strides[2] + + // 1, + // output_width, + // "input_width and output_width are " + // "mismatching."); + + const T *vol_data = vol.data(); + T *col_data = col->data(); + + for (int c = 0; c < channels_col; ++c) { + int w_offset = c % filter_width; + int h_offset = (c / filter_width) % filter_height; + int d_offset = + (c / filter_width / filter_height) % filter_depth; + int c_in = + c / filter_width / filter_height / filter_depth; + for (int d = 0; d < output_depth; ++d) { + int d_pad = d * strides[0] - paddings[0] + + d_offset * dilations[0]; + for (int h = 0; h < output_height; ++h) { + int h_pad = h * strides[1] - paddings[1] + + h_offset * dilations[1]; + for (int w = 0; w < output_width; ++w) { + int w_pad = w * strides[2] - paddings[2] + + w_offset * dilations[2]; + + int col_idx = ((c * output_depth + d) * + output_height + + h) * + output_width + + w; + int vol_idx = + ((c_in * input_depth + d_pad) * + input_height + + h_pad) * + input_width + + w_pad; + col_data[col_idx] = + (h_pad < 0 || h_pad >= input_height || + w_pad < 0 || w_pad >= input_width || + d_pad < 0 || d_pad >= input_depth) + ? static_cast(0) + : vol_data[vol_idx]; + } + } + } + } + } + }; + + /* + * vol = [input_channels,input_depth, input_height, input_width] + * col = + * [input_channels, filter_depth, filter_height, filter_width, + * output_depth, output_height, output_width] + */ + template class Col2VolFunctor { + public: + void operator()(const Tensor &col, + const std::vector &dilations, + const std::vector &strides, + const std::vector &paddings, + Tensor *vol) const { + // PADDLE_ENFORCE(vol->dims().size() == 4); + // PADDLE_ENFORCE(col.dims().size() == 7); + + int input_channels = vol->dims()[0]; + int input_depth = vol->dims()[1]; + int input_height = vol->dims()[2]; + int input_width = vol->dims()[3]; + int filter_depth = col.dims()[1]; + int filter_height = col.dims()[2]; + int filter_width = col.dims()[3]; + int output_depth = col.dims()[4]; + int output_height = col.dims()[5]; + int output_width = col.dims()[6]; + int channels_col = input_channels * filter_depth * + filter_height * filter_width; + + // PADDLE_ENFORCE_EQ((input_depth + 2 * paddings[0] - + // ((dilations[0] * (filter_depth - 1) + // + 1))) / + // strides[0] + + // 1, + // output_depth, + // "input_depth and output_depth are " + // "mismatching."); + // PADDLE_ENFORCE_EQ((input_height + 2 * paddings[1] - + // ((dilations[1] * (filter_height - + // 1) + 1))) / + // strides[1] + + // 1, + // output_height, + // "input_height and output_height are + // " + // "mismatching."); + // PADDLE_ENFORCE_EQ((input_width + 2 * paddings[2] - + // ((dilations[2] * (filter_width - 1) + // + 1))) / + // strides[2] + + // 1, + // output_width, + // "input_width and output_width are " + // "mismatching."); + T *vol_data = vol->data(); + const T *col_data = col.data(); + + for (int c = 0; c < channels_col; ++c) { + int w_offset = c % filter_width; + int h_offset = (c / filter_width) % filter_height; + int d_offset = + (c / filter_width / filter_height) % filter_depth; + int cIm = + c / filter_width / filter_height / filter_depth; + for (int d = 0; d < output_depth; ++d) { + int d_pad = d * strides[0] - paddings[0] + + d_offset * dilations[0]; + for (int h = 0; h < output_height; ++h) { + int h_pad = h * strides[1] - paddings[1] + + h_offset * dilations[1]; + for (int w = 0; w < output_width; ++w) { + int w_pad = w * strides[2] - paddings[2] + + w_offset * dilations[2]; + + if (h_pad >= 0 && h_pad < input_height && + w_pad >= 0 && w_pad < input_width && + d_pad >= 0 && d_pad < input_depth) { + int vol_idx = + ((cIm * input_depth + d_pad) * + input_height + + h_pad) * + input_width + + w_pad; + + int col_idx = ((c * output_depth + d) * + output_height + + h) * + output_width + + w; + vol_data[vol_idx] += col_data[col_idx]; + } + } + } + } + } + } + }; + + template class Vol2ColFunctor; + template class Vol2ColFunctor; + template class Col2VolFunctor; + template class Col2VolFunctor; + + } // namespace math + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/math/vol2col.h b/src/operators/math/vol2col.h index 07424825f18077f4338f73a576e1d55faefe9f40..900906d1c46d128d43df7e79f0e078d85d9c938d 100644 --- a/src/operators/math/vol2col.h +++ b/src/operators/math/vol2col.h @@ -18,66 +18,78 @@ limitations under the License. */ #include "framework/tensor.h" namespace paddle_mobile { -namespace operators { -namespace math { -/* - * \brief Converts the feature data of four dimensions(CDHW) into a colData of - * seven dimensions in the Vol2ColFunctor calculation, - * And in the Col2VolFunctor calculation, it is reversed. - * - * \param volData Vol data. - * \param volShape The shape of volData, - * [input_channels, input_depth, input_height, input_width]. - * \param colData Column data. - * \param colShape The shape of colData. - * - * \param dilations dilation data. - * \param 3-dimension [dilation_depth, dilation_height, dilation_width]. - * - * \param strides stride data. - * \param 3-dimension [stride_depth, stride_height, stride_width]. - * - * \param paddings padding data. - * \param 3-dimension [d_pad, h_pad, w_pad]. - * - * The shape of colData is: - * [input_channels, filter_depth, filter_height, filter_width, output_depth, - * output_height, output_width] - * So, it is easy to reshape into a convolution matrix for convolution - * calculation based on matrix multiplication. - * The shape of convolution matrix is [height, width], where the height is equal - * input_channels * filter_depth * filter_height * filter_width, and the width - * is equal output_depth * output_height * output_width. - * - * Reshape: - * shape of colData shape of convolution matrix - * [input_channels, - * filter_depth, - * filter_height, - * filter_width, ======> [height, width] - * output_depth, - * output_height, - * output_width] - * - * \note The caller needs to ensure that volShape.inputChannels is equal to - * colShape.inputChannels. - */ -using Tensor = paddle_mobile::framework::Tensor; + namespace operators { + namespace math { + /* + * \brief Converts the feature data of four dimensions(CDHW) into a + * colData of + * seven dimensions in the Vol2ColFunctor calculation, + * And in the Col2VolFunctor calculation, it is reversed. + * + * \param volData Vol data. + * \param volShape The shape of volData, + * [input_channels, input_depth, input_height, + * input_width]. + * \param colData Column data. + * \param colShape The shape of colData. + * + * \param dilations dilation data. + * \param 3-dimension [dilation_depth, dilation_height, + * dilation_width]. + * + * \param strides stride data. + * \param 3-dimension [stride_depth, stride_height, stride_width]. + * + * \param paddings padding data. + * \param 3-dimension [d_pad, h_pad, w_pad]. + * + * The shape of colData is: + * [input_channels, filter_depth, filter_height, filter_width, + * output_depth, + * output_height, output_width] + * So, it is easy to reshape into a convolution matrix for + * convolution + * calculation based on matrix multiplication. + * The shape of convolution matrix is [height, width], where the + * height is equal + * input_channels * filter_depth * filter_height * filter_width, and + * the width + * is equal output_depth * output_height * output_width. + * + * Reshape: + * shape of colData shape of convolution matrix + * [input_channels, + * filter_depth, + * filter_height, + * filter_width, ======> [height, width] + * output_depth, + * output_height, + * output_width] + * + * \note The caller needs to ensure that volShape.inputChannels is + * equal to + * colShape.inputChannels. + */ + using Tensor = paddle_mobile::framework::Tensor; -template class Vol2ColFunctor { -public: - void operator()(const Tensor &vol, const std::vector &dilations, - const std::vector &strides, - const std::vector &paddings, Tensor *col) const; -}; + template class Vol2ColFunctor { + public: + void operator()(const Tensor &vol, + const std::vector &dilations, + const std::vector &strides, + const std::vector &paddings, + Tensor *col) const; + }; -template class Col2VolFunctor { -public: - void operator()(const Tensor &col, const std::vector &dilations, - const std::vector &strides, - const std::vector &paddings, Tensor *vol) const; -}; + template class Col2VolFunctor { + public: + void operator()(const Tensor &col, + const std::vector &dilations, + const std::vector &strides, + const std::vector &paddings, + Tensor *vol) const; + }; -} // namespace math -} // namespace operators + } // namespace math + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/op_param.cpp b/src/operators/op_param.cpp index 789ef86c469ac784c82a1fbebc560f2fcfd9f59f..3d3dcb61a381017fdb51fb78ed8a924b99fa304b 100644 --- a/src/operators/op_param.cpp +++ b/src/operators/op_param.cpp @@ -19,25 +19,26 @@ SOFTWARE. #include "op_param.h" namespace paddle_mobile { -namespace operators { + namespace operators { -std::ostream &operator<<(std::ostream &os, const ConvParam &conv_param) { - os << "parameter of conv: " << std::endl; - os << " stride: " - << " (" << conv_param.Strides()[0] << conv_param.Strides()[1] << ") " - << std::endl; - os << " paddings: " - << " (" << conv_param.Paddings()[0] << conv_param.Paddings()[1] << ") " - << std::endl; - os << " dilations: " - << " (" << conv_param.Dilations()[0] << conv_param.Dilations()[1] << ") " - << std::endl; - os << " groups: " << conv_param.Groups() << std::endl; - os << " input dims: " << conv_param.Input()->dims() << std::endl; - os << " filter dims: " << conv_param.Filter()->dims() << std::endl; - os << " output dims: " << conv_param.Output()->dims() << std::endl; - return os; -} + std::ostream &operator<<(std::ostream &os, + const ConvParam &conv_param) { + os << "parameter of conv: " << std::endl; + os << " stride: " + << " (" << conv_param.Strides()[0] << conv_param.Strides()[1] + << ") " << std::endl; + os << " paddings: " + << " (" << conv_param.Paddings()[0] << conv_param.Paddings()[1] + << ") " << std::endl; + os << " dilations: " + << " (" << conv_param.Dilations()[0] << conv_param.Dilations()[1] + << ") " << std::endl; + os << " groups: " << conv_param.Groups() << std::endl; + os << " input dims: " << conv_param.Input()->dims() << std::endl; + os << " filter dims: " << conv_param.Filter()->dims() << std::endl; + os << " output dims: " << conv_param.Output()->dims() << std::endl; + return os; + } -} // namespace operators + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/op_param.h b/src/operators/op_param.h index 01463008a8f208c4bc894e747f0c6d11abe52d7a..9160cdbf4b2bf864adfbfc7d230e7358f951b95c 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -25,86 +25,92 @@ SOFTWARE. #include "framework/variable.h" namespace paddle_mobile { -namespace operators { - -using namespace framework; - -class OpParam : PaddleMobileObject { -public: -protected: - template - static T *InputFrom(const VariableNameMap &inputs, const Scope &scope) { - return GetVarValue("Input", inputs, scope); - } - - template - static T *OutputFrom(const VariableNameMap &outputs, const Scope &scope) { - return GetVarValue("Output", outputs, scope); - } - - template - static T *FilterFrom(const VariableNameMap &inputs, const Scope &scope) { - return GetVarValue("Filter", inputs, scope); - } - - template - static const T GetAttr(std::string key, const AttributeMap &map) { - return ((Attribute)map.at(key)).Get(); - } - - template - static T *GetVarValue(std::string key, const VariableNameMap &var_map, - const Scope &scope) { - auto var_vec = var_map.at(key); - if (var_vec.size()) { - // std::cout << " get var value -- " << var_vec[0] << std::endl; - auto var = scope.FindVar(var_vec[0]); - return var->GetMutable(); - } else { - return nullptr; - } - } -}; - -class ConvParam : OpParam { -public: - ConvParam(const VariableNameMap &inputs, const VariableNameMap &outputs, - const framework::AttributeMap &attrs, - const framework::Scope &scope) { - filter_ = FilterFrom(inputs, scope); - input_ = InputFrom(inputs, scope); - output_ = OutputFrom(outputs, scope); - strides_ = GetAttr>("strides", attrs); - paddings_ = GetAttr>("paddings", attrs); - dilations_ = GetAttr>("dilations", attrs); - groups = GetAttr("groups", attrs); - } - - const Tensor *Input() const { return input_; } - - const LoDTensor *Filter() const { return filter_; } - - Tensor *Output() const { return output_; } - - const std::vector &Strides() const { return strides_; } - - const std::vector &Paddings() const { return paddings_; } - - const std::vector &Dilations() const { return dilations_; } - - const int &Groups() const { return groups; } - -private: - Tensor *input_; - Tensor *output_; - LoDTensor *filter_; - std::vector strides_; - std::vector paddings_; - std::vector dilations_; - int groups; -}; - -std::ostream &operator<<(std::ostream &os, const ConvParam &conv_param); - -} // namespace operators + namespace operators { + + using namespace framework; + + class OpParam : PaddleMobileObject { + public: + protected: + template + static T *InputFrom(const VariableNameMap &inputs, + const Scope &scope) { + return GetVarValue("Input", inputs, scope); + } + + template + static T *OutputFrom(const VariableNameMap &outputs, + const Scope &scope) { + return GetVarValue("Output", outputs, scope); + } + + template + static T *FilterFrom(const VariableNameMap &inputs, + const Scope &scope) { + return GetVarValue("Filter", inputs, scope); + } + + template + static const T GetAttr(std::string key, const AttributeMap &map) { + return ((Attribute)map.at(key)).Get(); + } + + template + static T *GetVarValue(std::string key, + const VariableNameMap &var_map, + const Scope &scope) { + auto var_vec = var_map.at(key); + if (var_vec.size()) { + // std::cout << " get var value -- " << var_vec[0] << + // std::endl; + auto var = scope.FindVar(var_vec[0]); + return var->GetMutable(); + } else { + return nullptr; + } + } + }; + + class ConvParam : OpParam { + public: + ConvParam(const VariableNameMap &inputs, + const VariableNameMap &outputs, + const framework::AttributeMap &attrs, + const framework::Scope &scope) { + filter_ = FilterFrom(inputs, scope); + input_ = InputFrom(inputs, scope); + output_ = OutputFrom(outputs, scope); + strides_ = GetAttr>("strides", attrs); + paddings_ = GetAttr>("paddings", attrs); + dilations_ = GetAttr>("dilations", attrs); + groups = GetAttr("groups", attrs); + } + + const Tensor *Input() const { return input_; } + + const LoDTensor *Filter() const { return filter_; } + + Tensor *Output() const { return output_; } + + const std::vector &Strides() const { return strides_; } + + const std::vector &Paddings() const { return paddings_; } + + const std::vector &Dilations() const { return dilations_; } + + const int &Groups() const { return groups; } + + private: + Tensor *input_; + Tensor *output_; + LoDTensor *filter_; + std::vector strides_; + std::vector paddings_; + std::vector dilations_; + int groups; + }; + + std::ostream &operator<<(std::ostream &os, const ConvParam &conv_param); + + } // namespace operators } // namespace paddle_mobile diff --git a/src/platform/data_type.h b/src/platform/data_type.h index 4d821e84654193d48ae2668a613ddafc08303345..a2bc01f8a07485e270617a216008c3464750a124 100644 --- a/src/platform/data_type.h +++ b/src/platform/data_type.h @@ -19,106 +19,107 @@ limitations under the License. */ #include namespace paddle_mobile { -namespace framework { + namespace framework { -inline proto::VarType::Type ToDataType(std::type_index type) { - /*if (typeid(platform::float16).hash_code() == type.hash_code()) { - return proto::VarType::FP16; - } else */ - if (typeid(const float).hash_code() == type.hash_code()) { - // CPPLint complains Using C-style cast. Use static_cast() instead - // One fix to this is to replace float with const float because - // typeid(T) == typeid(const T) - // http://en.cppreference.com/w/cpp/language/typeid - return proto::VarType::FP32; - } else if (typeid(const double).hash_code() == type.hash_code()) { - return proto::VarType::FP64; - } else if (typeid(const int).hash_code() == type.hash_code()) { - return proto::VarType::INT32; - } else if (typeid(const int64_t).hash_code() == type.hash_code()) { - return proto::VarType::INT64; - } else if (typeid(const bool).hash_code() == type.hash_code()) { - return proto::VarType::BOOL; - } else { - // PADDLE_THROW("Not supported"); - // std::cout << "Not supported"; - } -} + inline proto::VarType::Type ToDataType(std::type_index type) { + /*if (typeid(platform::float16).hash_code() == type.hash_code()) { + return proto::VarType::FP16; + } else */ + if (typeid(const float).hash_code() == type.hash_code()) { + // CPPLint complains Using C-style cast. Use + // static_cast() instead + // One fix to this is to replace float with const float because + // typeid(T) == typeid(const T) + // http://en.cppreference.com/w/cpp/language/typeid + return proto::VarType::FP32; + } else if (typeid(const double).hash_code() == type.hash_code()) { + return proto::VarType::FP64; + } else if (typeid(const int).hash_code() == type.hash_code()) { + return proto::VarType::INT32; + } else if (typeid(const int64_t).hash_code() == type.hash_code()) { + return proto::VarType::INT64; + } else if (typeid(const bool).hash_code() == type.hash_code()) { + return proto::VarType::BOOL; + } else { + // PADDLE_THROW("Not supported"); + // std::cout << "Not supported"; + } + } -inline std::type_index ToTypeIndex(proto::VarType::Type type) { - switch (type) { - // case proto::VarType::FP16: - // return typeid(platform::float16); - case proto::VarType::FP32: - return typeid(float); - case proto::VarType::FP64: - return typeid(double); - case proto::VarType::INT32: - return typeid(int); - case proto::VarType::INT64: - return typeid(int64_t); - case proto::VarType::BOOL: - return typeid(bool); - default: - // PADDLE_THROW("Not support type %d", type); - printf("Not support type %d", type); - } -} + inline std::type_index ToTypeIndex(proto::VarType::Type type) { + switch (type) { + // case proto::VarType::FP16: + // return typeid(platform::float16); + case proto::VarType::FP32: + return typeid(float); + case proto::VarType::FP64: + return typeid(double); + case proto::VarType::INT32: + return typeid(int); + case proto::VarType::INT64: + return typeid(int64_t); + case proto::VarType::BOOL: + return typeid(bool); + default: + // PADDLE_THROW("Not support type %d", type); + printf("Not support type %d", type); + } + } -template -inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { - switch (type) { - // case proto::VarType::FP16: - // visitor.template operator()(); - // break; - case proto::VarType::FP32: - visitor.template operator()(); - break; - case proto::VarType::FP64: - visitor.template operator()(); - break; - case proto::VarType::INT32: - visitor.template operator()(); - break; - case proto::VarType::INT64: - visitor.template operator()(); - break; - case proto::VarType::BOOL: - visitor.template operator()(); - break; - default: - // PADDLE_THROW("Not supported"); - printf("Not supported"); - } -} + template + inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { + switch (type) { + // case proto::VarType::FP16: + // visitor.template operator()(); + // break; + case proto::VarType::FP32: + visitor.template operator()(); + break; + case proto::VarType::FP64: + visitor.template operator()(); + break; + case proto::VarType::INT32: + visitor.template operator()(); + break; + case proto::VarType::INT64: + visitor.template operator()(); + break; + case proto::VarType::BOOL: + visitor.template operator()(); + break; + default: + // PADDLE_THROW("Not supported"); + printf("Not supported"); + } + } -inline std::string DataTypeToString(const proto::VarType::Type type) { - switch (type) { - case proto::VarType::FP16: - return "float16"; - case proto::VarType::FP32: - return "float32"; - case proto::VarType::FP64: - return "float64"; - case proto::VarType::INT16: - return "int16"; - case proto::VarType::INT32: - return "int32"; - case proto::VarType::INT64: - return "int64"; - case proto::VarType::BOOL: - return "bool"; - default: - // PADDLE_THROW("Not support type %d", type); - printf("Not support type %d", type); - } -} + inline std::string DataTypeToString(const proto::VarType::Type type) { + switch (type) { + case proto::VarType::FP16: + return "float16"; + case proto::VarType::FP32: + return "float32"; + case proto::VarType::FP64: + return "float64"; + case proto::VarType::INT16: + return "int16"; + case proto::VarType::INT32: + return "int32"; + case proto::VarType::INT64: + return "int64"; + case proto::VarType::BOOL: + return "bool"; + default: + // PADDLE_THROW("Not support type %d", type); + printf("Not support type %d", type); + } + } -inline std::ostream &operator<<(std::ostream &out, - const proto::VarType::Type &type) { - out << DataTypeToString(type); - return out; -} + inline std::ostream &operator<<(std::ostream &out, + const proto::VarType::Type &type) { + out << DataTypeToString(type); + return out; + } -} // namespace framework + } // namespace framework } // namespace paddle_mobile diff --git a/src/platform/macros.h b/src/platform/macros.h index 2f81e9409625dfb11b9d438f1ee531fa710f4f6b..f34b8a7dc91fb783995fb0f4fdf001231c741a52 100644 --- a/src/platform/macros.h +++ b/src/platform/macros.h @@ -17,9 +17,9 @@ limitations under the License. */ // Disable the copy and assignment operator for a class. #ifndef DISABLE_COPY_AND_ASSIGN #define DISABLE_COPY_AND_ASSIGN(classname) \ -private: \ - classname(const classname &) = delete; \ - classname(classname &&) = delete; \ - classname &operator=(const classname &) = delete; \ - classname &operator=(classname &&) = delete + private: \ + classname(const classname &) = delete; \ + classname(classname &&) = delete; \ + classname &operator=(const classname &) = delete; \ + classname &operator=(classname &&) = delete #endif diff --git a/android-cmake/android.toolchain.cmake b/tools/android-cmake/android.toolchain.cmake similarity index 100% rename from android-cmake/android.toolchain.cmake rename to tools/android-cmake/android.toolchain.cmake diff --git a/ios-cmake/ios.toolchain.cmake b/tools/ios-cmake/ios.toolchain.cmake similarity index 100% rename from ios-cmake/ios.toolchain.cmake rename to tools/ios-cmake/ios.toolchain.cmake diff --git a/.clang_format.hook b/tools/pre-commit.hooks/.clang_format.hook similarity index 100% rename from .clang_format.hook rename to tools/pre-commit.hooks/.clang_format.hook diff --git a/tools/pre-commit.hooks/.copyright.hook b/tools/pre-commit.hooks/.copyright.hook new file mode 100644 index 0000000000000000000000000000000000000000..7e02c05b1434fed830e11ca518aa19457633af89 --- /dev/null +++ b/tools/pre-commit.hooks/.copyright.hook @@ -0,0 +1,124 @@ +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import io, re +import sys, os +import subprocess +import platform + +COPYRIGHT = ''' +Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +''' + +LANG_COMMENT_MARK = None + +NEW_LINE_MARK = None + +COPYRIGHT_HEADER = None + +if platform.system() == "Windows": + NEW_LINE_MARK = "\r\n" +else: + NEW_LINE_MARK = '\n' + COPYRIGHT_HEADER = COPYRIGHT.split(NEW_LINE_MARK)[1] + p = re.search('(\d{4})', COPYRIGHT_HEADER).group(0) + process = subprocess.Popen(["date", "+%Y"], stdout=subprocess.PIPE) + date, err = process.communicate() + date = date.decode("utf-8").rstrip("\n") + COPYRIGHT_HEADER = COPYRIGHT_HEADER.replace(p, date) + + +def generate_copyright(template, lang='C'): + if lang == 'Python': + LANG_COMMENT_MARK = '#' + else: + LANG_COMMENT_MARK = "//" + + lines = template.split(NEW_LINE_MARK) + BLANK = " " + ans = LANG_COMMENT_MARK + BLANK + COPYRIGHT_HEADER + NEW_LINE_MARK + for lino, line in enumerate(lines): + if lino == 0 or lino == 1 or lino == len(lines) - 1: continue + if len(line) == 0: + BLANK = "" + else: + BLANK = " " + ans += LANG_COMMENT_MARK + BLANK + line + NEW_LINE_MARK + + return ans + "\n" + + +def lang_type(filename): + if filename.endswith(".py"): + return "Python" + elif filename.endswith(".h"): + return "C" + elif filename.endswith(".c"): + return "C" + elif filename.endswith(".hpp"): + return "C" + elif filename.endswith(".cc"): + return "C" + elif filename.endswith(".cpp"): + return "C" + elif filename.endswith(".cu"): + return "C" + elif filename.endswith(".cuh"): + return "C" + elif filename.endswith(".go"): + return "C" + elif filename.endswith(".proto"): + return "C" + else: + print("Unsupported filetype %s", filename) + exit(0) + + +PYTHON_ENCODE = re.compile("^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)") + + +def main(argv=None): + parser = argparse.ArgumentParser( + description='Checker for copyright declaration.') + parser.add_argument('filenames', nargs='*', help='Filenames to check') + args = parser.parse_args(argv) + + retv = 0 + for filename in args.filenames: + fd = io.open(filename, encoding="utf-8") + first_line = fd.readline() + second_line = fd.readline() + if "COPYRIGHT (C)" in first_line.upper(): continue + if first_line.startswith("#!") or PYTHON_ENCODE.match( + second_line) != None or PYTHON_ENCODE.match(first_line) != None: + continue + original_contents = io.open(filename, encoding="utf-8").read() + new_contents = generate_copyright( + COPYRIGHT, lang_type(filename)) + original_contents + print('Auto Insert Copyright Header {}'.format(filename)) + retv = 1 + with io.open(filename, 'w') as output_file: + output_file.write(new_contents) + + return retv + + +if __name__ == '__main__': + exit(main()) diff --git a/tools/pre-commit.hooks/clang-format.bash b/tools/pre-commit.hooks/clang-format.bash new file mode 100755 index 0000000000000000000000000000000000000000..dabb7db48dbe2779fffb378c8d6ba8e2e4c796fd --- /dev/null +++ b/tools/pre-commit.hooks/clang-format.bash @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +readonly VERSION="version 3." + +version=$(clang-format -version) + +if ! [[ $version == *"$VERSION"* ]]; then + echo "clang-format version check failed." + echo "a version contains '$VERSION' is needed, but get '$version'" + echo "you can install the right version, and make an soft-link to '\$PATH' env" + exit -1 +fi + +clang-format $@ diff --git a/tools/pre-commit.hooks/copyright.py b/tools/pre-commit.hooks/copyright.py new file mode 100755 index 0000000000000000000000000000000000000000..50fc860ee2f3802abff5f61b19979f40f12bb821 --- /dev/null +++ b/tools/pre-commit.hooks/copyright.py @@ -0,0 +1,143 @@ +# Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import io, re +import sys, os +import subprocess +import platform + +COPYRIGHT = ''' +/* Copyright (c) 2016 Baidu, Inc. All Rights Reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +==============================================================================*/ +''' + +LANG_COMMENT_MARK = None + +NEW_LINE_MARK = None + +COPYRIGHT_HEADER = None + +if platform.system() == "Windows": + NEW_LINE_MARK = "\r\n" +else: + NEW_LINE_MARK = '\n' + COPYRIGHT_HEADER = COPYRIGHT.split(NEW_LINE_MARK)[1] + p = re.search('(\d{4})', COPYRIGHT_HEADER).group(0) + process = subprocess.Popen(["date", "+%Y"], stdout=subprocess.PIPE) + date, err = process.communicate() + date = date.decode("utf-8").rstrip("\n") + COPYRIGHT_HEADER = COPYRIGHT_HEADER.replace(p, date) + + +def generate_copyright(template, lang='C'): + if lang == 'Python': + LANG_COMMENT_MARK = '#' + else: + LANG_COMMENT_MARK = "//" + + lines = template.split(NEW_LINE_MARK) + BLANK = " " + ans = LANG_COMMENT_MARK + BLANK + COPYRIGHT_HEADER + NEW_LINE_MARK + for lino, line in enumerate(lines): + if lino == 0 or lino == 1 or lino == len(lines) - 1: continue + if len(line) == 0: + BLANK = "" + else: + BLANK = " " + ans += LANG_COMMENT_MARK + BLANK + line + NEW_LINE_MARK + + return ans + "\n" + + +def lang_type(filename): + if filename.endswith(".py"): + return "Python" + elif filename.endswith(".h"): + return "C" + elif filename.endswith(".c"): + return "C" + elif filename.endswith(".hpp"): + return "C" + elif filename.endswith(".cc"): + return "C" + elif filename.endswith(".cpp"): + return "C" + elif filename.endswith(".cu"): + return "C" + elif filename.endswith(".cuh"): + return "C" + elif filename.endswith(".go"): + return "C" + elif filename.endswith(".proto"): + return "C" + else: + print("Unsupported filetype %s", filename) + exit(0) + + +PYTHON_ENCODE = re.compile("^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)") + + +def main(argv=None): + parser = argparse.ArgumentParser( + description='Checker for copyright declaration.') + parser.add_argument('filenames', nargs='*', help='Filenames to check') + args = parser.parse_args(argv) + + retv = 0 + for filename in args.filenames: + fd = io.open(filename, encoding="utf-8") + first_line = fd.readline() + second_line = fd.readline() + if "COPYRIGHT " in first_line.upper(): continue + if first_line.startswith("#!") or PYTHON_ENCODE.match( + second_line) != None or PYTHON_ENCODE.match( + first_line) != None: + continue + original_contents = io.open(filename, encoding="utf-8").read() + new_contents = generate_copyright( + COPYRIGHT, lang_type(filename)) + original_contents + print('Auto Insert Copyright Header {}'.format(filename)) + retv = 1 + with io.open(filename, 'w') as output_file: + output_file.write(new_contents) + + return retv + + +if __name__ == '__main__': + exit(main()) diff --git a/tools/pre-commit.hooks/cpplint.bash b/tools/pre-commit.hooks/cpplint.bash new file mode 100755 index 0000000000000000000000000000000000000000..d3ec20f13f601488fe12a120dfbbd6e917a7e3f5 --- /dev/null +++ b/tools/pre-commit.hooks/cpplint.bash @@ -0,0 +1,13 @@ +#!/bin/bash + +TOTAL_ERRORS=0 + +#iclang-tidy *.[ch]pp -checks=* +# The trick to remove deleted files: https://stackoverflow.com/a/2413151 +for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}'|grep -v ".pb." | grep -v "third-party/"); do + cpplint $file + TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?); +done + +exit $TOTAL_ERRORS +