diff --git a/CMakeLists.txt b/CMakeLists.txt index 34b7365615b2840a26fe21268cfabb623aa20c7d..a9382f9697e5c39c7e7195b94fc5332d39dc18a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.0) project(paddle-mobile) -add_definitions(-std=c++11) add_definitions(-DPADDLE_MOBILE_DEBUG="true") - +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_BUILD_TYPE RelWithDebInfo) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -11,7 +10,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build) -file(GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp) +file(GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp src/*.c) file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h) # include headers @@ -28,26 +27,12 @@ include_directories(src/) # INSTALL_COMMAND "make" "PREFIX=${CMAKE_BINARY_DIR}/" "install" # ) #set_target_properties(openblas_proj PROPERTIES EXCLUDE_FROM_ALL 1) -# link protobuf -include_directories(third-party/protobuf/include) -if (ANDROID) - link_directories(third-party/protobuf/armeabi-v7a) -else() - # link openblas - link_directories(third-party/protobuf/lib) -endif () #add_dependencies(paddle-mobile openblas_proj) # gen static ADD_LIBRARY(paddle-mobile SHARED ${PADDLE_MOBILE_CC} ${PADDLE_MOBILE_H}) -if (ANDROID) - # openblas.a need log lib - target_link_libraries(paddle-mobile protobuf-lite) -else() - target_link_libraries(paddle-mobile protobuf-lite) -endif () #add_dependencies(paddle-mobile openblas_proj) -add_subdirectory(test) \ No newline at end of file +add_subdirectory(test) diff --git a/src/common/log.h b/src/common/log.h index 2fae3d25b5dd6253ad708c3c55b8f706fb1174ea..052fb7df2ba74177205ef26cbebbc88c08e03e09 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -170,7 +170,7 @@ struct ToLog { template Print &operator<<(Print &printer, const std::vector &v) { - printer << "[\n "; + printer << "[ "; for (int i = 0; i < v.size(); ++i) { const auto &value = v[i]; @@ -179,7 +179,7 @@ Print &operator<<(Print &printer, const std::vector &v) { printer << "\n"; } } - printer << " \n]"; + printer << " ]"; return printer; } diff --git a/src/common/protobuf-c.c b/src/common/protobuf-c.c new file mode 100644 index 0000000000000000000000000000000000000000..fd0e3d80a21282fe7bb600c2fdb174411fa315a3 --- /dev/null +++ b/src/common/protobuf-c.c @@ -0,0 +1,2784 @@ +/* + * Copyright (c) 2008-2015, Dave Benson and the protobuf-c authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * Support library for `protoc-c` generated code. + * + * This file implements the public API used by the code generated + * by `protoc-c`. + * + * \authors Dave Benson and the protobuf-c authors + * + * \copyright 2008-2014. Licensed under the terms of the [BSD-2-Clause] license. + */ + +/** + * \todo 64-BIT OPTIMIZATION: certain implementations use 32-bit math + * even on 64-bit platforms (uint64_size, uint64_pack, parse_uint64). + * + * \todo Use size_t consistently. + */ + +#include /* for malloc, free */ +#include /* for strcmp, strlen, memcpy, memmove, memset */ + +#include "protobuf-c.h" + +#define TRUE 1 +#define FALSE 0 + +#define PROTOBUF_C__ASSERT_NOT_REACHED() assert(0) + +/* Workaround for Microsoft compilers. */ +#ifdef _MSC_VER +#define inline __inline +#endif + +/** + * \defgroup internal Internal functions and macros + * + * These are not exported by the library but are useful to developers working + * on `libprotobuf-c` itself. + */ + +/** + * \defgroup macros Utility macros for manipulating structures + * + * Macros and constants used to manipulate the base "classes" generated by + * `protobuf-c`. They also define limits and check correctness. + * + * \ingroup internal + * @{ + */ + +/** The maximum length of a 64-bit integer in varint encoding. */ +#define MAX_UINT64_ENCODED_SIZE 10 + +#ifndef PROTOBUF_C_UNPACK_ERROR +#define PROTOBUF_C_UNPACK_ERROR(...) +#endif + +const char protobuf_c_empty_string[] = ""; + +/** + * Internal `ProtobufCMessage` manipulation macro. + * + * Base macro for manipulating a `ProtobufCMessage`. Used by STRUCT_MEMBER() and + * STRUCT_MEMBER_PTR(). + */ +#define STRUCT_MEMBER_P(struct_p, struct_offset) \ + ((void *)((uint8_t *)(struct_p) + (struct_offset))) + +/** + * Return field in a `ProtobufCMessage` based on offset. + * + * Take a pointer to a `ProtobufCMessage` and find the field at the offset. + * Cast it to the passed type. + */ +#define STRUCT_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type *)STRUCT_MEMBER_P((struct_p), (struct_offset))) + +/** + * Return field in a `ProtobufCMessage` based on offset. + * + * Take a pointer to a `ProtobufCMessage` and find the field at the offset. Cast + * it to a pointer to the passed type. + */ +#define STRUCT_MEMBER_PTR(member_type, struct_p, struct_offset) \ + ((member_type *)STRUCT_MEMBER_P((struct_p), (struct_offset))) + +/* Assertions for magic numbers. */ + +#define ASSERT_IS_ENUM_DESCRIPTOR(desc) \ + assert((desc)->magic == PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC) + +#define ASSERT_IS_MESSAGE_DESCRIPTOR(desc) \ + assert((desc)->magic == PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC) + +#define ASSERT_IS_MESSAGE(message) \ + ASSERT_IS_MESSAGE_DESCRIPTOR((message)->descriptor) + +#define ASSERT_IS_SERVICE_DESCRIPTOR(desc) \ + assert((desc)->magic == PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC) + +/**@}*/ + +/* --- version --- */ + +const char *protobuf_c_version(void) { return PROTOBUF_C_VERSION; } + +uint32_t protobuf_c_version_number(void) { return PROTOBUF_C_VERSION_NUMBER; } + +/* --- allocator --- */ + +static void *system_alloc(void *allocator_data, size_t size) { + return malloc(size); +} + +static void system_free(void *allocator_data, void *data) { free(data); } + +static inline void *do_alloc(ProtobufCAllocator *allocator, size_t size) { + return allocator->alloc(allocator->allocator_data, size); +} + +static inline void do_free(ProtobufCAllocator *allocator, void *data) { + if (data != NULL) allocator->free(allocator->allocator_data, data); +} + +/* + * This allocator uses the system's malloc() and free(). It is the default + * allocator used if NULL is passed as the ProtobufCAllocator to an exported + * function. + */ +static ProtobufCAllocator protobuf_c__allocator = { + .alloc = &system_alloc, + .free = &system_free, + .allocator_data = NULL, +}; + +/* === buffer-simple === */ + +void protobuf_c_buffer_simple_append(ProtobufCBuffer *buffer, size_t len, + const uint8_t *data) { + ProtobufCBufferSimple *simp = (ProtobufCBufferSimple *)buffer; + size_t new_len = simp->len + len; + + if (new_len > simp->alloced) { + ProtobufCAllocator *allocator = simp->allocator; + size_t new_alloced = simp->alloced * 2; + uint8_t *new_data; + + if (allocator == NULL) allocator = &protobuf_c__allocator; + while (new_alloced < new_len) new_alloced += new_alloced; + new_data = do_alloc(allocator, new_alloced); + if (!new_data) return; + memcpy(new_data, simp->data, simp->len); + if (simp->must_free_data) + do_free(allocator, simp->data); + else + simp->must_free_data = TRUE; + simp->data = new_data; + simp->alloced = new_alloced; + } + memcpy(simp->data + simp->len, data, len); + simp->len = new_len; +} + +/** + * \defgroup packedsz protobuf_c_message_get_packed_size() implementation + * + * Routines mainly used by protobuf_c_message_get_packed_size(). + * + * \ingroup internal + * @{ + */ + +/** + * Return the number of bytes required to store the tag for the field. Includes + * 3 bits for the wire-type, and a single bit that denotes the end-of-tag. + * + * \param number + * Field tag to encode. + * \return + * Number of bytes required. + */ +static inline size_t get_tag_size(uint32_t number) { + if (number < (1UL << 4)) { + return 1; + } else if (number < (1UL << 11)) { + return 2; + } else if (number < (1UL << 18)) { + return 3; + } else if (number < (1UL << 25)) { + return 4; + } else { + return 5; + } +} + +/** + * Return the number of bytes required to store a variable-length unsigned + * 32-bit integer in base-128 varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t uint32_size(uint32_t v) { + if (v < (1UL << 7)) { + return 1; + } else if (v < (1UL << 14)) { + return 2; + } else if (v < (1UL << 21)) { + return 3; + } else if (v < (1UL << 28)) { + return 4; + } else { + return 5; + } +} + +/** + * Return the number of bytes required to store a variable-length signed 32-bit + * integer in base-128 varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t int32_size(int32_t v) { + if (v < 0) { + return 10; + } else if (v < (1L << 7)) { + return 1; + } else if (v < (1L << 14)) { + return 2; + } else if (v < (1L << 21)) { + return 3; + } else if (v < (1L << 28)) { + return 4; + } else { + return 5; + } +} + +/** + * Return the ZigZag-encoded 32-bit unsigned integer form of a 32-bit signed + * integer. + * + * \param v + * Value to encode. + * \return + * ZigZag encoded integer. + */ +static inline uint32_t zigzag32(int32_t v) { + if (v < 0) + return (-(uint32_t)v) * 2 - 1; + else + return (uint32_t)(v)*2; +} + +/** + * Return the number of bytes required to store a signed 32-bit integer, + * converted to an unsigned 32-bit integer with ZigZag encoding, using base-128 + * varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t sint32_size(int32_t v) { return uint32_size(zigzag32(v)); } + +/** + * Return the number of bytes required to store a 64-bit unsigned integer in + * base-128 varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t uint64_size(uint64_t v) { + uint32_t upper_v = (uint32_t)(v >> 32); + + if (upper_v == 0) { + return uint32_size((uint32_t)v); + } else if (upper_v < (1UL << 3)) { + return 5; + } else if (upper_v < (1UL << 10)) { + return 6; + } else if (upper_v < (1UL << 17)) { + return 7; + } else if (upper_v < (1UL << 24)) { + return 8; + } else if (upper_v < (1UL << 31)) { + return 9; + } else { + return 10; + } +} + +/** + * Return the ZigZag-encoded 64-bit unsigned integer form of a 64-bit signed + * integer. + * + * \param v + * Value to encode. + * \return + * ZigZag encoded integer. + */ +static inline uint64_t zigzag64(int64_t v) { + if (v < 0) + return (-(uint64_t)v) * 2 - 1; + else + return (uint64_t)(v)*2; +} + +/** + * Return the number of bytes required to store a signed 64-bit integer, + * converted to an unsigned 64-bit integer with ZigZag encoding, using base-128 + * varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t sint64_size(int64_t v) { return uint64_size(zigzag64(v)); } + +/** + * Calculate the serialized size of a single required message field, including + * the space needed by the preceding tag. + * + * \param field + * Field descriptor for member. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t required_field_get_packed_size( + const ProtobufCFieldDescriptor *field, const void *member) { + size_t rv = get_tag_size(field->id); + + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + return rv + sint32_size(*(const int32_t *)member); + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + return rv + int32_size(*(const int32_t *)member); + case PROTOBUF_C_TYPE_UINT32: + return rv + uint32_size(*(const uint32_t *)member); + case PROTOBUF_C_TYPE_SINT64: + return rv + sint64_size(*(const int64_t *)member); + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + return rv + uint64_size(*(const uint64_t *)member); + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + return rv + 4; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + return rv + 8; + case PROTOBUF_C_TYPE_BOOL: + return rv + 1; + case PROTOBUF_C_TYPE_FLOAT: + return rv + 4; + case PROTOBUF_C_TYPE_DOUBLE: + return rv + 8; + case PROTOBUF_C_TYPE_STRING: { + const char *str = *(char *const *)member; + size_t len = str ? strlen(str) : 0; + return rv + uint32_size(len) + len; + } + case PROTOBUF_C_TYPE_BYTES: { + size_t len = ((const ProtobufCBinaryData *)member)->len; + return rv + uint32_size(len) + len; + } + case PROTOBUF_C_TYPE_MESSAGE: { + const ProtobufCMessage *msg = *(ProtobufCMessage *const *)member; + size_t subrv = msg ? protobuf_c_message_get_packed_size(msg) : 0; + return rv + uint32_size(subrv) + subrv; + } + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Calculate the serialized size of a single oneof message field, including + * the space needed by the preceding tag. Returns 0 if the oneof field isn't + * selected or is not set. + * + * \param field + * Field descriptor for member. + * \param oneof_case + * Enum value that selects the field in the oneof. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t oneof_field_get_packed_size(const ProtobufCFieldDescriptor *field, + uint32_t oneof_case, + const void *member) { + if (oneof_case != field->id) { + return 0; + } + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) { + const void *ptr = *(const void *const *)member; + if (ptr == NULL || ptr == field->default_value) return 0; + } + return required_field_get_packed_size(field, member); +} + +/** + * Calculate the serialized size of a single optional message field, including + * the space needed by the preceding tag. Returns 0 if the optional field isn't + * set. + * + * \param field + * Field descriptor for member. + * \param has + * True if the field exists, false if not. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t optional_field_get_packed_size( + const ProtobufCFieldDescriptor *field, const protobuf_c_boolean has, + const void *member) { + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) { + const void *ptr = *(const void *const *)member; + if (ptr == NULL || ptr == field->default_value) return 0; + } else { + if (!has) return 0; + } + return required_field_get_packed_size(field, member); +} + +static protobuf_c_boolean field_is_zeroish( + const ProtobufCFieldDescriptor *field, const void *member) { + protobuf_c_boolean ret = FALSE; + + switch (field->type) { + case PROTOBUF_C_TYPE_BOOL: + ret = (0 == *(const protobuf_c_boolean *)member); + break; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + ret = (0 == *(const uint32_t *)member); + break; + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + ret = (0 == *(const uint64_t *)member); + break; + case PROTOBUF_C_TYPE_FLOAT: + ret = (0 == *(const float *)member); + break; + case PROTOBUF_C_TYPE_DOUBLE: + ret = (0 == *(const double *)member); + break; + case PROTOBUF_C_TYPE_STRING: + ret = (NULL == *(const char *const *)member) || + ('\0' == **(const char *const *)member); + break; + case PROTOBUF_C_TYPE_BYTES: + case PROTOBUF_C_TYPE_MESSAGE: + ret = (NULL == *(const void *const *)member); + break; + default: + ret = TRUE; + break; + } + + return ret; +} + +/** + * Calculate the serialized size of a single unlabeled message field, including + * the space needed by the preceding tag. Returns 0 if the field isn't set or + * if it is set to a "zeroish" value (null pointer or 0 for numerical values). + * Unlabeled fields are supported only in proto3. + * + * \param field + * Field descriptor for member. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t unlabeled_field_get_packed_size( + const ProtobufCFieldDescriptor *field, const void *member) { + if (field_is_zeroish(field, member)) return 0; + return required_field_get_packed_size(field, member); +} + +/** + * Calculate the serialized size of repeated message fields, which may consist + * of any number of values (including 0). Includes the space needed by the + * preceding tags (as needed). + * + * \param field + * Field descriptor for member. + * \param count + * Number of repeated field members. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t repeated_field_get_packed_size( + const ProtobufCFieldDescriptor *field, size_t count, const void *member) { + size_t header_size; + size_t rv = 0; + unsigned i; + void *array = *(void *const *)member; + + if (count == 0) return 0; + header_size = get_tag_size(field->id); + if (0 == (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED)) header_size *= count; + + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + for (i = 0; i < count; i++) rv += sint32_size(((int32_t *)array)[i]); + break; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + for (i = 0; i < count; i++) rv += int32_size(((int32_t *)array)[i]); + break; + case PROTOBUF_C_TYPE_UINT32: + for (i = 0; i < count; i++) rv += uint32_size(((uint32_t *)array)[i]); + break; + case PROTOBUF_C_TYPE_SINT64: + for (i = 0; i < count; i++) rv += sint64_size(((int64_t *)array)[i]); + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + for (i = 0; i < count; i++) rv += uint64_size(((uint64_t *)array)[i]); + break; + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + rv += 4 * count; + break; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + rv += 8 * count; + break; + case PROTOBUF_C_TYPE_BOOL: + rv += count; + break; + case PROTOBUF_C_TYPE_STRING: + for (i = 0; i < count; i++) { + size_t len = strlen(((char **)array)[i]); + rv += uint32_size(len) + len; + } + break; + case PROTOBUF_C_TYPE_BYTES: + for (i = 0; i < count; i++) { + size_t len = ((ProtobufCBinaryData *)array)[i].len; + rv += uint32_size(len) + len; + } + break; + case PROTOBUF_C_TYPE_MESSAGE: + for (i = 0; i < count; i++) { + size_t len = + protobuf_c_message_get_packed_size(((ProtobufCMessage **)array)[i]); + rv += uint32_size(len) + len; + } + break; + } + + if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED)) + header_size += uint32_size(rv); + return header_size + rv; +} + +/** + * Calculate the serialized size of an unknown field, i.e. one that is passed + * through mostly uninterpreted. This is required for forward compatibility if + * new fields are added to the message descriptor. + * + * \param field + * Unknown field type. + * \return + * Number of bytes required. + */ +static inline size_t unknown_field_get_packed_size( + const ProtobufCMessageUnknownField *field) { + return get_tag_size(field->tag) + field->len; +} + +/**@}*/ + +/* + * Calculate the serialized size of the message. + */ +size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message) { + unsigned i; + size_t rv = 0; + + ASSERT_IS_MESSAGE(message); + for (i = 0; i < message->descriptor->n_fields; i++) { + const ProtobufCFieldDescriptor *field = message->descriptor->fields + i; + const void *member = ((const char *)message) + field->offset; + const void *qmember = ((const char *)message) + field->quantifier_offset; + + if (field->label == PROTOBUF_C_LABEL_REQUIRED) { + rv += required_field_get_packed_size(field, member); + } else if ((field->label == PROTOBUF_C_LABEL_OPTIONAL || + field->label == PROTOBUF_C_LABEL_NONE) && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF))) { + rv += oneof_field_get_packed_size(field, *(const uint32_t *)qmember, + member); + } else if (field->label == PROTOBUF_C_LABEL_OPTIONAL) { + rv += optional_field_get_packed_size( + field, *(protobuf_c_boolean *)qmember, member); + } else if (field->label == PROTOBUF_C_LABEL_NONE) { + rv += unlabeled_field_get_packed_size(field, member); + } else { + rv += repeated_field_get_packed_size(field, *(const size_t *)qmember, + member); + } + } + for (i = 0; i < message->n_unknown_fields; i++) + rv += unknown_field_get_packed_size(&message->unknown_fields[i]); + return rv; +} + +/** + * \defgroup pack protobuf_c_message_pack() implementation + * + * Routines mainly used by protobuf_c_message_pack(). + * + * \ingroup internal + * @{ + */ + +/** + * Pack an unsigned 32-bit integer in base-128 varint encoding and return the + * number of bytes written, which must be 5 or less. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t uint32_pack(uint32_t value, uint8_t *out) { + unsigned rv = 0; + + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + } + } + } + } + /* assert: value<128 */ + out[rv++] = value; + return rv; +} + +/** + * Pack a signed 32-bit integer and return the number of bytes written. + * Negative numbers are encoded as two's complement 64-bit integers. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t int32_pack(int32_t value, uint8_t *out) { + if (value < 0) { + out[0] = value | 0x80; + out[1] = (value >> 7) | 0x80; + out[2] = (value >> 14) | 0x80; + out[3] = (value >> 21) | 0x80; + out[4] = (value >> 28) | 0x80; + out[5] = out[6] = out[7] = out[8] = 0xff; + out[9] = 0x01; + return 10; + } else { + return uint32_pack(value, out); + } +} + +/** + * Pack a signed 32-bit integer using ZigZag encoding and return the number of + * bytes written. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t sint32_pack(int32_t value, uint8_t *out) { + return uint32_pack(zigzag32(value), out); +} + +/** + * Pack a 64-bit unsigned integer using base-128 varint encoding and return the + * number of bytes written. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t uint64_pack(uint64_t value, uint8_t *out) { + uint32_t hi = (uint32_t)(value >> 32); + uint32_t lo = (uint32_t)value; + unsigned rv; + + if (hi == 0) return uint32_pack((uint32_t)lo, out); + out[0] = (lo) | 0x80; + out[1] = (lo >> 7) | 0x80; + out[2] = (lo >> 14) | 0x80; + out[3] = (lo >> 21) | 0x80; + if (hi < 8) { + out[4] = (hi << 4) | (lo >> 28); + return 5; + } else { + out[4] = ((hi & 7) << 4) | (lo >> 28) | 0x80; + hi >>= 3; + } + rv = 5; + while (hi >= 128) { + out[rv++] = hi | 0x80; + hi >>= 7; + } + out[rv++] = hi; + return rv; +} + +/** + * Pack a 64-bit signed integer in ZigZag encoding and return the number of + * bytes written. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t sint64_pack(int64_t value, uint8_t *out) { + return uint64_pack(zigzag64(value), out); +} + +/** + * Pack a 32-bit quantity in little-endian byte order. Used for protobuf wire + * types fixed32, sfixed32, float. Similar to "htole32". + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t fixed32_pack(uint32_t value, void *out) { +#if !defined(WORDS_BIGENDIAN) + memcpy(out, &value, 4); +#else + uint8_t *buf = out; + + buf[0] = value; + buf[1] = value >> 8; + buf[2] = value >> 16; + buf[3] = value >> 24; +#endif + return 4; +} + +/** + * Pack a 64-bit quantity in little-endian byte order. Used for protobuf wire + * types fixed64, sfixed64, double. Similar to "htole64". + * + * \todo The big-endian impl is really only good for 32-bit machines, a 64-bit + * version would be appreciated, plus a way to decide to use 64-bit math where + * convenient. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t fixed64_pack(uint64_t value, void *out) { +#if !defined(WORDS_BIGENDIAN) + memcpy(out, &value, 8); +#else + fixed32_pack(value, out); + fixed32_pack(value >> 32, ((char *)out) + 4); +#endif + return 8; +} + +/** + * Pack a boolean value as an integer and return the number of bytes written. + * + * \todo Perhaps on some platforms *out = !!value would be a better impl, b/c + * that is idiomatic C++ in some STL implementations. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t boolean_pack(protobuf_c_boolean value, uint8_t *out) { + *out = value ? TRUE : FALSE; + return 1; +} + +/** + * Pack a NUL-terminated C string and return the number of bytes written. The + * output includes a length delimiter. + * + * The NULL pointer is treated as an empty string. This isn't really necessary, + * but it allows people to leave required strings blank. (See Issue #13 in the + * bug tracker for a little more explanation). + * + * \param str + * String to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t string_pack(const char *str, uint8_t *out) { + if (str == NULL) { + out[0] = 0; + return 1; + } else { + size_t len = strlen(str); + size_t rv = uint32_pack(len, out); + memcpy(out + rv, str, len); + return rv + len; + } +} + +/** + * Pack a ProtobufCBinaryData and return the number of bytes written. The output + * includes a length delimiter. + * + * \param bd + * ProtobufCBinaryData to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t binary_data_pack(const ProtobufCBinaryData *bd, + uint8_t *out) { + size_t len = bd->len; + size_t rv = uint32_pack(len, out); + memcpy(out + rv, bd->data, len); + return rv + len; +} + +/** + * Pack a ProtobufCMessage and return the number of bytes written. The output + * includes a length delimiter. + * + * \param message + * ProtobufCMessage object to pack. + * \param[out] out + * Packed message. + * \return + * Number of bytes written to `out`. + */ +static inline size_t prefixed_message_pack(const ProtobufCMessage *message, + uint8_t *out) { + if (message == NULL) { + out[0] = 0; + return 1; + } else { + size_t rv = protobuf_c_message_pack(message, out + 1); + uint32_t rv_packed_size = uint32_size(rv); + if (rv_packed_size != 1) memmove(out + rv_packed_size, out + 1, rv); + return uint32_pack(rv, out) + rv; + } +} + +/** + * Pack a field tag. + * + * Wire-type will be added in required_field_pack(). + * + * \todo Just call uint64_pack on 64-bit platforms. + * + * \param id + * Tag value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t tag_pack(uint32_t id, uint8_t *out) { + if (id < (1UL << (32 - 3))) + return uint32_pack(id << 3, out); + else + return uint64_pack(((uint64_t)id) << 3, out); +} + +/** + * Pack a required field and return the number of bytes written. + * + * \param field + * Field descriptor. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t required_field_pack(const ProtobufCFieldDescriptor *field, + const void *member, uint8_t *out) { + size_t rv = tag_pack(field->id, out); + + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + sint32_pack(*(const int32_t *)member, out + rv); + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + int32_pack(*(const int32_t *)member, out + rv); + case PROTOBUF_C_TYPE_UINT32: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + uint32_pack(*(const uint32_t *)member, out + rv); + case PROTOBUF_C_TYPE_SINT64: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + sint64_pack(*(const int64_t *)member, out + rv); + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + uint64_pack(*(const uint64_t *)member, out + rv); + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + out[0] |= PROTOBUF_C_WIRE_TYPE_32BIT; + return rv + fixed32_pack(*(const uint32_t *)member, out + rv); + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + out[0] |= PROTOBUF_C_WIRE_TYPE_64BIT; + return rv + fixed64_pack(*(const uint64_t *)member, out + rv); + case PROTOBUF_C_TYPE_BOOL: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + boolean_pack(*(const protobuf_c_boolean *)member, out + rv); + case PROTOBUF_C_TYPE_STRING: + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + return rv + string_pack(*(char *const *)member, out + rv); + case PROTOBUF_C_TYPE_BYTES: + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + return rv + + binary_data_pack((const ProtobufCBinaryData *)member, out + rv); + case PROTOBUF_C_TYPE_MESSAGE: + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + return rv + prefixed_message_pack(*(ProtobufCMessage *const *)member, + out + rv); + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Pack a oneof field and return the number of bytes written. Only packs the + * field that is selected by the case enum. + * + * \param field + * Field descriptor. + * \param oneof_case + * Enum value that selects the field in the oneof. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t oneof_field_pack(const ProtobufCFieldDescriptor *field, + uint32_t oneof_case, const void *member, + uint8_t *out) { + if (oneof_case != field->id) { + return 0; + } + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) { + const void *ptr = *(const void *const *)member; + if (ptr == NULL || ptr == field->default_value) return 0; + } + return required_field_pack(field, member, out); +} + +/** + * Pack an optional field and return the number of bytes written. + * + * \param field + * Field descriptor. + * \param has + * Whether the field is set. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t optional_field_pack(const ProtobufCFieldDescriptor *field, + const protobuf_c_boolean has, + const void *member, uint8_t *out) { + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) { + const void *ptr = *(const void *const *)member; + if (ptr == NULL || ptr == field->default_value) return 0; + } else { + if (!has) return 0; + } + return required_field_pack(field, member, out); +} + +/** + * Pack an unlabeled field and return the number of bytes written. + * + * \param field + * Field descriptor. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t unlabeled_field_pack(const ProtobufCFieldDescriptor *field, + const void *member, uint8_t *out) { + if (field_is_zeroish(field, member)) return 0; + return required_field_pack(field, member, out); +} + +/** + * Given a field type, return the in-memory size. + * + * \todo Implement as a table lookup. + * + * \param type + * Field type. + * \return + * Size of the field. + */ +static inline size_t sizeof_elt_in_repeated_array(ProtobufCType type) { + switch (type) { + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + case PROTOBUF_C_TYPE_ENUM: + return 4; + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + return 8; + case PROTOBUF_C_TYPE_BOOL: + return sizeof(protobuf_c_boolean); + case PROTOBUF_C_TYPE_STRING: + case PROTOBUF_C_TYPE_MESSAGE: + return sizeof(void *); + case PROTOBUF_C_TYPE_BYTES: + return sizeof(ProtobufCBinaryData); + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Pack an array of 32-bit quantities. + * + * \param[out] out + * Destination. + * \param[in] in + * Source. + * \param[in] n + * Number of elements in the source array. + */ +static void copy_to_little_endian_32(void *out, const void *in, + const unsigned n) { +#if !defined(WORDS_BIGENDIAN) + memcpy(out, in, n * 4); +#else + unsigned i; + const uint32_t *ini = in; + for (i = 0; i < n; i++) fixed32_pack(ini[i], (uint32_t *)out + i); +#endif +} + +/** + * Pack an array of 64-bit quantities. + * + * \param[out] out + * Destination. + * \param[in] in + * Source. + * \param[in] n + * Number of elements in the source array. + */ +static void copy_to_little_endian_64(void *out, const void *in, + const unsigned n) { +#if !defined(WORDS_BIGENDIAN) + memcpy(out, in, n * 8); +#else + unsigned i; + const uint64_t *ini = in; + for (i = 0; i < n; i++) fixed64_pack(ini[i], (uint64_t *)out + i); +#endif +} + +/** + * Get the minimum number of bytes required to pack a field value of a + * particular type. + * + * \param type + * Field type. + * \return + * Number of bytes. + */ +static unsigned get_type_min_size(ProtobufCType type) { + if (type == PROTOBUF_C_TYPE_SFIXED32 || type == PROTOBUF_C_TYPE_FIXED32 || + type == PROTOBUF_C_TYPE_FLOAT) { + return 4; + } + if (type == PROTOBUF_C_TYPE_SFIXED64 || type == PROTOBUF_C_TYPE_FIXED64 || + type == PROTOBUF_C_TYPE_DOUBLE) { + return 8; + } + return 1; +} + +/** + * Get the packed size of an array of same field type. + * + * \param field + * Field descriptor. + * \param count + * Number of elements of this type. + * \param array + * The elements to get the size of. + * \return + * Number of bytes required. + */ +static size_t get_packed_payload_length(const ProtobufCFieldDescriptor *field, + unsigned count, const void *array) { + unsigned rv = 0; + unsigned i; + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + return count * 4; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + return count * 8; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: { + const int32_t *arr = (const int32_t *)array; + for (i = 0; i < count; i++) rv += int32_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_SINT32: { + const int32_t *arr = (const int32_t *)array; + for (i = 0; i < count; i++) rv += sint32_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_UINT32: { + const uint32_t *arr = (const uint32_t *)array; + for (i = 0; i < count; i++) rv += uint32_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_SINT64: { + const int64_t *arr = (const int64_t *)array; + for (i = 0; i < count; i++) rv += sint64_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: { + const uint64_t *arr = (const uint64_t *)array; + for (i = 0; i < count; i++) rv += uint64_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_BOOL: + return count; + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + return rv; +} + +/** + * Pack an array of same field type to a virtual buffer. + * + * \param field + * Field descriptor. + * \param count + * Number of elements of this type. + * \param array + * The elements to get the size of. + * \param[out] buffer + * Virtual buffer to append data to. + * \return + * Number of bytes packed. + */ +static size_t pack_buffer_packed_payload(const ProtobufCFieldDescriptor *field, + unsigned count, const void *array, + ProtobufCBuffer *buffer) { + uint8_t scratch[16]; + size_t rv = 0; + unsigned i; + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: +#if !defined(WORDS_BIGENDIAN) + rv = count * 4; + goto no_packing_needed; +#else + for (i = 0; i < count; i++) { + unsigned len = fixed32_pack(((uint32_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; +#endif + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: +#if !defined(WORDS_BIGENDIAN) + rv = count * 8; + goto no_packing_needed; +#else + for (i = 0; i < count; i++) { + unsigned len = fixed64_pack(((uint64_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; +#endif + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + for (i = 0; i < count; i++) { + unsigned len = int32_pack(((int32_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_SINT32: + for (i = 0; i < count; i++) { + unsigned len = sint32_pack(((int32_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_UINT32: + for (i = 0; i < count; i++) { + unsigned len = uint32_pack(((uint32_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_SINT64: + for (i = 0; i < count; i++) { + unsigned len = sint64_pack(((int64_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + for (i = 0; i < count; i++) { + unsigned len = uint64_pack(((uint64_t *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_BOOL: + for (i = 0; i < count; i++) { + unsigned len = boolean_pack(((protobuf_c_boolean *)array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + return count; + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + return rv; + +#if !defined(WORDS_BIGENDIAN) +no_packing_needed: + buffer->append(buffer, rv, array); + return rv; +#endif +} + +static inline int int_range_lookup(unsigned n_ranges, + const ProtobufCIntRange *ranges, int value) { + unsigned n; + unsigned start; + + if (n_ranges == 0) return -1; + start = 0; + n = n_ranges; + while (n > 1) { + unsigned mid = start + n / 2; + + if (value < ranges[mid].start_value) { + n = mid - start; + } else if (value >= + ranges[mid].start_value + + (int)(ranges[mid + 1].orig_index - ranges[mid].orig_index)) { + unsigned new_start = mid + 1; + n = start + n - new_start; + start = new_start; + } else + return (value - ranges[mid].start_value) + ranges[mid].orig_index; + } + if (n > 0) { + unsigned start_orig_index = ranges[start].orig_index; + unsigned range_size = ranges[start + 1].orig_index - start_orig_index; + + if (ranges[start].start_value <= value && + value < (int)(ranges[start].start_value + range_size)) { + return (value - ranges[start].start_value) + start_orig_index; + } + } + return -1; +} + +static size_t parse_tag_and_wiretype(size_t len, const uint8_t *data, + uint32_t *tag_out, + ProtobufCWireType *wiretype_out) { + unsigned max_rv = len > 5 ? 5 : len; + uint32_t tag = (data[0] & 0x7f) >> 3; + unsigned shift = 4; + unsigned rv; + + *wiretype_out = data[0] & 7; + if ((data[0] & 0x80) == 0) { + *tag_out = tag; + return 1; + } + for (rv = 1; rv < max_rv; rv++) { + if (data[rv] & 0x80) { + tag |= (data[rv] & 0x7f) << shift; + shift += 7; + } else { + tag |= data[rv] << shift; + *tag_out = tag; + return rv + 1; + } + } + return 0; /* error: bad header */ +} + +/* sizeof(ScannedMember) must be <= (1UL< len) { + PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %u", val); + return 0; + } + return hdr_len + val; +} + +static size_t max_b128_numbers(size_t len, const uint8_t *data) { + size_t rv = 0; + while (len--) + if ((*data++ & 0x80) == 0) ++rv; + return rv; +} + +/**@}*/ + +/** + * Merge earlier message into a latter message. + * + * For numeric types and strings, if the same value appears multiple + * times, the parser accepts the last value it sees. For embedded + * message fields, the parser merges multiple instances of the same + * field. That is, all singular scalar fields in the latter instance + * replace those in the former, singular embedded messages are merged, + * and repeated fields are concatenated. + * + * The earlier message should be freed after calling this function, as + * some of its fields may have been reused and changed to their default + * values during the merge. + */ +static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, + ProtobufCMessage *latter_msg, + ProtobufCAllocator *allocator) { + unsigned i; + const ProtobufCFieldDescriptor *fields = latter_msg->descriptor->fields; + for (i = 0; i < latter_msg->descriptor->n_fields; i++) { + if (fields[i].label == PROTOBUF_C_LABEL_REPEATED) { + size_t *n_earlier = + STRUCT_MEMBER_PTR(size_t, earlier_msg, fields[i].quantifier_offset); + uint8_t **p_earlier = + STRUCT_MEMBER_PTR(uint8_t *, earlier_msg, fields[i].offset); + size_t *n_latter = + STRUCT_MEMBER_PTR(size_t, latter_msg, fields[i].quantifier_offset); + uint8_t **p_latter = + STRUCT_MEMBER_PTR(uint8_t *, latter_msg, fields[i].offset); + + if (*n_earlier > 0) { + if (*n_latter > 0) { + /* Concatenate the repeated field */ + size_t el_size = sizeof_elt_in_repeated_array(fields[i].type); + uint8_t *new_field; + + new_field = do_alloc(allocator, (*n_earlier + *n_latter) * el_size); + if (!new_field) return FALSE; + + memcpy(new_field, *p_earlier, *n_earlier * el_size); + memcpy(new_field + *n_earlier * el_size, *p_latter, + *n_latter * el_size); + + do_free(allocator, *p_latter); + do_free(allocator, *p_earlier); + *p_latter = new_field; + *n_latter = *n_earlier + *n_latter; + } else { + /* Zero copy the repeated field from the earlier message */ + *n_latter = *n_earlier; + *p_latter = *p_earlier; + } + /* Make sure the field does not get double freed */ + *n_earlier = 0; + *p_earlier = 0; + } + } else if (fields[i].label == PROTOBUF_C_LABEL_OPTIONAL || + fields[i].label == PROTOBUF_C_LABEL_NONE) { + const ProtobufCFieldDescriptor *field; + uint32_t *earlier_case_p = + STRUCT_MEMBER_PTR(uint32_t, earlier_msg, fields[i].quantifier_offset); + uint32_t *latter_case_p = + STRUCT_MEMBER_PTR(uint32_t, latter_msg, fields[i].quantifier_offset); + protobuf_c_boolean need_to_merge = FALSE; + void *earlier_elem; + void *latter_elem; + const void *def_val; + + if (fields[i].flags & PROTOBUF_C_FIELD_FLAG_ONEOF) { + if (*latter_case_p == 0) { + /* lookup correct oneof field */ + int field_index = int_range_lookup( + latter_msg->descriptor->n_field_ranges, + latter_msg->descriptor->field_ranges, *earlier_case_p); + field = latter_msg->descriptor->fields + field_index; + } else { + /* Oneof is present in the latter message, move on */ + continue; + } + } else { + field = &fields[i]; + } + + earlier_elem = STRUCT_MEMBER_P(earlier_msg, field->offset); + latter_elem = STRUCT_MEMBER_P(latter_msg, field->offset); + def_val = field->default_value; + + switch (field->type) { + case PROTOBUF_C_TYPE_MESSAGE: { + ProtobufCMessage *em = *(ProtobufCMessage **)earlier_elem; + ProtobufCMessage *lm = *(ProtobufCMessage **)latter_elem; + if (em != NULL) { + if (lm != NULL) { + if (!merge_messages(em, lm, allocator)) return FALSE; + /* Already merged */ + need_to_merge = FALSE; + } else { + /* Zero copy the message */ + need_to_merge = TRUE; + } + } + break; + } + case PROTOBUF_C_TYPE_BYTES: { + uint8_t *e_data = ((ProtobufCBinaryData *)earlier_elem)->data; + uint8_t *l_data = ((ProtobufCBinaryData *)latter_elem)->data; + const ProtobufCBinaryData *d_bd = (ProtobufCBinaryData *)def_val; + + need_to_merge = + (e_data != NULL && (d_bd == NULL || e_data != d_bd->data)) && + (l_data == NULL || (d_bd != NULL && l_data == d_bd->data)); + break; + } + case PROTOBUF_C_TYPE_STRING: { + char *e_str = *(char **)earlier_elem; + char *l_str = *(char **)latter_elem; + const char *d_str = def_val; + + need_to_merge = e_str != d_str && l_str == d_str; + break; + } + default: { + /* Could be has field or case enum, the logic is + * equivalent, since 0 (FALSE) means not set for + * oneof */ + need_to_merge = (*earlier_case_p != 0) && (*latter_case_p == 0); + break; + } + } + + if (need_to_merge) { + size_t el_size = sizeof_elt_in_repeated_array(field->type); + memcpy(latter_elem, earlier_elem, el_size); + /* + * Reset the element from the old message to 0 + * to make sure earlier message deallocation + * doesn't corrupt zero-copied data in the new + * message, earlier message will be freed after + * this function is called anyway + */ + memset(earlier_elem, 0, el_size); + + if (field->quantifier_offset != 0) { + /* Set the has field or the case enum, + * if applicable */ + *latter_case_p = *earlier_case_p; + *earlier_case_p = 0; + } + } + } + } + return TRUE; +} + +/** + * Count packed elements. + * + * Given a raw slab of packed-repeated values, determine the number of + * elements. This function detects certain kinds of errors but not + * others; the remaining error checking is done by + * parse_packed_repeated_member(). + */ +static protobuf_c_boolean count_packed_elements(ProtobufCType type, size_t len, + const uint8_t *data, + size_t *count_out) { + switch (type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + if (len % 4 != 0) { + PROTOBUF_C_UNPACK_ERROR( + "length must be a multiple of 4 for fixed-length 32-bit types"); + return FALSE; + } + *count_out = len / 4; + return TRUE; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + if (len % 8 != 0) { + PROTOBUF_C_UNPACK_ERROR( + "length must be a multiple of 8 for fixed-length 64-bit types"); + return FALSE; + } + *count_out = len / 8; + return TRUE; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_UINT64: + *count_out = max_b128_numbers(len, data); + return TRUE; + case PROTOBUF_C_TYPE_BOOL: + *count_out = len; + return TRUE; + case PROTOBUF_C_TYPE_STRING: + case PROTOBUF_C_TYPE_BYTES: + case PROTOBUF_C_TYPE_MESSAGE: + default: + PROTOBUF_C_UNPACK_ERROR("bad protobuf-c type %u for packed-repeated", + type); + return FALSE; + } +} + +static inline uint32_t parse_uint32(unsigned len, const uint8_t *data) { + uint32_t rv = data[0] & 0x7f; + if (len > 1) { + rv |= ((uint32_t)(data[1] & 0x7f) << 7); + if (len > 2) { + rv |= ((uint32_t)(data[2] & 0x7f) << 14); + if (len > 3) { + rv |= ((uint32_t)(data[3] & 0x7f) << 21); + if (len > 4) rv |= ((uint32_t)(data[4]) << 28); + } + } + } + return rv; +} + +static inline uint32_t parse_int32(unsigned len, const uint8_t *data) { + return parse_uint32(len, data); +} + +static inline int32_t unzigzag32(uint32_t v) { + if (v & 1) + return -(v >> 1) - 1; + else + return v >> 1; +} + +static inline uint32_t parse_fixed_uint32(const uint8_t *data) { +#if !defined(WORDS_BIGENDIAN) + uint32_t t; + memcpy(&t, data, 4); + return t; +#else + return data[0] | ((uint32_t)(data[1]) << 8) | ((uint32_t)(data[2]) << 16) | + ((uint32_t)(data[3]) << 24); +#endif +} + +static uint64_t parse_uint64(unsigned len, const uint8_t *data) { + unsigned shift, i; + uint64_t rv; + + if (len < 5) return parse_uint32(len, data); + rv = ((uint64_t)(data[0] & 0x7f)) | ((uint64_t)(data[1] & 0x7f) << 7) | + ((uint64_t)(data[2] & 0x7f) << 14) | ((uint64_t)(data[3] & 0x7f) << 21); + shift = 28; + for (i = 4; i < len; i++) { + rv |= (((uint64_t)(data[i] & 0x7f)) << shift); + shift += 7; + } + return rv; +} + +static inline int64_t unzigzag64(uint64_t v) { + if (v & 1) + return -(v >> 1) - 1; + else + return v >> 1; +} + +static inline uint64_t parse_fixed_uint64(const uint8_t *data) { +#if !defined(WORDS_BIGENDIAN) + uint64_t t; + memcpy(&t, data, 8); + return t; +#else + return (uint64_t)parse_fixed_uint32(data) | + (((uint64_t)parse_fixed_uint32(data + 4)) << 32); +#endif +} + +static protobuf_c_boolean parse_boolean(unsigned len, const uint8_t *data) { + unsigned i; + for (i = 0; i < len; i++) + if (data[i] & 0x7f) return TRUE; + return FALSE; +} + +static protobuf_c_boolean parse_required_member( + ScannedMember *scanned_member, void *member, ProtobufCAllocator *allocator, + protobuf_c_boolean maybe_clear) { + unsigned len = scanned_member->len; + const uint8_t *data = scanned_member->data; + ProtobufCWireType wire_type = scanned_member->wire_type; + + switch (scanned_member->field->type) { + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; + *(int32_t *)member = parse_int32(len, data); + return TRUE; + case PROTOBUF_C_TYPE_UINT32: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; + *(uint32_t *)member = parse_uint32(len, data); + return TRUE; + case PROTOBUF_C_TYPE_SINT32: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; + *(int32_t *)member = unzigzag32(parse_uint32(len, data)); + return TRUE; + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + if (wire_type != PROTOBUF_C_WIRE_TYPE_32BIT) return FALSE; + *(uint32_t *)member = parse_fixed_uint32(data); + return TRUE; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; + *(uint64_t *)member = parse_uint64(len, data); + return TRUE; + case PROTOBUF_C_TYPE_SINT64: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; + *(int64_t *)member = unzigzag64(parse_uint64(len, data)); + return TRUE; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + if (wire_type != PROTOBUF_C_WIRE_TYPE_64BIT) return FALSE; + *(uint64_t *)member = parse_fixed_uint64(data); + return TRUE; + case PROTOBUF_C_TYPE_BOOL: + *(protobuf_c_boolean *)member = parse_boolean(len, data); + return TRUE; + case PROTOBUF_C_TYPE_STRING: { + char **pstr = member; + unsigned pref_len = scanned_member->length_prefix_len; + + if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) return FALSE; + + if (maybe_clear && *pstr != NULL) { + const char *def = scanned_member->field->default_value; + if (*pstr != NULL && *pstr != def) do_free(allocator, *pstr); + } + *pstr = do_alloc(allocator, len - pref_len + 1); + if (*pstr == NULL) return FALSE; + memcpy(*pstr, data + pref_len, len - pref_len); + (*pstr)[len - pref_len] = 0; + return TRUE; + } + case PROTOBUF_C_TYPE_BYTES: { + ProtobufCBinaryData *bd = member; + const ProtobufCBinaryData *def_bd; + unsigned pref_len = scanned_member->length_prefix_len; + + if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) return FALSE; + + def_bd = scanned_member->field->default_value; + if (maybe_clear && bd->data != NULL && + (def_bd == NULL || bd->data != def_bd->data)) { + do_free(allocator, bd->data); + } + if (len - pref_len > 0) { + bd->data = do_alloc(allocator, len - pref_len); + if (bd->data == NULL) return FALSE; + memcpy(bd->data, data + pref_len, len - pref_len); + } else { + bd->data = NULL; + } + bd->len = len - pref_len; + return TRUE; + } + case PROTOBUF_C_TYPE_MESSAGE: { + ProtobufCMessage **pmessage = member; + ProtobufCMessage *subm; + const ProtobufCMessage *def_mess; + protobuf_c_boolean merge_successful = TRUE; + unsigned pref_len = scanned_member->length_prefix_len; + + if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) return FALSE; + + def_mess = scanned_member->field->default_value; + subm = + protobuf_c_message_unpack(scanned_member->field->descriptor, + allocator, len - pref_len, data + pref_len); + + if (maybe_clear && *pmessage != NULL && *pmessage != def_mess) { + if (subm != NULL) + merge_successful = merge_messages(*pmessage, subm, allocator); + /* Delete the previous message */ + protobuf_c_message_free_unpacked(*pmessage, allocator); + } + *pmessage = subm; + if (subm == NULL || !merge_successful) return FALSE; + return TRUE; + } + } + return FALSE; +} + +static protobuf_c_boolean parse_oneof_member(ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) { + uint32_t *oneof_case = STRUCT_MEMBER_PTR( + uint32_t, message, scanned_member->field->quantifier_offset); + + /* If we have already parsed a member of this oneof, free it. */ + if (*oneof_case != 0) { + /* lookup field */ + int field_index = + int_range_lookup(message->descriptor->n_field_ranges, + message->descriptor->field_ranges, *oneof_case); + const ProtobufCFieldDescriptor *old_field = + message->descriptor->fields + field_index; + size_t el_size = sizeof_elt_in_repeated_array(old_field->type); + + switch (old_field->type) { + case PROTOBUF_C_TYPE_STRING: { + char **pstr = member; + const char *def = old_field->default_value; + if (*pstr != NULL && *pstr != def) do_free(allocator, *pstr); + break; + } + case PROTOBUF_C_TYPE_BYTES: { + ProtobufCBinaryData *bd = member; + const ProtobufCBinaryData *def_bd = old_field->default_value; + if (bd->data != NULL && (def_bd == NULL || bd->data != def_bd->data)) { + do_free(allocator, bd->data); + } + break; + } + case PROTOBUF_C_TYPE_MESSAGE: { + ProtobufCMessage **pmessage = member; + const ProtobufCMessage *def_mess = old_field->default_value; + if (*pmessage != NULL && *pmessage != def_mess) + protobuf_c_message_free_unpacked(*pmessage, allocator); + break; + } + default: + break; + } + + memset(member, 0, el_size); + } + if (!parse_required_member(scanned_member, member, allocator, TRUE)) + return FALSE; + + *oneof_case = scanned_member->tag; + return TRUE; +} + +static protobuf_c_boolean parse_optional_member(ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) { + if (!parse_required_member(scanned_member, member, allocator, TRUE)) + return FALSE; + if (scanned_member->field->quantifier_offset != 0) + STRUCT_MEMBER(protobuf_c_boolean, message, + scanned_member->field->quantifier_offset) = TRUE; + return TRUE; +} + +static protobuf_c_boolean parse_repeated_member(ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) { + const ProtobufCFieldDescriptor *field = scanned_member->field; + size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); + size_t siz = sizeof_elt_in_repeated_array(field->type); + char *array = *(char **)member; + + if (!parse_required_member(scanned_member, array + siz * (*p_n), allocator, + FALSE)) { + return FALSE; + } + *p_n += 1; + return TRUE; +} + +static unsigned scan_varint(unsigned len, const uint8_t *data) { + unsigned i; + if (len > 10) len = 10; + for (i = 0; i < len; i++) + if ((data[i] & 0x80) == 0) break; + if (i == len) return 0; + return i + 1; +} + +static protobuf_c_boolean parse_packed_repeated_member( + ScannedMember *scanned_member, void *member, ProtobufCMessage *message) { + const ProtobufCFieldDescriptor *field = scanned_member->field; + size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); + size_t siz = sizeof_elt_in_repeated_array(field->type); + void *array = *(char **)member + siz * (*p_n); + const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len; + size_t rem = scanned_member->len - scanned_member->length_prefix_len; + size_t count = 0; + unsigned i; + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + count = (scanned_member->len - scanned_member->length_prefix_len) / 4; +#if !defined(WORDS_BIGENDIAN) + goto no_unpacking_needed; +#else + for (i = 0; i < count; i++) { + ((uint32_t *)array)[i] = parse_fixed_uint32(at); + at += 4; + } + break; +#endif + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + count = (scanned_member->len - scanned_member->length_prefix_len) / 8; +#if !defined(WORDS_BIGENDIAN) + goto no_unpacking_needed; +#else + for (i = 0; i < count; i++) { + ((uint64_t *)array)[i] = parse_fixed_uint64(at); + at += 8; + } + break; +#endif + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated int32 value"); + return FALSE; + } + ((int32_t *)array)[count++] = parse_int32(s, at); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_SINT32: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated sint32 value"); + return FALSE; + } + ((int32_t *)array)[count++] = unzigzag32(parse_uint32(s, at)); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_UINT32: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated enum or uint32 value"); + return FALSE; + } + ((uint32_t *)array)[count++] = parse_uint32(s, at); + at += s; + rem -= s; + } + break; + + case PROTOBUF_C_TYPE_SINT64: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated sint64 value"); + return FALSE; + } + ((int64_t *)array)[count++] = unzigzag64(parse_uint64(s, at)); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated int64/uint64 value"); + return FALSE; + } + ((int64_t *)array)[count++] = parse_uint64(s, at); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_BOOL: + count = rem; + for (i = 0; i < count; i++) { + if (at[i] > 1) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated boolean value"); + return FALSE; + } + ((protobuf_c_boolean *)array)[i] = at[i]; + } + break; + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + *p_n += count; + return TRUE; + +#if !defined(WORDS_BIGENDIAN) +no_unpacking_needed: + memcpy(array, at, count * siz); + *p_n += count; + return TRUE; +#endif +} + +static protobuf_c_boolean is_packable_type(ProtobufCType type) { + return type != PROTOBUF_C_TYPE_STRING && type != PROTOBUF_C_TYPE_BYTES && + type != PROTOBUF_C_TYPE_MESSAGE; +} + +static protobuf_c_boolean parse_member(ScannedMember *scanned_member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) { + const ProtobufCFieldDescriptor *field = scanned_member->field; + void *member; + + if (field == NULL) { + ProtobufCMessageUnknownField *ufield = + message->unknown_fields + (message->n_unknown_fields++); + ufield->tag = scanned_member->tag; + ufield->wire_type = scanned_member->wire_type; + ufield->len = scanned_member->len; + ufield->data = do_alloc(allocator, scanned_member->len); + if (ufield->data == NULL) return FALSE; + memcpy(ufield->data, scanned_member->data, ufield->len); + return TRUE; + } + member = (char *)message + field->offset; + switch (field->label) { + case PROTOBUF_C_LABEL_REQUIRED: + return parse_required_member(scanned_member, member, allocator, TRUE); + case PROTOBUF_C_LABEL_OPTIONAL: + case PROTOBUF_C_LABEL_NONE: + if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF)) { + return parse_oneof_member(scanned_member, member, message, allocator); + } else { + return parse_optional_member(scanned_member, member, message, + allocator); + } + case PROTOBUF_C_LABEL_REPEATED: + if (scanned_member->wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED) || + is_packable_type(field->type))) { + return parse_packed_repeated_member(scanned_member, member, message); + } else { + return parse_repeated_member(scanned_member, member, message, + allocator); + } + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Initialise messages generated by old code. + * + * This function is used if desc->message_init == NULL (which occurs + * for old code, and which would be useful to support allocating + * descriptors dynamically). + */ +static void message_init_generic(const ProtobufCMessageDescriptor *desc, + ProtobufCMessage *message) { + unsigned i; + + memset(message, 0, desc->sizeof_message); + message->descriptor = desc; + for (i = 0; i < desc->n_fields; i++) { + if (desc->fields[i].default_value != NULL && + desc->fields[i].label != PROTOBUF_C_LABEL_REPEATED) { + void *field = STRUCT_MEMBER_P(message, desc->fields[i].offset); + const void *dv = desc->fields[i].default_value; + + switch (desc->fields[i].type) { + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + case PROTOBUF_C_TYPE_ENUM: + memcpy(field, dv, 4); + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_UINT64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + memcpy(field, dv, 8); + break; + case PROTOBUF_C_TYPE_BOOL: + memcpy(field, dv, sizeof(protobuf_c_boolean)); + break; + case PROTOBUF_C_TYPE_BYTES: + memcpy(field, dv, sizeof(ProtobufCBinaryData)); + break; + + case PROTOBUF_C_TYPE_STRING: + case PROTOBUF_C_TYPE_MESSAGE: + /* + * The next line essentially implements a cast + * from const, which is totally unavoidable. + */ + *(const void **)field = dv; + break; + } + } + } +} + +/**@}*/ + +/* + * ScannedMember slabs (an unpacking implementation detail). Before doing real + * unpacking, we first scan through the elements to see how many there are (for + * repeated fields), and which field to use (for non-repeated fields given + * twice). + * + * In order to avoid allocations for small messages, we keep a stack-allocated + * slab of ScannedMembers of size FIRST_SCANNED_MEMBER_SLAB_SIZE (16). After we + * fill that up, we allocate each slab twice as large as the previous one. + */ +#define FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2 4 + +/* + * The number of slabs, including the stack-allocated ones; choose the number so + * that we would overflow if we needed a slab larger than provided. + */ +#define MAX_SCANNED_MEMBER_SLAB \ + (sizeof(unsigned int) * 8 - 1 - BOUND_SIZEOF_SCANNED_MEMBER_LOG2 - \ + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2) + +#define REQUIRED_FIELD_BITMAP_SET(index) \ + (required_fields_bitmap[(index) / 8] |= (1UL << ((index) % 8))) + +#define REQUIRED_FIELD_BITMAP_IS_SET(index) \ + (required_fields_bitmap[(index) / 8] & (1UL << ((index) % 8))) + +ProtobufCMessage *protobuf_c_message_unpack( + const ProtobufCMessageDescriptor *desc, ProtobufCAllocator *allocator, + size_t len, const uint8_t *data) { + ProtobufCMessage *rv; + size_t rem = len; + const uint8_t *at = data; + const ProtobufCFieldDescriptor *last_field = desc->fields + 0; + ScannedMember first_member_slab[1UL << FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2]; + + /* + * scanned_member_slabs[i] is an array of arrays of ScannedMember. + * The first slab (scanned_member_slabs[0] is just a pointer to + * first_member_slab), above. All subsequent slabs will be allocated + * using the allocator. + */ + ScannedMember *scanned_member_slabs[MAX_SCANNED_MEMBER_SLAB + 1]; + unsigned which_slab = 0; /* the slab we are currently populating */ + unsigned in_slab_index = 0; /* number of members in the slab */ + size_t n_unknown = 0; + unsigned f; + unsigned j; + unsigned i_slab; + unsigned last_field_index = 0; + unsigned required_fields_bitmap_len; + unsigned char required_fields_bitmap_stack[16]; + unsigned char *required_fields_bitmap = required_fields_bitmap_stack; + protobuf_c_boolean required_fields_bitmap_alloced = FALSE; + + ASSERT_IS_MESSAGE_DESCRIPTOR(desc); + + if (allocator == NULL) allocator = &protobuf_c__allocator; + + rv = do_alloc(allocator, desc->sizeof_message); + if (!rv) return (NULL); + scanned_member_slabs[0] = first_member_slab; + + required_fields_bitmap_len = (desc->n_fields + 7) / 8; + if (required_fields_bitmap_len > sizeof(required_fields_bitmap_stack)) { + required_fields_bitmap = do_alloc(allocator, required_fields_bitmap_len); + if (!required_fields_bitmap) { + do_free(allocator, rv); + return (NULL); + } + required_fields_bitmap_alloced = TRUE; + } + memset(required_fields_bitmap, 0, required_fields_bitmap_len); + + /* + * Generated code always defines "message_init". However, we provide a + * fallback for (1) users of old protobuf-c generated-code that do not + * provide the function, and (2) descriptors constructed from some other + * source (most likely, direct construction from the .proto file). + */ + if (desc->message_init != NULL) + protobuf_c_message_init(desc, rv); + else + message_init_generic(desc, rv); + + while (rem > 0) { + uint32_t tag; + ProtobufCWireType wire_type; + size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type); + const ProtobufCFieldDescriptor *field; + ScannedMember tmp; + + if (used == 0) { + PROTOBUF_C_UNPACK_ERROR("error parsing tag/wiretype at offset %u", + (unsigned)(at - data)); + goto error_cleanup_during_scan; + } + /* + * \todo Consider optimizing for field[1].id == tag, if field[1] + * exists! + */ + if (last_field == NULL || last_field->id != tag) { + /* lookup field */ + int field_index = + int_range_lookup(desc->n_field_ranges, desc->field_ranges, tag); + if (field_index < 0) { + field = NULL; + n_unknown++; + } else { + field = desc->fields + field_index; + last_field = field; + last_field_index = field_index; + } + } else { + field = last_field; + } + + if (field != NULL && field->label == PROTOBUF_C_LABEL_REQUIRED) + REQUIRED_FIELD_BITMAP_SET(last_field_index); + + at += used; + rem -= used; + tmp.tag = tag; + tmp.wire_type = wire_type; + tmp.field = field; + tmp.data = at; + tmp.length_prefix_len = 0; + + switch (wire_type) { + case PROTOBUF_C_WIRE_TYPE_VARINT: { + unsigned max_len = rem < 10 ? rem : 10; + unsigned i; + + for (i = 0; i < max_len; i++) + if ((at[i] & 0x80) == 0) break; + if (i == max_len) { + PROTOBUF_C_UNPACK_ERROR("unterminated varint at offset %u", + (unsigned)(at - data)); + goto error_cleanup_during_scan; + } + tmp.len = i + 1; + break; + } + case PROTOBUF_C_WIRE_TYPE_64BIT: + if (rem < 8) { + PROTOBUF_C_UNPACK_ERROR("too short after 64bit wiretype at offset %u", + (unsigned)(at - data)); + goto error_cleanup_during_scan; + } + tmp.len = 8; + break; + case PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED: { + size_t pref_len; + + tmp.len = scan_length_prefixed_data(rem, at, &pref_len); + if (tmp.len == 0) { + /* NOTE: scan_length_prefixed_data calls UNPACK_ERROR */ + goto error_cleanup_during_scan; + } + tmp.length_prefix_len = pref_len; + break; + } + case PROTOBUF_C_WIRE_TYPE_32BIT: + if (rem < 4) { + PROTOBUF_C_UNPACK_ERROR("too short after 32bit wiretype at offset %u", + (unsigned)(at - data)); + goto error_cleanup_during_scan; + } + tmp.len = 4; + break; + default: + PROTOBUF_C_UNPACK_ERROR("unsupported tag %u at offset %u", wire_type, + (unsigned)(at - data)); + goto error_cleanup_during_scan; + } + + if (in_slab_index == + (1UL << (which_slab + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2))) { + size_t size; + + in_slab_index = 0; + if (which_slab == MAX_SCANNED_MEMBER_SLAB) { + PROTOBUF_C_UNPACK_ERROR("too many fields"); + goto error_cleanup_during_scan; + } + which_slab++; + size = sizeof(ScannedMember) + << (which_slab + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2); + scanned_member_slabs[which_slab] = do_alloc(allocator, size); + if (scanned_member_slabs[which_slab] == NULL) + goto error_cleanup_during_scan; + } + scanned_member_slabs[which_slab][in_slab_index++] = tmp; + + if (field != NULL && field->label == PROTOBUF_C_LABEL_REPEATED) { + size_t *n = STRUCT_MEMBER_PTR(size_t, rv, field->quantifier_offset); + if (wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED) || + is_packable_type(field->type))) { + size_t count; + if (!count_packed_elements(field->type, tmp.len - tmp.length_prefix_len, + tmp.data + tmp.length_prefix_len, &count)) { + PROTOBUF_C_UNPACK_ERROR("counting packed elements"); + goto error_cleanup_during_scan; + } + *n += count; + } else { + *n += 1; + } + } + + at += tmp.len; + rem -= tmp.len; + } + + /* allocate space for repeated fields, also check that all required fields + * have been set */ + for (f = 0; f < desc->n_fields; f++) { + const ProtobufCFieldDescriptor *field = desc->fields + f; + if (field->label == PROTOBUF_C_LABEL_REPEATED) { + size_t siz = sizeof_elt_in_repeated_array(field->type); + size_t *n_ptr = STRUCT_MEMBER_PTR(size_t, rv, field->quantifier_offset); + if (*n_ptr != 0) { + unsigned n = *n_ptr; + void *a; + *n_ptr = 0; + assert(rv->descriptor != NULL); +#define CLEAR_REMAINING_N_PTRS() \ + for (f++; f < desc->n_fields; f++) { \ + field = desc->fields + f; \ + if (field->label == PROTOBUF_C_LABEL_REPEATED) \ + STRUCT_MEMBER(size_t, rv, field->quantifier_offset) = 0; \ + } + a = do_alloc(allocator, siz * n); + if (!a) { + CLEAR_REMAINING_N_PTRS(); + goto error_cleanup; + } + STRUCT_MEMBER(void *, rv, field->offset) = a; + } + } else if (field->label == PROTOBUF_C_LABEL_REQUIRED) { + if (field->default_value == NULL && !REQUIRED_FIELD_BITMAP_IS_SET(f)) { + CLEAR_REMAINING_N_PTRS(); + PROTOBUF_C_UNPACK_ERROR("message '%s': missing required field '%s'", + desc->name, field->name); + goto error_cleanup; + } + } + } +#undef CLEAR_REMAINING_N_PTRS + + /* allocate space for unknown fields */ + if (n_unknown) { + rv->unknown_fields = + do_alloc(allocator, n_unknown * sizeof(ProtobufCMessageUnknownField)); + if (rv->unknown_fields == NULL) goto error_cleanup; + } + + /* do real parsing */ + for (i_slab = 0; i_slab <= which_slab; i_slab++) { + unsigned max = + (i_slab == which_slab) ? in_slab_index : (1UL << (i_slab + 4)); + ScannedMember *slab = scanned_member_slabs[i_slab]; + + for (j = 0; j < max; j++) { + if (!parse_member(slab + j, rv, allocator)) { + PROTOBUF_C_UNPACK_ERROR( + "error parsing member %s of %s", + slab->field ? slab->field->name : "*unknown-field*", desc->name); + goto error_cleanup; + } + } + } + + /* cleanup */ + for (j = 1; j <= which_slab; j++) do_free(allocator, scanned_member_slabs[j]); + if (required_fields_bitmap_alloced) + do_free(allocator, required_fields_bitmap); + return rv; + +error_cleanup: + protobuf_c_message_free_unpacked(rv, allocator); + for (j = 1; j <= which_slab; j++) do_free(allocator, scanned_member_slabs[j]); + if (required_fields_bitmap_alloced) + do_free(allocator, required_fields_bitmap); + return NULL; + +error_cleanup_during_scan: + do_free(allocator, rv); + for (j = 1; j <= which_slab; j++) do_free(allocator, scanned_member_slabs[j]); + if (required_fields_bitmap_alloced) + do_free(allocator, required_fields_bitmap); + return NULL; +} + +void protobuf_c_message_free_unpacked(ProtobufCMessage *message, + ProtobufCAllocator *allocator) { + const ProtobufCMessageDescriptor *desc; + unsigned f; + + if (message == NULL) return; + + desc = message->descriptor; + + ASSERT_IS_MESSAGE(message); + + if (allocator == NULL) allocator = &protobuf_c__allocator; + message->descriptor = NULL; + for (f = 0; f < desc->n_fields; f++) { + if (0 != (desc->fields[f].flags & PROTOBUF_C_FIELD_FLAG_ONEOF) && + desc->fields[f].id != + STRUCT_MEMBER(uint32_t, message, + desc->fields[f].quantifier_offset)) { + /* This is not the selected oneof, skip it */ + continue; + } + + if (desc->fields[f].label == PROTOBUF_C_LABEL_REPEATED) { + size_t n = + STRUCT_MEMBER(size_t, message, desc->fields[f].quantifier_offset); + void *arr = STRUCT_MEMBER(void *, message, desc->fields[f].offset); + + if (arr != NULL) { + if (desc->fields[f].type == PROTOBUF_C_TYPE_STRING) { + unsigned i; + for (i = 0; i < n; i++) do_free(allocator, ((char **)arr)[i]); + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_BYTES) { + unsigned i; + for (i = 0; i < n; i++) + do_free(allocator, ((ProtobufCBinaryData *)arr)[i].data); + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_MESSAGE) { + unsigned i; + for (i = 0; i < n; i++) + protobuf_c_message_free_unpacked(((ProtobufCMessage **)arr)[i], + allocator); + } + do_free(allocator, arr); + } + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_STRING) { + char *str = STRUCT_MEMBER(char *, message, desc->fields[f].offset); + + if (str && str != desc->fields[f].default_value) do_free(allocator, str); + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_BYTES) { + void *data = + STRUCT_MEMBER(ProtobufCBinaryData, message, desc->fields[f].offset) + .data; + const ProtobufCBinaryData *default_bd; + + default_bd = desc->fields[f].default_value; + if (data != NULL && (default_bd == NULL || default_bd->data != data)) { + do_free(allocator, data); + } + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_MESSAGE) { + ProtobufCMessage *sm; + + sm = STRUCT_MEMBER(ProtobufCMessage *, message, desc->fields[f].offset); + if (sm && sm != desc->fields[f].default_value) + protobuf_c_message_free_unpacked(sm, allocator); + } + } + + for (f = 0; f < message->n_unknown_fields; f++) + do_free(allocator, message->unknown_fields[f].data); + if (message->unknown_fields != NULL) + do_free(allocator, message->unknown_fields); + + do_free(allocator, message); +} + +void protobuf_c_message_init(const ProtobufCMessageDescriptor *descriptor, + void *message) { + descriptor->message_init((ProtobufCMessage *)(message)); +} + +protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { + unsigned i; + + if (!message || !message->descriptor || + message->descriptor->magic != PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC) { + return FALSE; + } + + for (i = 0; i < message->descriptor->n_fields; i++) { + const ProtobufCFieldDescriptor *f = message->descriptor->fields + i; + ProtobufCType type = f->type; + ProtobufCLabel label = f->label; + void *field = STRUCT_MEMBER_P(message, f->offset); + + if (label == PROTOBUF_C_LABEL_REPEATED) { + size_t *quantity = STRUCT_MEMBER_P(message, f->quantifier_offset); + + if (*quantity > 0 && *(void **)field == NULL) { + return FALSE; + } + + if (type == PROTOBUF_C_TYPE_MESSAGE) { + ProtobufCMessage **submessage = *(ProtobufCMessage ***)field; + unsigned j; + for (j = 0; j < *quantity; j++) { + if (!protobuf_c_message_check(submessage[j])) return FALSE; + } + } else if (type == PROTOBUF_C_TYPE_STRING) { + char **string = *(char ***)field; + unsigned j; + for (j = 0; j < *quantity; j++) { + if (!string[j]) return FALSE; + } + } else if (type == PROTOBUF_C_TYPE_BYTES) { + ProtobufCBinaryData *bd = *(ProtobufCBinaryData **)field; + unsigned j; + for (j = 0; j < *quantity; j++) { + if (bd[j].len > 0 && bd[j].data == NULL) return FALSE; + } + } + + } else { /* PROTOBUF_C_LABEL_REQUIRED or PROTOBUF_C_LABEL_OPTIONAL */ + + if (type == PROTOBUF_C_TYPE_MESSAGE) { + ProtobufCMessage *submessage = *(ProtobufCMessage **)field; + if (label == PROTOBUF_C_LABEL_REQUIRED || submessage != NULL) { + if (!protobuf_c_message_check(submessage)) return FALSE; + } + } else if (type == PROTOBUF_C_TYPE_STRING) { + char *string = *(char **)field; + if (label == PROTOBUF_C_LABEL_REQUIRED && string == NULL) return FALSE; + } else if (type == PROTOBUF_C_TYPE_BYTES) { + protobuf_c_boolean *has = + STRUCT_MEMBER_P(message, f->quantifier_offset); + ProtobufCBinaryData *bd = field; + if (label == PROTOBUF_C_LABEL_REQUIRED || *has == TRUE) { + if (bd->len > 0 && bd->data == NULL) return FALSE; + } + } + } + } + + return TRUE; +} + +/* === services === */ + +typedef void (*GenericHandler)(void *service, const ProtobufCMessage *input, + ProtobufCClosure closure, void *closure_data); +void protobuf_c_service_invoke_internal(ProtobufCService *service, + unsigned method_index, + const ProtobufCMessage *input, + ProtobufCClosure closure, + void *closure_data) { + GenericHandler *handlers; + GenericHandler handler; + + /* + * Verify that method_index is within range. If this fails, you are + * likely invoking a newly added method on an old service. (Although + * other memory corruption bugs can cause this assertion too.) + */ + assert(method_index < service->descriptor->n_methods); + + /* + * Get the array of virtual methods (which are enumerated by the + * generated code). + */ + handlers = (GenericHandler *)(service + 1); + + /* + * Get our method and invoke it. + * \todo Seems like handler == NULL is a situation that needs handling. + */ + handler = handlers[method_index]; + (*handler)(service, input, closure, closure_data); +} + +void protobuf_c_service_generated_init( + ProtobufCService *service, const ProtobufCServiceDescriptor *descriptor, + ProtobufCServiceDestroy destroy) { + ASSERT_IS_SERVICE_DESCRIPTOR(descriptor); + service->descriptor = descriptor; + service->destroy = destroy; + service->invoke = protobuf_c_service_invoke_internal; + memset(service + 1, 0, descriptor->n_methods * sizeof(GenericHandler)); +} + +void protobuf_c_service_destroy(ProtobufCService *service) { + service->destroy(service); +} + +/* --- querying the descriptors --- */ + +const ProtobufCEnumValue *protobuf_c_enum_descriptor_get_value_by_name( + const ProtobufCEnumDescriptor *desc, const char *name) { + unsigned start = 0; + unsigned count; + + if (desc == NULL || desc->values_by_name == NULL) return NULL; + + count = desc->n_value_names; + + while (count > 1) { + unsigned mid = start + count / 2; + int rv = strcmp(desc->values_by_name[mid].name, name); + if (rv == 0) + return desc->values + desc->values_by_name[mid].index; + else if (rv < 0) { + count = start + count - (mid + 1); + start = mid + 1; + } else + count = mid - start; + } + if (count == 0) return NULL; + if (strcmp(desc->values_by_name[start].name, name) == 0) + return desc->values + desc->values_by_name[start].index; + return NULL; +} + +const ProtobufCEnumValue *protobuf_c_enum_descriptor_get_value( + const ProtobufCEnumDescriptor *desc, int value) { + int rv = int_range_lookup(desc->n_value_ranges, desc->value_ranges, value); + if (rv < 0) return NULL; + return desc->values + rv; +} + +const ProtobufCFieldDescriptor *protobuf_c_message_descriptor_get_field_by_name( + const ProtobufCMessageDescriptor *desc, const char *name) { + unsigned start = 0; + unsigned count; + const ProtobufCFieldDescriptor *field; + + if (desc == NULL || desc->fields_sorted_by_name == NULL) return NULL; + + count = desc->n_fields; + + while (count > 1) { + unsigned mid = start + count / 2; + int rv; + field = desc->fields + desc->fields_sorted_by_name[mid]; + rv = strcmp(field->name, name); + if (rv == 0) + return field; + else if (rv < 0) { + count = start + count - (mid + 1); + start = mid + 1; + } else + count = mid - start; + } + if (count == 0) return NULL; + field = desc->fields + desc->fields_sorted_by_name[start]; + if (strcmp(field->name, name) == 0) return field; + return NULL; +} + +const ProtobufCFieldDescriptor *protobuf_c_message_descriptor_get_field( + const ProtobufCMessageDescriptor *desc, unsigned value) { + int rv = int_range_lookup(desc->n_field_ranges, desc->field_ranges, value); + if (rv < 0) return NULL; + return desc->fields + rv; +} + +const ProtobufCMethodDescriptor * +protobuf_c_service_descriptor_get_method_by_name( + const ProtobufCServiceDescriptor *desc, const char *name) { + unsigned start = 0; + unsigned count; + + if (desc == NULL || desc->method_indices_by_name == NULL) return NULL; + + count = desc->n_methods; + + while (count > 1) { + unsigned mid = start + count / 2; + unsigned mid_index = desc->method_indices_by_name[mid]; + const char *mid_name = desc->methods[mid_index].name; + int rv = strcmp(mid_name, name); + + if (rv == 0) return desc->methods + desc->method_indices_by_name[mid]; + if (rv < 0) { + count = start + count - (mid + 1); + start = mid + 1; + } else { + count = mid - start; + } + } + if (count == 0) return NULL; + if (strcmp(desc->methods[desc->method_indices_by_name[start]].name, name) == + 0) + return desc->methods + desc->method_indices_by_name[start]; + return NULL; +} diff --git a/src/common/protobuf-c.h b/src/common/protobuf-c.h new file mode 100644 index 0000000000000000000000000000000000000000..a04559d79a02cf11d2b8f5f168c34377c313bc9a --- /dev/null +++ b/src/common/protobuf-c.h @@ -0,0 +1,1030 @@ +/* + * Copyright (c) 2008-2017, Dave Benson and the protobuf-c authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * \mainpage Introduction + * + * This is [protobuf-c], a C implementation of [Protocol Buffers]. + * + * This file defines the public API for the `libprotobuf-c` support library. + * This API includes interfaces that can be used directly by client code as well + * as the interfaces used by the code generated by the `protoc-c` compiler. + * + * The `libprotobuf-c` support library performs the actual serialization and + * deserialization of Protocol Buffers messages. It interacts with structures, + * definitions, and metadata generated by the `protoc-c` compiler from .proto + * files. + * + * \authors Dave Benson and the `protobuf-c` authors. + * + * \copyright 2008-2014. Licensed under the terms of the [BSD-2-Clause] license. + * + * [protobuf-c]: https://github.com/protobuf-c/protobuf-c + * [Protocol Buffers]: https://developers.google.com/protocol-buffers/ + * [BSD-2-Clause]: http://opensource.org/licenses/BSD-2-Clause + * + * \page gencode Generated Code + * + * For each enum, we generate a C enum. For each message, we generate a C + * structure which can be cast to a `ProtobufCMessage`. + * + * For each enum and message, we generate a descriptor object that allows us to + * implement a kind of reflection on the structures. + * + * First, some naming conventions: + * + * - The name of the type for enums and messages and services is camel case + * (meaning WordsAreCrammedTogether) except that double underscores are used + * to delimit scopes. For example, the following `.proto` file: + * +~~~{.proto} + package foo.bar; + message BazBah { + optional int32 val = 1; + } +~~~ + * + * would generate a C type `Foo__Bar__BazBah`. + * + * - Identifiers for functions and globals are all lowercase, with camel case + * words separated by single underscores. For example, one of the function + * prototypes generated by `protoc-c` for the above example: + * +~~~{.c} +Foo__Bar__BazBah * + foo__bar__baz_bah__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +~~~ + * + * - Identifiers for enum values contain an uppercase prefix which embeds the + * package name and the enum type name. + * + * - A double underscore is used to separate further components of identifier + * names. + * + * For example, in the name of the unpack function above, the package name + * `foo.bar` has become `foo__bar`, the message name BazBah has become + * `baz_bah`, and the method name is `unpack`. These are all joined with double + * underscores to form the C identifier `foo__bar__baz_bah__unpack`. + * + * We also generate descriptor objects for messages and enums. These are + * declared in the `.pb-c.h` files: + * +~~~{.c} +extern const ProtobufCMessageDescriptor foo__bar__baz_bah__descriptor; +~~~ + * + * The message structures all begin with `ProtobufCMessageDescriptor *` which is + * sufficient to allow them to be cast to `ProtobufCMessage`. + * + * For each message defined in a `.proto` file, we generate a number of + * functions and macros. Each function name contains a prefix based on the + * package name and message name in order to make it a unique C identifier. + * + * - `INIT`. Statically initializes a message object, initializing its + * descriptor and setting its fields to default values. Uninitialized + * messages cannot be processed by the protobuf-c library. + * +~~~{.c} +#define FOO__BAR__BAZ_BAH__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&foo__bar__baz_bah__descriptor), 0 } +~~~ + * - `init()`. Initializes a message object, initializing its descriptor and + * setting its fields to default values. Uninitialized messages cannot be + * processed by the protobuf-c library. + * +~~~{.c} +void foo__bar__baz_bah__init + (Foo__Bar__BazBah *message); +~~~ + * - `unpack()`. Unpacks data for a particular message format. Note that the + * `allocator` parameter is usually `NULL` to indicate that the system's + * `malloc()` and `free()` functions should be used for dynamically allocating + * memory. + * +~~~{.c} +Foo__Bar__BazBah * + foo__bar__baz_bah__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +~~~ + * + * - `free_unpacked()`. Frees a message object obtained with the `unpack()` + * method. Freeing `NULL` is allowed (the same as with `free()`). + * +~~~{.c} +void foo__bar__baz_bah__free_unpacked + (Foo__Bar__BazBah *message, + ProtobufCAllocator *allocator); +~~~ + * + * - `get_packed_size()`. Calculates the length in bytes of the serialized + * representation of the message object. + * +~~~{.c} +size_t foo__bar__baz_bah__get_packed_size + (const Foo__Bar__BazBah *message); +~~~ + * + * - `pack()`. Pack a message object into a preallocated buffer. Assumes that + * the buffer is large enough. (Use `get_packed_size()` first.) + * +~~~{.c} +size_t foo__bar__baz_bah__pack + (const Foo__Bar__BazBah *message, + uint8_t *out); +~~~ + * + * - `pack_to_buffer()`. Packs a message into a "virtual buffer". This is an + * object which defines an "append bytes" callback to consume data as it is + * serialized. + * +~~~{.c} +size_t foo__bar__baz_bah__pack_to_buffer + (const Foo__Bar__BazBah *message, + ProtobufCBuffer *buffer); +~~~ + * + * \page pack Packing and unpacking messages + * + * To pack a message, first compute the packed size of the message with + * protobuf_c_message_get_packed_size(), then allocate a buffer of at least + * that size, then call protobuf_c_message_pack(). + * + * Alternatively, a message can be serialized without calculating the final size + * first. Use the protobuf_c_message_pack_to_buffer() function and provide a + * ProtobufCBuffer object which implements an "append" method that consumes + * data. + * + * To unpack a message, call the protobuf_c_message_unpack() function. The + * result can be cast to an object of the type that matches the descriptor for + * the message. + * + * The result of unpacking a message should be freed with + * protobuf_c_message_free_unpacked(). + */ + +#ifndef PROTOBUF_C_H +#define PROTOBUF_C_H + +#include +#include +#include +#include + +#ifdef __cplusplus +#define PROTOBUF_C__BEGIN_DECLS extern "C" { +#define PROTOBUF_C__END_DECLS } +#else +#define PROTOBUF_C__BEGIN_DECLS +#define PROTOBUF_C__END_DECLS +#endif + +PROTOBUF_C__BEGIN_DECLS + +#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB) +#ifdef PROTOBUF_C_EXPORT +#define PROTOBUF_C__API __declspec(dllexport) +#else +#define PROTOBUF_C__API __declspec(dllimport) +#endif +#else +#define PROTOBUF_C__API +#endif + +#if !defined(PROTOBUF_C__NO_DEPRECATED) && \ + ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#define PROTOBUF_C__DEPRECATED __attribute__((__deprecated__)) +#else +#define PROTOBUF_C__DEPRECATED +#endif + +#ifndef PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE +#define PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(enum_name) \ + , _##enum_name##_IS_INT_SIZE = INT_MAX +#endif + +#define PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC 0x14159bc3 +#define PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC 0x28aaeef9 +#define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af + +/* Empty string used for initializers */ +extern const char protobuf_c_empty_string[]; + +/** + * \defgroup api Public API + * + * This is the public API for `libprotobuf-c`. These interfaces are stable and + * subject to Semantic Versioning guarantees. + * + * @{ + */ + +/** + * Values for the `flags` word in `ProtobufCFieldDescriptor`. + */ +typedef enum { + /** Set if the field is repeated and marked with the `packed` option. */ + PROTOBUF_C_FIELD_FLAG_PACKED = (1 << 0), + + /** Set if the field is marked with the `deprecated` option. */ + PROTOBUF_C_FIELD_FLAG_DEPRECATED = (1 << 1), + + /** Set if the field is a member of a oneof (union). */ + PROTOBUF_C_FIELD_FLAG_ONEOF = (1 << 2), +} ProtobufCFieldFlag; + +/** + * Message field rules. + * + * \see [Defining A Message Type] in the Protocol Buffers documentation. + * + * [Defining A Message Type]: + * https://developers.google.com/protocol-buffers/docs/proto#simple + */ +typedef enum { + /** A well-formed message must have exactly one of this field. */ + PROTOBUF_C_LABEL_REQUIRED, + + /** + * A well-formed message can have zero or one of this field (but not + * more than one). + */ + PROTOBUF_C_LABEL_OPTIONAL, + + /** + * This field can be repeated any number of times (including zero) in a + * well-formed message. The order of the repeated values will be + * preserved. + */ + PROTOBUF_C_LABEL_REPEATED, + + /** + * This field has no label. This is valid only in proto3 and is + * equivalent to OPTIONAL but no "has" quantifier will be consulted. + */ + PROTOBUF_C_LABEL_NONE, +} ProtobufCLabel; + +/** + * Field value types. + * + * \see [Scalar Value Types] in the Protocol Buffers documentation. + * + * [Scalar Value Types]: + * https://developers.google.com/protocol-buffers/docs/proto#scalar + */ +typedef enum { + PROTOBUF_C_TYPE_INT32, /**< int32 */ + PROTOBUF_C_TYPE_SINT32, /**< signed int32 */ + PROTOBUF_C_TYPE_SFIXED32, /**< signed int32 (4 bytes) */ + PROTOBUF_C_TYPE_INT64, /**< int64 */ + PROTOBUF_C_TYPE_SINT64, /**< signed int64 */ + PROTOBUF_C_TYPE_SFIXED64, /**< signed int64 (8 bytes) */ + PROTOBUF_C_TYPE_UINT32, /**< unsigned int32 */ + PROTOBUF_C_TYPE_FIXED32, /**< unsigned int32 (4 bytes) */ + PROTOBUF_C_TYPE_UINT64, /**< unsigned int64 */ + PROTOBUF_C_TYPE_FIXED64, /**< unsigned int64 (8 bytes) */ + PROTOBUF_C_TYPE_FLOAT, /**< float */ + PROTOBUF_C_TYPE_DOUBLE, /**< double */ + PROTOBUF_C_TYPE_BOOL, /**< boolean */ + PROTOBUF_C_TYPE_ENUM, /**< enumerated type */ + PROTOBUF_C_TYPE_STRING, /**< UTF-8 or ASCII string */ + PROTOBUF_C_TYPE_BYTES, /**< arbitrary byte sequence */ + PROTOBUF_C_TYPE_MESSAGE, /**< nested message */ +} ProtobufCType; + +/** + * Field wire types. + * + * \see [Message Structure] in the Protocol Buffers documentation. + * + * [Message Structure]: + * https://developers.google.com/protocol-buffers/docs/encoding#structure + */ +typedef enum { + PROTOBUF_C_WIRE_TYPE_VARINT = 0, + PROTOBUF_C_WIRE_TYPE_64BIT = 1, + PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED = 2, + /* "Start group" and "end group" wire types are unsupported. */ + PROTOBUF_C_WIRE_TYPE_32BIT = 5, +} ProtobufCWireType; + +struct ProtobufCAllocator; +struct ProtobufCBinaryData; +struct ProtobufCBuffer; +struct ProtobufCBufferSimple; +struct ProtobufCEnumDescriptor; +struct ProtobufCEnumValue; +struct ProtobufCEnumValueIndex; +struct ProtobufCFieldDescriptor; +struct ProtobufCIntRange; +struct ProtobufCMessage; +struct ProtobufCMessageDescriptor; +struct ProtobufCMessageUnknownField; +struct ProtobufCMethodDescriptor; +struct ProtobufCService; +struct ProtobufCServiceDescriptor; + +typedef struct ProtobufCAllocator ProtobufCAllocator; +typedef struct ProtobufCBinaryData ProtobufCBinaryData; +typedef struct ProtobufCBuffer ProtobufCBuffer; +typedef struct ProtobufCBufferSimple ProtobufCBufferSimple; +typedef struct ProtobufCEnumDescriptor ProtobufCEnumDescriptor; +typedef struct ProtobufCEnumValue ProtobufCEnumValue; +typedef struct ProtobufCEnumValueIndex ProtobufCEnumValueIndex; +typedef struct ProtobufCFieldDescriptor ProtobufCFieldDescriptor; +typedef struct ProtobufCIntRange ProtobufCIntRange; +typedef struct ProtobufCMessage ProtobufCMessage; +typedef struct ProtobufCMessageDescriptor ProtobufCMessageDescriptor; +typedef struct ProtobufCMessageUnknownField ProtobufCMessageUnknownField; +typedef struct ProtobufCMethodDescriptor ProtobufCMethodDescriptor; +typedef struct ProtobufCService ProtobufCService; +typedef struct ProtobufCServiceDescriptor ProtobufCServiceDescriptor; + +/** Boolean type. */ +typedef int protobuf_c_boolean; + +typedef void (*ProtobufCClosure)(const ProtobufCMessage *, void *closure_data); +typedef void (*ProtobufCMessageInit)(ProtobufCMessage *); +typedef void (*ProtobufCServiceDestroy)(ProtobufCService *); + +/** + * Structure for defining a custom memory allocator. + */ +struct ProtobufCAllocator { + /** Function to allocate memory. */ + void *(*alloc)(void *allocator_data, size_t size); + + /** Function to free memory. */ + void (*free)(void *allocator_data, void *pointer); + + /** Opaque pointer passed to `alloc` and `free` functions. */ + void *allocator_data; +}; + +/** + * Structure for the protobuf `bytes` scalar type. + * + * The data contained in a `ProtobufCBinaryData` is an arbitrary sequence of + * bytes. It may contain embedded `NUL` characters and is not required to be + * `NUL`-terminated. + */ +struct ProtobufCBinaryData { + size_t len; /**< Number of bytes in the `data` field. */ + uint8_t *data; /**< Data bytes. */ +}; + +/** + * Structure for defining a virtual append-only buffer. Used by + * protobuf_c_message_pack_to_buffer() to abstract the consumption of serialized + * bytes. + * + * `ProtobufCBuffer` "subclasses" may be defined on the stack. For example, to + * write to a `FILE` object: + * +~~~{.c} +typedef struct { + ProtobufCBuffer base; + FILE *fp; +} BufferAppendToFile; + +static void +my_buffer_file_append(ProtobufCBuffer *buffer, + size_t len, + const uint8_t *data) +{ + BufferAppendToFile *file_buf = (BufferAppendToFile *) buffer; + fwrite(data, len, 1, file_buf->fp); // XXX: No error handling! +} +~~~ + * + * To use this new type of ProtobufCBuffer, it could be called as follows: + * +~~~{.c} +... +BufferAppendToFile tmp = {0}; +tmp.base.append = my_buffer_file_append; +tmp.fp = fp; +protobuf_c_message_pack_to_buffer(&message, &tmp); +... +~~~ + */ +struct ProtobufCBuffer { + /** Append function. Consumes the `len` bytes stored at `data`. */ + void (*append)(ProtobufCBuffer *buffer, size_t len, const uint8_t *data); +}; + +/** + * Simple buffer "subclass" of `ProtobufCBuffer`. + * + * A `ProtobufCBufferSimple` object is declared on the stack and uses a + * scratch buffer provided by the user for the initial allocation. It performs + * exponential resizing, using dynamically allocated memory. A + * `ProtobufCBufferSimple` object can be created and used as follows: + * +~~~{.c} +uint8_t pad[128]; +ProtobufCBufferSimple simple = PROTOBUF_C_BUFFER_SIMPLE_INIT(pad); +ProtobufCBuffer *buffer = (ProtobufCBuffer *) &simple; +~~~ + * + * `buffer` can now be used with `protobuf_c_message_pack_to_buffer()`. Once a + * message has been serialized to a `ProtobufCBufferSimple` object, the + * serialized data bytes can be accessed from the `.data` field. + * + * To free the memory allocated by a `ProtobufCBufferSimple` object, if any, + * call PROTOBUF_C_BUFFER_SIMPLE_CLEAR() on the object, for example: + * +~~~{.c} +PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple); +~~~ + * + * \see PROTOBUF_C_BUFFER_SIMPLE_INIT + * \see PROTOBUF_C_BUFFER_SIMPLE_CLEAR + */ +struct ProtobufCBufferSimple { + /** "Base class". */ + ProtobufCBuffer base; + /** Number of bytes allocated in `data`. */ + size_t alloced; + /** Number of bytes currently stored in `data`. */ + size_t len; + /** Data bytes. */ + uint8_t *data; + /** Whether `data` must be freed. */ + protobuf_c_boolean must_free_data; + /** Allocator to use. May be NULL to indicate the system allocator. */ + ProtobufCAllocator *allocator; +}; + +/** + * Describes an enumeration as a whole, with all of its values. + */ +struct ProtobufCEnumDescriptor { + /** Magic value checked to ensure that the API is used correctly. */ + uint32_t magic; + + /** The qualified name (e.g., "namespace.Type"). */ + const char *name; + /** The unqualified name as given in the .proto file (e.g., "Type"). */ + const char *short_name; + /** Identifier used in generated C code. */ + const char *c_name; + /** The dot-separated namespace. */ + const char *package_name; + + /** Number elements in `values`. */ + unsigned n_values; + /** Array of distinct values, sorted by numeric value. */ + const ProtobufCEnumValue *values; + + /** Number of elements in `values_by_name`. */ + unsigned n_value_names; + /** Array of named values, including aliases, sorted by name. */ + const ProtobufCEnumValueIndex *values_by_name; + + /** Number of elements in `value_ranges`. */ + unsigned n_value_ranges; + /** Value ranges, for faster lookups by numeric value. */ + const ProtobufCIntRange *value_ranges; + + /** Reserved for future use. */ + void *reserved1; + /** Reserved for future use. */ + void *reserved2; + /** Reserved for future use. */ + void *reserved3; + /** Reserved for future use. */ + void *reserved4; +}; + +/** + * Represents a single value of an enumeration. + */ +struct ProtobufCEnumValue { + /** The string identifying this value in the .proto file. */ + const char *name; + + /** The string identifying this value in generated C code. */ + const char *c_name; + + /** The numeric value assigned in the .proto file. */ + int value; +}; + +/** + * Used by `ProtobufCEnumDescriptor` to look up enum values. + */ +struct ProtobufCEnumValueIndex { + /** Name of the enum value. */ + const char *name; + /** Index into values[] array. */ + unsigned index; +}; + +/** + * Describes a single field in a message. + */ +struct ProtobufCFieldDescriptor { + /** Name of the field as given in the .proto file. */ + const char *name; + + /** Tag value of the field as given in the .proto file. */ + uint32_t id; + + /** Whether the field is `REQUIRED`, `OPTIONAL`, or `REPEATED`. */ + ProtobufCLabel label; + + /** The type of the field. */ + ProtobufCType type; + + /** + * The offset in bytes of the message's C structure's quantifier field + * (the `has_MEMBER` field for optional members or the `n_MEMBER` field + * for repeated members or the case enum for oneofs). + */ + unsigned quantifier_offset; + + /** + * The offset in bytes into the message's C structure for the member + * itself. + */ + unsigned offset; + + /** + * A type-specific descriptor. + * + * If `type` is `PROTOBUF_C_TYPE_ENUM`, then `descriptor` points to the + * corresponding `ProtobufCEnumDescriptor`. + * + * If `type` is `PROTOBUF_C_TYPE_MESSAGE`, then `descriptor` points to + * the corresponding `ProtobufCMessageDescriptor`. + * + * Otherwise this field is NULL. + */ + const void *descriptor; /* for MESSAGE and ENUM types */ + + /** The default value for this field, if defined. May be NULL. */ + const void *default_value; + + /** + * A flag word. Zero or more of the bits defined in the + * `ProtobufCFieldFlag` enum may be set. + */ + uint32_t flags; + + /** Reserved for future use. */ + unsigned reserved_flags; + /** Reserved for future use. */ + void *reserved2; + /** Reserved for future use. */ + void *reserved3; +}; + +/** + * Helper structure for optimizing int => index lookups in the case + * where the keys are mostly consecutive values, as they presumably are for + * enums and fields. + * + * The data structures requires that the values in the original array are + * sorted. + */ +struct ProtobufCIntRange { + int start_value; + unsigned orig_index; + /* + * NOTE: the number of values in the range can be inferred by looking + * at the next element's orig_index. A dummy element is added to make + * this simple. + */ +}; + +/** + * An instance of a message. + * + * `ProtobufCMessage` is a light-weight "base class" for all messages. + * + * In particular, `ProtobufCMessage` doesn't have any allocation policy + * associated with it. That's because it's common to create `ProtobufCMessage` + * objects on the stack. In fact, that's what we recommend for sending messages. + * If the object is allocated from the stack, you can't really have a memory + * leak. + * + * This means that calls to functions like protobuf_c_message_unpack() which + * return a `ProtobufCMessage` must be paired with a call to a free function, + * like protobuf_c_message_free_unpacked(). + */ +struct ProtobufCMessage { + /** The descriptor for this message type. */ + const ProtobufCMessageDescriptor *descriptor; + /** The number of elements in `unknown_fields`. */ + unsigned n_unknown_fields; + /** The fields that weren't recognized by the parser. */ + ProtobufCMessageUnknownField *unknown_fields; +}; + +/** + * Describes a message. + */ +struct ProtobufCMessageDescriptor { + /** Magic value checked to ensure that the API is used correctly. */ + uint32_t magic; + + /** The qualified name (e.g., "namespace.Type"). */ + const char *name; + /** The unqualified name as given in the .proto file (e.g., "Type"). */ + const char *short_name; + /** Identifier used in generated C code. */ + const char *c_name; + /** The dot-separated namespace. */ + const char *package_name; + + /** + * Size in bytes of the C structure representing an instance of this + * type of message. + */ + size_t sizeof_message; + + /** Number of elements in `fields`. */ + unsigned n_fields; + /** Field descriptors, sorted by tag number. */ + const ProtobufCFieldDescriptor *fields; + /** Used for looking up fields by name. */ + const unsigned *fields_sorted_by_name; + + /** Number of elements in `field_ranges`. */ + unsigned n_field_ranges; + /** Used for looking up fields by id. */ + const ProtobufCIntRange *field_ranges; + + /** Message initialisation function. */ + ProtobufCMessageInit message_init; + + /** Reserved for future use. */ + void *reserved1; + /** Reserved for future use. */ + void *reserved2; + /** Reserved for future use. */ + void *reserved3; +}; + +/** + * An unknown message field. + */ +struct ProtobufCMessageUnknownField { + /** The tag number. */ + uint32_t tag; + /** The wire type of the field. */ + ProtobufCWireType wire_type; + /** Number of bytes in `data`. */ + size_t len; + /** Field data. */ + uint8_t *data; +}; + +/** + * Method descriptor. + */ +struct ProtobufCMethodDescriptor { + /** Method name. */ + const char *name; + /** Input message descriptor. */ + const ProtobufCMessageDescriptor *input; + /** Output message descriptor. */ + const ProtobufCMessageDescriptor *output; +}; + +/** + * Service. + */ +struct ProtobufCService { + /** Service descriptor. */ + const ProtobufCServiceDescriptor *descriptor; + /** Function to invoke the service. */ + void (*invoke)(ProtobufCService *service, unsigned method_index, + const ProtobufCMessage *input, ProtobufCClosure closure, + void *closure_data); + /** Function to destroy the service. */ + void (*destroy)(ProtobufCService *service); +}; + +/** + * Service descriptor. + */ +struct ProtobufCServiceDescriptor { + /** Magic value checked to ensure that the API is used correctly. */ + uint32_t magic; + + /** Service name. */ + const char *name; + /** Short version of service name. */ + const char *short_name; + /** C identifier for the service name. */ + const char *c_name; + /** Package name. */ + const char *package; + /** Number of elements in `methods`. */ + unsigned n_methods; + /** Method descriptors, in the order defined in the .proto file. */ + const ProtobufCMethodDescriptor *methods; + /** Sort index of methods. */ + const unsigned *method_indices_by_name; +}; + +/** + * Get the version of the protobuf-c library. Note that this is the version of + * the library linked against, not the version of the headers compiled against. + * + * \return A string containing the version number of protobuf-c. + */ +PROTOBUF_C__API +const char *protobuf_c_version(void); + +/** + * Get the version of the protobuf-c library. Note that this is the version of + * the library linked against, not the version of the headers compiled against. + * + * \return A 32 bit unsigned integer containing the version number of + * protobuf-c, represented in base-10 as (MAJOR*1E6) + (MINOR*1E3) + PATCH. + */ +PROTOBUF_C__API +uint32_t protobuf_c_version_number(void); + +/** + * The version of the protobuf-c headers, represented as a string using the same + * format as protobuf_c_version(). + */ +#define PROTOBUF_C_VERSION "1.3.0" + +/** + * The version of the protobuf-c headers, represented as an integer using the + * same format as protobuf_c_version_number(). + */ +#define PROTOBUF_C_VERSION_NUMBER 1003000 + +/** + * The minimum protoc-c version which works with the current version of the + * protobuf-c headers. + */ +#define PROTOBUF_C_MIN_COMPILER_VERSION 1000000 + +/** + * Look up a `ProtobufCEnumValue` from a `ProtobufCEnumDescriptor` by name. + * + * \param desc + * The `ProtobufCEnumDescriptor` object. + * \param name + * The `name` field from the corresponding `ProtobufCEnumValue` object to + * match. + * \return + * A `ProtobufCEnumValue` object. + * \retval NULL + * If not found or if the optimize_for = CODE_SIZE option was set. + */ +PROTOBUF_C__API +const ProtobufCEnumValue *protobuf_c_enum_descriptor_get_value_by_name( + const ProtobufCEnumDescriptor *desc, const char *name); + +/** + * Look up a `ProtobufCEnumValue` from a `ProtobufCEnumDescriptor` by numeric + * value. + * + * \param desc + * The `ProtobufCEnumDescriptor` object. + * \param value + * The `value` field from the corresponding `ProtobufCEnumValue` object to + * match. + * + * \return + * A `ProtobufCEnumValue` object. + * \retval NULL + * If not found. + */ +PROTOBUF_C__API +const ProtobufCEnumValue *protobuf_c_enum_descriptor_get_value( + const ProtobufCEnumDescriptor *desc, int value); + +/** + * Look up a `ProtobufCFieldDescriptor` from a `ProtobufCMessageDescriptor` by + * the name of the field. + * + * \param desc + * The `ProtobufCMessageDescriptor` object. + * \param name + * The name of the field. + * \return + * A `ProtobufCFieldDescriptor` object. + * \retval NULL + * If not found or if the optimize_for = CODE_SIZE option was set. + */ +PROTOBUF_C__API +const ProtobufCFieldDescriptor *protobuf_c_message_descriptor_get_field_by_name( + const ProtobufCMessageDescriptor *desc, const char *name); + +/** + * Look up a `ProtobufCFieldDescriptor` from a `ProtobufCMessageDescriptor` by + * the tag value of the field. + * + * \param desc + * The `ProtobufCMessageDescriptor` object. + * \param value + * The tag value of the field. + * \return + * A `ProtobufCFieldDescriptor` object. + * \retval NULL + * If not found. + */ +PROTOBUF_C__API +const ProtobufCFieldDescriptor *protobuf_c_message_descriptor_get_field( + const ProtobufCMessageDescriptor *desc, unsigned value); + +/** + * Determine the number of bytes required to store the serialised message. + * + * \param message + * The message object to serialise. + * \return + * Number of bytes. + */ +PROTOBUF_C__API +size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message); + +/** + * Unpack a serialised message into an in-memory representation. + * + * \param descriptor + * The message descriptor. + * \param allocator + * `ProtobufCAllocator` to use for memory allocation. May be NULL to + * specify the default allocator. + * \param len + * Length in bytes of the serialised message. + * \param data + * Pointer to the serialised message. + * \return + * An unpacked message object. + * \retval NULL + * If an error occurred during unpacking. + */ +PROTOBUF_C__API +ProtobufCMessage *protobuf_c_message_unpack( + const ProtobufCMessageDescriptor *descriptor, ProtobufCAllocator *allocator, + size_t len, const uint8_t *data); + +/** + * Free an unpacked message object. + * + * This function should be used to deallocate the memory used by a call to + * protobuf_c_message_unpack(). + * + * \param message + * The message object to free. May be NULL. + * \param allocator + * `ProtobufCAllocator` to use for memory deallocation. May be NULL to + * specify the default allocator. + */ +PROTOBUF_C__API +void protobuf_c_message_free_unpacked(ProtobufCMessage *message, + ProtobufCAllocator *allocator); + +/** + * Check the validity of a message object. + * + * Makes sure all required fields (`PROTOBUF_C_LABEL_REQUIRED`) are present. + * Recursively checks nested messages. + * + * \retval TRUE + * Message is valid. + * \retval FALSE + * Message is invalid. + */ +PROTOBUF_C__API +protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *); + +/** Message initialiser. */ +#define PROTOBUF_C_MESSAGE_INIT(descriptor) \ + { descriptor, 0, NULL } + +/** + * Initialise a message object from a message descriptor. + * + * \param descriptor + * Message descriptor. + * \param message + * Allocated block of memory of size `descriptor->sizeof_message`. + */ +PROTOBUF_C__API +void protobuf_c_message_init(const ProtobufCMessageDescriptor *descriptor, + void *message); + +/** + * Free a service. + * + * \param service + * The service object to free. + */ +PROTOBUF_C__API +void protobuf_c_service_destroy(ProtobufCService *service); + +/** + * Look up a `ProtobufCMethodDescriptor` by name. + * + * \param desc + * Service descriptor. + * \param name + * Name of the method. + * + * \return + * A `ProtobufCMethodDescriptor` object. + * \retval NULL + * If not found or if the optimize_for = CODE_SIZE option was set. + */ +PROTOBUF_C__API +const ProtobufCMethodDescriptor * +protobuf_c_service_descriptor_get_method_by_name( + const ProtobufCServiceDescriptor *desc, const char *name); + +/** + * Initialise a `ProtobufCBufferSimple` object. + */ +#define PROTOBUF_C_BUFFER_SIMPLE_INIT(array_of_bytes) \ + { \ + {protobuf_c_buffer_simple_append}, sizeof(array_of_bytes), 0, \ + (array_of_bytes), 0, NULL \ + } + +/** + * Clear a `ProtobufCBufferSimple` object, freeing any allocated memory. + */ +#define PROTOBUF_C_BUFFER_SIMPLE_CLEAR(simp_buf) \ + do { \ + if ((simp_buf)->must_free_data) { \ + if ((simp_buf)->allocator != NULL) \ + (simp_buf)->allocator->free((simp_buf)->allocator, (simp_buf)->data); \ + else \ + free((simp_buf)->data); \ + } \ + } while (0) + +/** + * The `append` method for `ProtobufCBufferSimple`. + * + * \param buffer + * The buffer object to append to. Must actually be a + * `ProtobufCBufferSimple` object. + * \param len + * Number of bytes in `data`. + * \param data + * Data to append. + */ +PROTOBUF_C__API +void protobuf_c_buffer_simple_append(ProtobufCBuffer *buffer, size_t len, + const unsigned char *data); + +PROTOBUF_C__API +void protobuf_c_service_generated_init( + ProtobufCService *service, const ProtobufCServiceDescriptor *descriptor, + ProtobufCServiceDestroy destroy); + +PROTOBUF_C__API +void protobuf_c_service_invoke_internal(ProtobufCService *service, + unsigned method_index, + const ProtobufCMessage *input, + ProtobufCClosure closure, + void *closure_data); + +/**@}*/ + +PROTOBUF_C__END_DECLS + +#endif /* PROTOBUF_C_H */ diff --git a/src/common/type_define.h b/src/common/type_define.h index 98b36f0d1734f594b6a1a707c1cd130fd447f331..63665bf7933f773b2b3de40ade9c700e3e93e6a9 100644 --- a/src/common/type_define.h +++ b/src/common/type_define.h @@ -16,6 +16,7 @@ limitations under the License. */ #include #include +#include #include #include "framework/attribute.h" #include "framework/scope.h" diff --git a/src/framework/attribute.h b/src/framework/attribute.h index bf6b084fbad29ab68ed31af2b9aaca0db303a568..b77d94521e8be9bdfdfd00ca1628bdefc60d688d 100644 --- a/src/framework/attribute.h +++ b/src/framework/attribute.h @@ -14,9 +14,11 @@ limitations under the License. */ #pragma once +#include +#include "common/enforce.h" #include "common/log.h" #include "common/variant.h" -#include "framework/framework.pb.h" +#include "framework/framework.pb-c.h" namespace paddle_mobile { namespace framework { @@ -25,67 +27,80 @@ class BlockDesc; class Attribute { public: - static Attribute GetAttrValue(const proto::OpDesc::Attr &attr_desc) { + /* + * PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT = 0, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOAT = 1, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRING = 2, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INTS = 3, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOATS = 4, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRINGS = 5, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEAN = 6, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEANS = 7, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BLOCK = 8, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__LONG = 9 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE) + * + * */ + static Attribute GetAttrValue( + PaddleMobile__Framework__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()); + switch (attr_desc->type) { + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEAN: { + attr.Set(attr_desc->b); break; } - case proto::AttrType::INT: { - attr.Set(attr_desc.i()); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT: { + attr.Set(attr_desc->i); break; } - case proto::AttrType::FLOAT: { - attr.Set(attr_desc.f()); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOAT: { + attr.Set(attr_desc->f); break; } - case proto::AttrType::STRING: { - attr.Set(attr_desc.s()); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRING: { + attr.Set(std::string(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); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEANS: { + std::vector val(attr_desc->n_bools); + for (int i = 0; i < attr_desc->n_bools; ++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); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INTS: { + std::vector val(attr_desc->n_ints); + for (int i = 0; i < attr_desc->n_ints; ++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); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOATS: { + std::vector val(attr_desc->n_floats); + for (int i = 0; i < attr_desc->n_floats; ++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); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRINGS: { + std::vector val(attr_desc->n_strings); + for (int i = 0; i < attr_desc->n_strings; ++i) { + val[i] = attr_desc->strings[i]; } attr.Set>(val); break; } - case proto::AttrType::LONG: { - attr.Set(attr_desc.l()); + case PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__LONG: { + attr.Set(attr_desc->l); break; } default: - // std::cout << " not support " << std::endl; - break; + PADDLE_MOBILE_THROW_EXCEPTION("attr type not support"); } - // std::cout << "end get attr value" << std::endl; return attr; } diff --git a/src/framework/data_type.h b/src/framework/data_type.h index 6ad703beca449720c02c0ba04713c43863431ce2..ddfc0dcc4adf8e5897f5f4ea67f9514889863f32 100644 --- a/src/framework/data_type.h +++ b/src/framework/data_type.h @@ -14,8 +14,6 @@ limitations under the License. */ #pragma once -#include "framework/framework.pb.h" - namespace paddle_mobile { namespace framework { diff --git a/src/framework/framework.pb-c.c b/src/framework/framework.pb-c.c new file mode 100644 index 0000000000000000000000000000000000000000..aed0a6c9c0614da74a82cea8c7aa705978dddafc --- /dev/null +++ b/src/framework/framework.pb-c.c @@ -0,0 +1,1403 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: framework.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "framework.pb-c.h" +void paddle_mobile__framework__proto__op_desc__attr__init( + PaddleMobile__Framework__Proto__OpDesc__Attr *message) { + static const PaddleMobile__Framework__Proto__OpDesc__Attr init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__OP_DESC__ATTR__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__op_desc__var__init( + PaddleMobile__Framework__Proto__OpDesc__Var *message) { + static const PaddleMobile__Framework__Proto__OpDesc__Var init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__OP_DESC__VAR__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__op_desc__init( + PaddleMobile__Framework__Proto__OpDesc *message) { + static const PaddleMobile__Framework__Proto__OpDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__OP_DESC__INIT; + *message = init_value; +} +size_t paddle_mobile__framework__proto__op_desc__get_packed_size( + const PaddleMobile__Framework__Proto__OpDesc *message) { + assert(message->base.descriptor == + &paddle_mobile__framework__proto__op_desc__descriptor); + return protobuf_c_message_get_packed_size( + (const ProtobufCMessage *)(message)); +} + +PaddleMobile__Framework__Proto__OpDesc * +paddle_mobile__framework__proto__op_desc__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__OpDesc *)protobuf_c_message_unpack( + &paddle_mobile__framework__proto__op_desc__descriptor, allocator, len, + data); +} +void paddle_mobile__framework__proto__op_desc__free_unpacked( + PaddleMobile__Framework__Proto__OpDesc *message, + ProtobufCAllocator *allocator) { + if (!message) return; + assert(message->base.descriptor == + &paddle_mobile__framework__proto__op_desc__descriptor); + protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); +} +void paddle_mobile__framework__proto__op_proto__var__init( + PaddleMobile__Framework__Proto__OpProto__Var *message) { + static const PaddleMobile__Framework__Proto__OpProto__Var init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__OP_PROTO__VAR__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__op_proto__attr__init( + PaddleMobile__Framework__Proto__OpProto__Attr *message) { + static const PaddleMobile__Framework__Proto__OpProto__Attr init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__OP_PROTO__ATTR__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__op_proto__init( + PaddleMobile__Framework__Proto__OpProto *message) { + static const PaddleMobile__Framework__Proto__OpProto init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__OP_PROTO__INIT; + *message = init_value; +} +size_t paddle_mobile__framework__proto__op_proto__get_packed_size( + const PaddleMobile__Framework__Proto__OpProto *message) { + assert(message->base.descriptor == + &paddle_mobile__framework__proto__op_proto__descriptor); + return protobuf_c_message_get_packed_size( + (const ProtobufCMessage *)(message)); +} + +PaddleMobile__Framework__Proto__OpProto * +paddle_mobile__framework__proto__op_proto__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__OpProto *)protobuf_c_message_unpack( + &paddle_mobile__framework__proto__op_proto__descriptor, allocator, len, + data); +} +void paddle_mobile__framework__proto__op_proto__free_unpacked( + PaddleMobile__Framework__Proto__OpProto *message, + ProtobufCAllocator *allocator) { + if (!message) return; + assert(message->base.descriptor == + &paddle_mobile__framework__proto__op_proto__descriptor); + protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); +} +void paddle_mobile__framework__proto__var_type__tensor_desc__init( + PaddleMobile__Framework__Proto__VarType__TensorDesc *message) { + static const PaddleMobile__Framework__Proto__VarType__TensorDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TENSOR_DESC__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__var_type__lo_dtensor_desc__init( + PaddleMobile__Framework__Proto__VarType__LoDTensorDesc *message) { + static const PaddleMobile__Framework__Proto__VarType__LoDTensorDesc + init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__LO_DTENSOR_DESC__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__init( + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc *message) { + static const PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc + init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__LO_DTENSOR_ARRAY_DESC__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__var_type__reader_desc__init( + PaddleMobile__Framework__Proto__VarType__ReaderDesc *message) { + static const PaddleMobile__Framework__Proto__VarType__ReaderDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__READER_DESC__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__var_type__channel_desc__init( + PaddleMobile__Framework__Proto__VarType__ChannelDesc *message) { + static const PaddleMobile__Framework__Proto__VarType__ChannelDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__CHANNEL_DESC__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__var_type__tuple__init( + PaddleMobile__Framework__Proto__VarType__Tuple *message) { + static const PaddleMobile__Framework__Proto__VarType__Tuple init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TUPLE__INIT; + *message = init_value; +} +void paddle_mobile__framework__proto__var_type__init( + PaddleMobile__Framework__Proto__VarType *message) { + static const PaddleMobile__Framework__Proto__VarType init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__INIT; + *message = init_value; +} +size_t paddle_mobile__framework__proto__var_type__get_packed_size( + const PaddleMobile__Framework__Proto__VarType *message) { + assert(message->base.descriptor == + &paddle_mobile__framework__proto__var_type__descriptor); + return protobuf_c_message_get_packed_size( + (const ProtobufCMessage *)(message)); +} +PaddleMobile__Framework__Proto__VarType * +paddle_mobile__framework__proto__var_type__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__VarType *)protobuf_c_message_unpack( + &paddle_mobile__framework__proto__var_type__descriptor, allocator, len, + data); +} +void paddle_mobile__framework__proto__var_type__free_unpacked( + PaddleMobile__Framework__Proto__VarType *message, + ProtobufCAllocator *allocator) { + if (!message) return; + assert(message->base.descriptor == + &paddle_mobile__framework__proto__var_type__descriptor); + protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); +} +void paddle_mobile__framework__proto__var_desc__init( + PaddleMobile__Framework__Proto__VarDesc *message) { + static const PaddleMobile__Framework__Proto__VarDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_DESC__INIT; + *message = init_value; +} +size_t paddle_mobile__framework__proto__var_desc__get_packed_size( + const PaddleMobile__Framework__Proto__VarDesc *message) { + assert(message->base.descriptor == + &paddle_mobile__framework__proto__var_desc__descriptor); + return protobuf_c_message_get_packed_size( + (const ProtobufCMessage *)(message)); +} + +PaddleMobile__Framework__Proto__VarDesc * +paddle_mobile__framework__proto__var_desc__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__VarDesc *)protobuf_c_message_unpack( + &paddle_mobile__framework__proto__var_desc__descriptor, allocator, len, + data); +} +void paddle_mobile__framework__proto__var_desc__free_unpacked( + PaddleMobile__Framework__Proto__VarDesc *message, + ProtobufCAllocator *allocator) { + if (!message) return; + assert(message->base.descriptor == + &paddle_mobile__framework__proto__var_desc__descriptor); + protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); +} +void paddle_mobile__framework__proto__block_desc__init( + PaddleMobile__Framework__Proto__BlockDesc *message) { + static const PaddleMobile__Framework__Proto__BlockDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__BLOCK_DESC__INIT; + *message = init_value; +} +size_t paddle_mobile__framework__proto__block_desc__get_packed_size( + const PaddleMobile__Framework__Proto__BlockDesc *message) { + assert(message->base.descriptor == + &paddle_mobile__framework__proto__block_desc__descriptor); + return protobuf_c_message_get_packed_size( + (const ProtobufCMessage *)(message)); +} + +PaddleMobile__Framework__Proto__BlockDesc * +paddle_mobile__framework__proto__block_desc__unpack( + ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { + return (PaddleMobile__Framework__Proto__BlockDesc *)protobuf_c_message_unpack( + &paddle_mobile__framework__proto__block_desc__descriptor, allocator, len, + data); +} +void paddle_mobile__framework__proto__block_desc__free_unpacked( + PaddleMobile__Framework__Proto__BlockDesc *message, + ProtobufCAllocator *allocator) { + if (!message) return; + assert(message->base.descriptor == + &paddle_mobile__framework__proto__block_desc__descriptor); + protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); +} +void paddle_mobile__framework__proto__program_desc__init( + PaddleMobile__Framework__Proto__ProgramDesc *message) { + static const PaddleMobile__Framework__Proto__ProgramDesc init_value = + PADDLE_MOBILE__FRAMEWORK__PROTO__PROGRAM_DESC__INIT; + *message = init_value; +} +size_t paddle_mobile__framework__proto__program_desc__get_packed_size( + const PaddleMobile__Framework__Proto__ProgramDesc *message) { + assert(message->base.descriptor == + &paddle_mobile__framework__proto__program_desc__descriptor); + return protobuf_c_message_get_packed_size( + (const ProtobufCMessage *)(message)); +} + +PaddleMobile__Framework__Proto__ProgramDesc * +paddle_mobile__framework__proto__program_desc__unpack( + ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { + return (PaddleMobile__Framework__Proto__ProgramDesc *) + protobuf_c_message_unpack( + &paddle_mobile__framework__proto__program_desc__descriptor, allocator, + len, data); +} +void paddle_mobile__framework__proto__program_desc__free_unpacked( + PaddleMobile__Framework__Proto__ProgramDesc *message, + ProtobufCAllocator *allocator) { + if (!message) return; + assert(message->base.descriptor == + &paddle_mobile__framework__proto__program_desc__descriptor); + protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); +} +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__op_desc__attr__field_descriptors[12] = { + { + "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, name), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "type", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, type), + &paddle_mobile__framework__proto__attr_type__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "i", 3, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_INT32, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, has_i), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, i), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "f", 4, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_FLOAT, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, has_f), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, f), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "s", 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, s), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "ints", 6, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_INT32, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, n_ints), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, ints), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "floats", 7, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_FLOAT, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, n_floats), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, floats), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "strings", 8, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_STRING, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, n_strings), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, strings), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "b", 10, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, has_b), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, b), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "bools", 11, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, n_bools), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, bools), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "block_idx", 12, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_INT32, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, + has_block_idx), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, block_idx), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "l", 13, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_INT64, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, has_l), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Attr, l), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__op_desc__attr__field_indices_by_name[] = { + 8, /* field[8] = b */ + 10, /* field[10] = block_idx */ + 9, /* field[9] = bools */ + 3, /* field[3] = f */ + 6, /* field[6] = floats */ + 2, /* field[2] = i */ + 5, /* field[5] = ints */ + 11, /* field[11] = l */ + 0, /* field[0] = name */ + 4, /* field[4] = s */ + 7, /* field[7] = strings */ + 1, /* field[1] = type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__op_desc__attr__number_ranges[2 + 1] = { + {1, 0}, {10, 8}, {0, 12}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_desc__attr__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.OpDesc.Attr", + "Attr", + "PaddleMobile__Framework__Proto__OpDesc__Attr", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__OpDesc__Attr), + 12, + paddle_mobile__framework__proto__op_desc__attr__field_descriptors, + paddle_mobile__framework__proto__op_desc__attr__field_indices_by_name, + 2, + paddle_mobile__framework__proto__op_desc__attr__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__op_desc__attr__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__op_desc__var__field_descriptors[2] = { + { + "parameter", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpDesc__Var, parameter), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "arguments", 2, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_STRING, + offsetof(PaddleMobile__Framework__Proto__OpDesc__Var, n_arguments), + offsetof(PaddleMobile__Framework__Proto__OpDesc__Var, arguments), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__op_desc__var__field_indices_by_name[] = { + 1, /* field[1] = arguments */ + 0, /* field[0] = parameter */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__op_desc__var__number_ranges[1 + 1] = { + {1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_desc__var__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.OpDesc.Var", + "Var", + "PaddleMobile__Framework__Proto__OpDesc__Var", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__OpDesc__Var), + 2, + paddle_mobile__framework__proto__op_desc__var__field_descriptors, + paddle_mobile__framework__proto__op_desc__var__field_indices_by_name, + 1, + paddle_mobile__framework__proto__op_desc__var__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__op_desc__var__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const protobuf_c_boolean + paddle_mobile__framework__proto__op_desc__is_target__default_value = 0; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__op_desc__field_descriptors[5] = { + { + "inputs", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__OpDesc, n_inputs), + offsetof(PaddleMobile__Framework__Proto__OpDesc, inputs), + &paddle_mobile__framework__proto__op_desc__var__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "outputs", 2, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__OpDesc, n_outputs), + offsetof(PaddleMobile__Framework__Proto__OpDesc, outputs), + &paddle_mobile__framework__proto__op_desc__var__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "type", 3, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpDesc, type), NULL, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "attrs", 4, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__OpDesc, n_attrs), + offsetof(PaddleMobile__Framework__Proto__OpDesc, attrs), + &paddle_mobile__framework__proto__op_desc__attr__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "is_target", 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpDesc, has_is_target), + offsetof(PaddleMobile__Framework__Proto__OpDesc, is_target), NULL, + &paddle_mobile__framework__proto__op_desc__is_target__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__op_desc__field_indices_by_name[] = { + 3, /* field[3] = attrs */ + 0, /* field[0] = inputs */ + 4, /* field[4] = is_target */ + 1, /* field[1] = outputs */ + 2, /* field[2] = type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__op_desc__number_ranges[1 + 1] = {{1, 0}, + {0, 5}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.OpDesc", + "OpDesc", + "PaddleMobile__Framework__Proto__OpDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__OpDesc), + 5, + paddle_mobile__framework__proto__op_desc__field_descriptors, + paddle_mobile__framework__proto__op_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__op_desc__number_ranges, + (ProtobufCMessageInit)paddle_mobile__framework__proto__op_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const protobuf_c_boolean + paddle_mobile__framework__proto__op_proto__var__duplicable__default_value = + 0; +static const protobuf_c_boolean + paddle_mobile__framework__proto__op_proto__var__intermediate__default_value = + 0; +static const protobuf_c_boolean + paddle_mobile__framework__proto__op_proto__var__dispensable__default_value = + 0; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__op_proto__var__field_descriptors[5] = { + { + "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, name), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "comment", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, comment), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "duplicable", 3, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, + has_duplicable), + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, duplicable), + NULL, + &paddle_mobile__framework__proto__op_proto__var__duplicable__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "intermediate", 4, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, + has_intermediate), + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, + intermediate), + NULL, + &paddle_mobile__framework__proto__op_proto__var__intermediate__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "dispensable", 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, + has_dispensable), + offsetof(PaddleMobile__Framework__Proto__OpProto__Var, dispensable), + NULL, + &paddle_mobile__framework__proto__op_proto__var__dispensable__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__op_proto__var__field_indices_by_name[] = { + 1, /* field[1] = comment */ + 4, /* field[4] = dispensable */ + 2, /* field[2] = duplicable */ + 3, /* field[3] = intermediate */ + 0, /* field[0] = name */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__op_proto__var__number_ranges[1 + 1] = { + {1, 0}, {0, 5}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_proto__var__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.OpProto.Var", + "Var", + "PaddleMobile__Framework__Proto__OpProto__Var", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__OpProto__Var), + 5, + paddle_mobile__framework__proto__op_proto__var__field_descriptors, + paddle_mobile__framework__proto__op_proto__var__field_indices_by_name, + 1, + paddle_mobile__framework__proto__op_proto__var__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__op_proto__var__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const protobuf_c_boolean + paddle_mobile__framework__proto__op_proto__attr__generated__default_value = + 0; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__op_proto__attr__field_descriptors[4] = { + { + "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto__Attr, name), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "type", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto__Attr, type), + &paddle_mobile__framework__proto__attr_type__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "comment", 3, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto__Attr, comment), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "generated", 4, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__OpProto__Attr, + has_generated), + offsetof(PaddleMobile__Framework__Proto__OpProto__Attr, generated), + NULL, + &paddle_mobile__framework__proto__op_proto__attr__generated__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__op_proto__attr__field_indices_by_name[] = { + 2, /* field[2] = comment */ + 3, /* field[3] = generated */ + 0, /* field[0] = name */ + 1, /* field[1] = type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__op_proto__attr__number_ranges[1 + 1] = { + {1, 0}, {0, 4}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_proto__attr__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.OpProto.Attr", + "Attr", + "PaddleMobile__Framework__Proto__OpProto__Attr", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__OpProto__Attr), + 4, + paddle_mobile__framework__proto__op_proto__attr__field_descriptors, + paddle_mobile__framework__proto__op_proto__attr__field_indices_by_name, + 1, + paddle_mobile__framework__proto__op_proto__attr__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__op_proto__attr__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__op_proto__field_descriptors[5] = { + { + "type", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto, type), NULL, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "inputs", 2, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__OpProto, n_inputs), + offsetof(PaddleMobile__Framework__Proto__OpProto, inputs), + &paddle_mobile__framework__proto__op_proto__var__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "outputs", 3, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__OpProto, n_outputs), + offsetof(PaddleMobile__Framework__Proto__OpProto, outputs), + &paddle_mobile__framework__proto__op_proto__var__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "attrs", 4, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__OpProto, n_attrs), + offsetof(PaddleMobile__Framework__Proto__OpProto, attrs), + &paddle_mobile__framework__proto__op_proto__attr__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "comment", 5, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__OpProto, comment), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__op_proto__field_indices_by_name[] = { + 3, /* field[3] = attrs */ + 4, /* field[4] = comment */ + 1, /* field[1] = inputs */ + 2, /* field[2] = outputs */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__op_proto__number_ranges[1 + 1] = {{1, 0}, + {0, 5}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_proto__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.OpProto", + "OpProto", + "PaddleMobile__Framework__Proto__OpProto", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__OpProto), + 5, + paddle_mobile__framework__proto__op_proto__field_descriptors, + paddle_mobile__framework__proto__op_proto__field_indices_by_name, + 1, + paddle_mobile__framework__proto__op_proto__number_ranges, + (ProtobufCMessageInit)paddle_mobile__framework__proto__op_proto__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__tensor_desc__field_descriptors + [2] = { + { + "data_type", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType__TensorDesc, + data_type), + &paddle_mobile__framework__proto__var_type__type__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "dims", 2, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_INT64, + offsetof(PaddleMobile__Framework__Proto__VarType__TensorDesc, + n_dims), + offsetof(PaddleMobile__Framework__Proto__VarType__TensorDesc, + dims), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__tensor_desc__field_indices_by_name + [] = { + 0, /* field[0] = data_type */ + 1, /* field[1] = dims */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__tensor_desc__number_ranges[1 + + 1] = { + {1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__tensor_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.TensorDesc", + "TensorDesc", + "PaddleMobile__Framework__Proto__VarType__TensorDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType__TensorDesc), + 2, + paddle_mobile__framework__proto__var_type__tensor_desc__field_descriptors, + paddle_mobile__framework__proto__var_type__tensor_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__tensor_desc__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__var_type__tensor_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const int32_t + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__lod_level__default_value = + 0; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__field_descriptors + [2] = { + { + "tensor", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType__LoDTensorDesc, + tensor), + &paddle_mobile__framework__proto__var_type__tensor_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "lod_level", 2, PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof(PaddleMobile__Framework__Proto__VarType__LoDTensorDesc, + has_lod_level), + offsetof(PaddleMobile__Framework__Proto__VarType__LoDTensorDesc, + lod_level), + NULL, + &paddle_mobile__framework__proto__var_type__lo_dtensor_desc__lod_level__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__field_indices_by_name + [] = { + 1, /* field[1] = lod_level */ + 0, /* field[0] = tensor */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__number_ranges + [1 + 1] = {{1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.LoDTensorDesc", + "LoDTensorDesc", + "PaddleMobile__Framework__Proto__VarType__LoDTensorDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType__LoDTensorDesc), + 2, + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__field_descriptors, + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const int32_t + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__lod_level__default_value = + 0; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__field_descriptors + [2] = { + { + "tensor", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof( + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc, + tensor), + &paddle_mobile__framework__proto__var_type__tensor_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "lod_level", 2, PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof( + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc, + has_lod_level), + offsetof( + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc, + lod_level), + NULL, + &paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__lod_level__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__field_indices_by_name + [] = { + 1, /* field[1] = lod_level */ + 0, /* field[0] = tensor */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__number_ranges + [1 + 1] = {{1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc", + "LoDTensorArrayDesc", + "PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc), + 2, + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__field_descriptors, + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__reader_desc__field_descriptors[1] = { + { + "lod_tensor", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__VarType__ReaderDesc, + n_lod_tensor), + offsetof(PaddleMobile__Framework__Proto__VarType__ReaderDesc, + lod_tensor), + &paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__reader_desc__field_indices_by_name + [] = { + 0, /* field[0] = lod_tensor */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__reader_desc__number_ranges[1 + + 1] = { + {1, 0}, {0, 1}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__reader_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.ReaderDesc", + "ReaderDesc", + "PaddleMobile__Framework__Proto__VarType__ReaderDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType__ReaderDesc), + 1, + paddle_mobile__framework__proto__var_type__reader_desc__field_descriptors, + paddle_mobile__framework__proto__var_type__reader_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__reader_desc__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__var_type__reader_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__channel_desc__field_descriptors + [2] = { + { + "data_type", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType__ChannelDesc, + data_type), + &paddle_mobile__framework__proto__var_type__type__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "capacity", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType__ChannelDesc, + capacity), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__channel_desc__field_indices_by_name + [] = { + 1, /* field[1] = capacity */ + 0, /* field[0] = data_type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__channel_desc__number_ranges[1 + + 1] = + {{1, 0}, {0, 2}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__channel_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.ChannelDesc", + "ChannelDesc", + "PaddleMobile__Framework__Proto__VarType__ChannelDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType__ChannelDesc), + 2, + paddle_mobile__framework__proto__var_type__channel_desc__field_descriptors, + paddle_mobile__framework__proto__var_type__channel_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__channel_desc__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__var_type__channel_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__tuple__field_descriptors[1] = { + { + "element_type", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_ENUM, + offsetof(PaddleMobile__Framework__Proto__VarType__Tuple, + n_element_type), + offsetof(PaddleMobile__Framework__Proto__VarType__Tuple, + element_type), + &paddle_mobile__framework__proto__var_type__type__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__tuple__field_indices_by_name[] = + { + 0, /* field[0] = element_type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__tuple__number_ranges[1 + 1] = { + {1, 0}, {0, 1}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__tuple__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.Tuple", + "Tuple", + "PaddleMobile__Framework__Proto__VarType__Tuple", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType__Tuple), + 1, + paddle_mobile__framework__proto__var_type__tuple__field_descriptors, + paddle_mobile__framework__proto__var_type__tuple__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__tuple__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__var_type__tuple__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue + paddle_mobile__framework__proto__var_type__type__enum_values_by_number[19] = + { + {"BOOL", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL", + 0}, + {"INT16", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT16", + 1}, + {"INT32", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT32", + 2}, + {"INT64", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT64", + 3}, + {"FP16", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP16", + 4}, + {"FP32", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP32", + 5}, + {"FP64", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP64", + 6}, + {"LOD_TENSOR", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_TENSOR", 7}, + {"SELECTED_ROWS", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__SELECTED_ROWS", + 8}, + {"FEED_MINIBATCH", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FEED_MINIBATCH", + 9}, + {"FETCH_LIST", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FETCH_LIST", 10}, + {"STEP_SCOPES", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__STEP_SCOPES", + 11}, + {"LOD_RANK_TABLE", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_RANK_TABLE", + 12}, + {"LOD_TENSOR_ARRAY", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_TENSOR_" + "ARRAY", + 13}, + {"PLACE_LIST", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__PLACE_LIST", 14}, + {"READER", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__READER", 15}, + {"CHANNEL", + "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__CHANNEL", 16}, + {"RAW", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__RAW", 17}, + {"TUPLE", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__TUPLE", + 18}, +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__type__value_ranges[] = {{0, 0}, + {0, 19}}; +static const ProtobufCEnumValueIndex + paddle_mobile__framework__proto__var_type__type__enum_values_by_name[19] = { + {"BOOL", 0}, + {"CHANNEL", 16}, + {"FEED_MINIBATCH", 9}, + {"FETCH_LIST", 10}, + {"FP16", 4}, + {"FP32", 5}, + {"FP64", 6}, + {"INT16", 1}, + {"INT32", 2}, + {"INT64", 3}, + {"LOD_RANK_TABLE", 12}, + {"LOD_TENSOR", 7}, + {"LOD_TENSOR_ARRAY", 13}, + {"PLACE_LIST", 14}, + {"RAW", 17}, + {"READER", 15}, + {"SELECTED_ROWS", 8}, + {"STEP_SCOPES", 11}, + {"TUPLE", 18}, +}; +const ProtobufCEnumDescriptor + paddle_mobile__framework__proto__var_type__type__descriptor = { + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType.Type", + "Type", + "PaddleMobile__Framework__Proto__VarType__Type", + "paddle_mobile.framework.proto", + 19, + paddle_mobile__framework__proto__var_type__type__enum_values_by_number, + 19, + paddle_mobile__framework__proto__var_type__type__enum_values_by_name, + 1, + paddle_mobile__framework__proto__var_type__type__value_ranges, + NULL, + NULL, + NULL, + NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_type__field_descriptors[7] = { + { + "type", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, type), + &paddle_mobile__framework__proto__var_type__type__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "selected_rows", 2, PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, selected_rows), + &paddle_mobile__framework__proto__var_type__tensor_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "lod_tensor", 3, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, lod_tensor), + &paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "tensor_array", 4, PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, tensor_array), + &paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "reader", 5, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, reader), + &paddle_mobile__framework__proto__var_type__reader_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "channel", 6, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, channel), + &paddle_mobile__framework__proto__var_type__channel_desc__descriptor, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "tuple", 7, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarType, tuple), + &paddle_mobile__framework__proto__var_type__tuple__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_type__field_indices_by_name[] = { + 5, /* field[5] = channel */ + 2, /* field[2] = lod_tensor */ + 4, /* field[4] = reader */ + 1, /* field[1] = selected_rows */ + 3, /* field[3] = tensor_array */ + 6, /* field[6] = tuple */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_type__number_ranges[1 + 1] = {{1, 0}, + {0, 7}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarType", + "VarType", + "PaddleMobile__Framework__Proto__VarType", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarType), + 7, + paddle_mobile__framework__proto__var_type__field_descriptors, + paddle_mobile__framework__proto__var_type__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_type__number_ranges, + (ProtobufCMessageInit)paddle_mobile__framework__proto__var_type__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const protobuf_c_boolean + paddle_mobile__framework__proto__var_desc__persistable__default_value = 0; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__var_desc__field_descriptors[3] = { + { + "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarDesc, name), NULL, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "type", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__VarDesc, type), + &paddle_mobile__framework__proto__var_type__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "persistable", 3, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_BOOL, + offsetof(PaddleMobile__Framework__Proto__VarDesc, has_persistable), + offsetof(PaddleMobile__Framework__Proto__VarDesc, persistable), + NULL, + &paddle_mobile__framework__proto__var_desc__persistable__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__var_desc__field_indices_by_name[] = { + 0, /* field[0] = name */ + 2, /* field[2] = persistable */ + 1, /* field[1] = type */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__var_desc__number_ranges[1 + 1] = {{1, 0}, + {0, 3}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.VarDesc", + "VarDesc", + "PaddleMobile__Framework__Proto__VarDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__VarDesc), + 3, + paddle_mobile__framework__proto__var_desc__field_descriptors, + paddle_mobile__framework__proto__var_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__var_desc__number_ranges, + (ProtobufCMessageInit)paddle_mobile__framework__proto__var_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const int32_t + paddle_mobile__framework__proto__block_desc__forward_block_idx__default_value = + -1; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__block_desc__field_descriptors[5] = { + { + "idx", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__BlockDesc, idx), NULL, + NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "parent_idx", 2, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + offsetof(PaddleMobile__Framework__Proto__BlockDesc, parent_idx), + NULL, NULL, 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "vars", 3, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__BlockDesc, n_vars), + offsetof(PaddleMobile__Framework__Proto__BlockDesc, vars), + &paddle_mobile__framework__proto__var_desc__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "ops", 4, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__BlockDesc, n_ops), + offsetof(PaddleMobile__Framework__Proto__BlockDesc, ops), + &paddle_mobile__framework__proto__op_desc__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, + { + "forward_block_idx", 5, PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof(PaddleMobile__Framework__Proto__BlockDesc, + has_forward_block_idx), + offsetof(PaddleMobile__Framework__Proto__BlockDesc, + forward_block_idx), + NULL, + &paddle_mobile__framework__proto__block_desc__forward_block_idx__default_value, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__block_desc__field_indices_by_name[] = { + 4, /* field[4] = forward_block_idx */ + 0, /* field[0] = idx */ + 3, /* field[3] = ops */ + 1, /* field[1] = parent_idx */ + 2, /* field[2] = vars */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__block_desc__number_ranges[1 + 1] = { + {1, 0}, {0, 5}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__block_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.BlockDesc", + "BlockDesc", + "PaddleMobile__Framework__Proto__BlockDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__BlockDesc), + 5, + paddle_mobile__framework__proto__block_desc__field_descriptors, + paddle_mobile__framework__proto__block_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__block_desc__number_ranges, + (ProtobufCMessageInit)paddle_mobile__framework__proto__block_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor + paddle_mobile__framework__proto__program_desc__field_descriptors[1] = { + { + "blocks", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, + offsetof(PaddleMobile__Framework__Proto__ProgramDesc, n_blocks), + offsetof(PaddleMobile__Framework__Proto__ProgramDesc, blocks), + &paddle_mobile__framework__proto__block_desc__descriptor, NULL, + 0, /* flags */ + 0, NULL, NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned + paddle_mobile__framework__proto__program_desc__field_indices_by_name[] = { + 0, /* field[0] = blocks */ +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__program_desc__number_ranges[1 + 1] = { + {1, 0}, {0, 1}}; +const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__program_desc__descriptor = { + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.ProgramDesc", + "ProgramDesc", + "PaddleMobile__Framework__Proto__ProgramDesc", + "paddle_mobile.framework.proto", + sizeof(PaddleMobile__Framework__Proto__ProgramDesc), + 1, + paddle_mobile__framework__proto__program_desc__field_descriptors, + paddle_mobile__framework__proto__program_desc__field_indices_by_name, + 1, + paddle_mobile__framework__proto__program_desc__number_ranges, + (ProtobufCMessageInit) + paddle_mobile__framework__proto__program_desc__init, + NULL, + NULL, + NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue + paddle_mobile__framework__proto__attr_type__enum_values_by_number[10] = { + {"INT", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT", 0}, + {"FLOAT", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOAT", 1}, + {"STRING", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRING", 2}, + {"INTS", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INTS", 3}, + {"FLOATS", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOATS", 4}, + {"STRINGS", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRINGS", 5}, + {"BOOLEAN", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEAN", 6}, + {"BOOLEANS", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEANS", 7}, + {"BLOCK", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BLOCK", 8}, + {"LONG", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__LONG", 9}, +}; +static const ProtobufCIntRange + paddle_mobile__framework__proto__attr_type__value_ranges[] = {{0, 0}, + {0, 10}}; +static const ProtobufCEnumValueIndex + paddle_mobile__framework__proto__attr_type__enum_values_by_name[10] = { + {"BLOCK", 8}, {"BOOLEAN", 6}, {"BOOLEANS", 7}, {"FLOAT", 1}, + {"FLOATS", 4}, {"INT", 0}, {"INTS", 3}, {"LONG", 9}, + {"STRING", 2}, {"STRINGS", 5}, +}; +const ProtobufCEnumDescriptor + paddle_mobile__framework__proto__attr_type__descriptor = { + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "paddle_mobile.framework.proto.AttrType", + "AttrType", + "PaddleMobile__Framework__Proto__AttrType", + "paddle_mobile.framework.proto", + 10, + paddle_mobile__framework__proto__attr_type__enum_values_by_number, + 10, + paddle_mobile__framework__proto__attr_type__enum_values_by_name, + 1, + paddle_mobile__framework__proto__attr_type__value_ranges, + NULL, + NULL, + NULL, + NULL /* reserved[1234] */ +}; diff --git a/src/framework/framework.pb-c.h b/src/framework/framework.pb-c.h new file mode 100644 index 0000000000000000000000000000000000000000..2e8c405dffdb3ab65b4cda63d4b09336ff676d5d --- /dev/null +++ b/src/framework/framework.pb-c.h @@ -0,0 +1,579 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: framework.proto */ + +#ifndef PROTOBUF_C_framework_2eproto__INCLUDED +#define PROTOBUF_C_framework_2eproto__INCLUDED + +#include "common/protobuf-c.h" + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1000000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +typedef struct _PaddleMobile__Framework__Proto__OpDesc + PaddleMobile__Framework__Proto__OpDesc; +typedef struct _PaddleMobile__Framework__Proto__OpDesc__Attr + PaddleMobile__Framework__Proto__OpDesc__Attr; +typedef struct _PaddleMobile__Framework__Proto__OpDesc__Var + PaddleMobile__Framework__Proto__OpDesc__Var; +typedef struct _PaddleMobile__Framework__Proto__OpProto + PaddleMobile__Framework__Proto__OpProto; +typedef struct _PaddleMobile__Framework__Proto__OpProto__Var + PaddleMobile__Framework__Proto__OpProto__Var; +typedef struct _PaddleMobile__Framework__Proto__OpProto__Attr + PaddleMobile__Framework__Proto__OpProto__Attr; +typedef struct _PaddleMobile__Framework__Proto__VarType + PaddleMobile__Framework__Proto__VarType; +typedef struct _PaddleMobile__Framework__Proto__VarType__TensorDesc + PaddleMobile__Framework__Proto__VarType__TensorDesc; +typedef struct _PaddleMobile__Framework__Proto__VarType__LoDTensorDesc + PaddleMobile__Framework__Proto__VarType__LoDTensorDesc; +typedef struct _PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc; +typedef struct _PaddleMobile__Framework__Proto__VarType__ReaderDesc + PaddleMobile__Framework__Proto__VarType__ReaderDesc; +typedef struct _PaddleMobile__Framework__Proto__VarType__ChannelDesc + PaddleMobile__Framework__Proto__VarType__ChannelDesc; +typedef struct _PaddleMobile__Framework__Proto__VarType__Tuple + PaddleMobile__Framework__Proto__VarType__Tuple; +typedef struct _PaddleMobile__Framework__Proto__VarDesc + PaddleMobile__Framework__Proto__VarDesc; +typedef struct _PaddleMobile__Framework__Proto__BlockDesc + PaddleMobile__Framework__Proto__BlockDesc; +typedef struct _PaddleMobile__Framework__Proto__ProgramDesc + PaddleMobile__Framework__Proto__ProgramDesc; + +/* --- enums --- */ + +typedef enum _PaddleMobile__Framework__Proto__VarType__Type { + /* + * Pod Types + */ + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL = 0, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT16 = 1, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT32 = 2, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT64 = 3, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP16 = 4, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP32 = 5, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP64 = 6, + /* + * Other types that may need additional descriptions + */ + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_TENSOR = 7, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__SELECTED_ROWS = 8, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FEED_MINIBATCH = 9, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FETCH_LIST = 10, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__STEP_SCOPES = 11, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_RANK_TABLE = 12, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_TENSOR_ARRAY = 13, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__PLACE_LIST = 14, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__READER = 15, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__CHANNEL = 16, + /* + * Any runtime decided variable type is raw + * raw variables should manage their own allocations + * in operators like nccl_op + */ + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__RAW = 17, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__TUPLE = + 18 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE( + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE) +} PaddleMobile__Framework__Proto__VarType__Type; +typedef enum _PaddleMobile__Framework__Proto__AttrType { + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT = 0, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOAT = 1, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRING = 2, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INTS = 3, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOATS = 4, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__STRINGS = 5, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEAN = 6, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BOOLEANS = 7, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BLOCK = 8, + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__LONG = + 9 PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE( + PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE) +} PaddleMobile__Framework__Proto__AttrType; + +/* --- messages --- */ + +struct _PaddleMobile__Framework__Proto__OpDesc__Attr { + ProtobufCMessage base; + char *name; + PaddleMobile__Framework__Proto__AttrType type; + protobuf_c_boolean has_i; + int32_t i; + protobuf_c_boolean has_f; + float f; + char *s; + size_t n_ints; + int32_t *ints; + size_t n_floats; + float *floats; + size_t n_strings; + char **strings; + protobuf_c_boolean has_b; + protobuf_c_boolean b; + size_t n_bools; + protobuf_c_boolean *bools; + protobuf_c_boolean has_block_idx; + int32_t block_idx; + protobuf_c_boolean has_l; + int64_t l; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__OP_DESC__ATTR__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__op_desc__attr__descriptor) \ + , NULL, PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT, 0, 0, 0, 0, NULL, \ + 0, NULL, 0, NULL, 0, NULL, 0, 0, 0, NULL, 0, 0, 0, 0 \ + } + +struct _PaddleMobile__Framework__Proto__OpDesc__Var { + ProtobufCMessage base; + char *parameter; + size_t n_arguments; + char **arguments; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__OP_DESC__VAR__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__op_desc__var__descriptor) \ + , NULL, 0, NULL \ + } + +/* + * OpDesc describes an instance of a C++ framework::OperatorBase + * derived class type. + */ +struct _PaddleMobile__Framework__Proto__OpDesc { + ProtobufCMessage base; + char *type; + size_t n_inputs; + PaddleMobile__Framework__Proto__OpDesc__Var **inputs; + size_t n_outputs; + PaddleMobile__Framework__Proto__OpDesc__Var **outputs; + size_t n_attrs; + PaddleMobile__Framework__Proto__OpDesc__Attr **attrs; + protobuf_c_boolean has_is_target; + protobuf_c_boolean is_target; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__OP_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__op_desc__descriptor) \ + , NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0 \ + } + +/* + * VarProto describes the C++ type framework::Variable. + */ +struct _PaddleMobile__Framework__Proto__OpProto__Var { + ProtobufCMessage base; + char *name; + char *comment; + protobuf_c_boolean has_duplicable; + protobuf_c_boolean duplicable; + protobuf_c_boolean has_intermediate; + protobuf_c_boolean intermediate; + protobuf_c_boolean has_dispensable; + protobuf_c_boolean dispensable; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__OP_PROTO__VAR__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__op_proto__var__descriptor) \ + , NULL, NULL, 0, 0, 0, 0, 0, 0 \ + } + +/* + * AttrProto describes the C++ type Attribute. + */ +struct _PaddleMobile__Framework__Proto__OpProto__Attr { + ProtobufCMessage base; + char *name; + PaddleMobile__Framework__Proto__AttrType type; + char *comment; + /* + * If that attribute is generated, it means the Paddle third + * language binding has responsibility to fill that + * attribute. End-User should not set that attribute. + */ + protobuf_c_boolean has_generated; + protobuf_c_boolean generated; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__OP_PROTO__ATTR__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__op_proto__attr__descriptor) \ + , NULL, PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT, NULL, 0, 0 \ + } + +/* + * OpProto describes a C++ framework::OperatorBase derived class. + */ +struct _PaddleMobile__Framework__Proto__OpProto { + ProtobufCMessage base; + char *type; + size_t n_inputs; + PaddleMobile__Framework__Proto__OpProto__Var **inputs; + size_t n_outputs; + PaddleMobile__Framework__Proto__OpProto__Var **outputs; + size_t n_attrs; + PaddleMobile__Framework__Proto__OpProto__Attr **attrs; + char *comment; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__OP_PROTO__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__op_proto__descriptor) \ + , NULL, 0, NULL, 0, NULL, 0, NULL, NULL \ + } + +struct _PaddleMobile__Framework__Proto__VarType__TensorDesc { + ProtobufCMessage base; + /* + * Should only be PODType. Is enforced in C++ + */ + PaddleMobile__Framework__Proto__VarType__Type data_type; + /* + * [UNK, 640, 480] is saved as [-1, 640, 480] + */ + size_t n_dims; + int64_t *dims; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TENSOR_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__tensor_desc__descriptor) \ + , PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL, 0, NULL \ + } + +struct _PaddleMobile__Framework__Proto__VarType__LoDTensorDesc { + ProtobufCMessage base; + PaddleMobile__Framework__Proto__VarType__TensorDesc *tensor; + protobuf_c_boolean has_lod_level; + int32_t lod_level; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__LO_DTENSOR_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor) \ + , NULL, 0, 0 \ + } + +struct _PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc { + ProtobufCMessage base; + PaddleMobile__Framework__Proto__VarType__TensorDesc *tensor; + protobuf_c_boolean has_lod_level; + int32_t lod_level; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__LO_DTENSOR_ARRAY_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__descriptor) \ + , NULL, 0, 0 \ + } + +struct _PaddleMobile__Framework__Proto__VarType__ReaderDesc { + ProtobufCMessage base; + size_t n_lod_tensor; + PaddleMobile__Framework__Proto__VarType__LoDTensorDesc **lod_tensor; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__READER_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__reader_desc__descriptor) \ + , 0, NULL \ + } + +struct _PaddleMobile__Framework__Proto__VarType__ChannelDesc { + ProtobufCMessage base; + PaddleMobile__Framework__Proto__VarType__Type data_type; + int64_t capacity; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__CHANNEL_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__channel_desc__descriptor) \ + , PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL, 0 \ + } + +struct _PaddleMobile__Framework__Proto__VarType__Tuple { + ProtobufCMessage base; + size_t n_element_type; + PaddleMobile__Framework__Proto__VarType__Type *element_type; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TUPLE__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__tuple__descriptor) \ + , 0, NULL \ + } + +struct _PaddleMobile__Framework__Proto__VarType { + ProtobufCMessage base; + PaddleMobile__Framework__Proto__VarType__Type type; + PaddleMobile__Framework__Proto__VarType__TensorDesc *selected_rows; + PaddleMobile__Framework__Proto__VarType__LoDTensorDesc *lod_tensor; + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc *tensor_array; + PaddleMobile__Framework__Proto__VarType__ReaderDesc *reader; + PaddleMobile__Framework__Proto__VarType__ChannelDesc *channel; + PaddleMobile__Framework__Proto__VarType__Tuple *tuple; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_type__descriptor) \ + , PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL, NULL, NULL, NULL, \ + NULL, NULL, NULL \ + } + +struct _PaddleMobile__Framework__Proto__VarDesc { + ProtobufCMessage base; + char *name; + PaddleMobile__Framework__Proto__VarType *type; + protobuf_c_boolean has_persistable; + protobuf_c_boolean persistable; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__var_desc__descriptor) \ + , NULL, NULL, 0, 0 \ + } + +struct _PaddleMobile__Framework__Proto__BlockDesc { + ProtobufCMessage base; + int32_t idx; + int32_t parent_idx; + size_t n_vars; + PaddleMobile__Framework__Proto__VarDesc **vars; + size_t n_ops; + PaddleMobile__Framework__Proto__OpDesc **ops; + protobuf_c_boolean has_forward_block_idx; + int32_t forward_block_idx; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__BLOCK_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__block_desc__descriptor) \ + , 0, 0, 0, NULL, 0, NULL, 0, -1 \ + } + +/* + * Please refer to + * https://github.com/PaddlePaddle/Paddle/blob/develop/doc/design/program.md + * for more details. + * TODO(panyx0718): A model can have multiple programs. Need a + * way to distinguish them. Maybe ID or name? + */ +struct _PaddleMobile__Framework__Proto__ProgramDesc { + ProtobufCMessage base; + size_t n_blocks; + PaddleMobile__Framework__Proto__BlockDesc **blocks; +}; +#define PADDLE_MOBILE__FRAMEWORK__PROTO__PROGRAM_DESC__INIT \ + { \ + PROTOBUF_C_MESSAGE_INIT( \ + &paddle_mobile__framework__proto__program_desc__descriptor) \ + , 0, NULL \ + } + +/* PaddleMobile__Framework__Proto__OpDesc__Attr methods */ +void paddle_mobile__framework__proto__op_desc__attr__init( + PaddleMobile__Framework__Proto__OpDesc__Attr *message); +/* PaddleMobile__Framework__Proto__OpDesc__Var methods */ +void paddle_mobile__framework__proto__op_desc__var__init( + PaddleMobile__Framework__Proto__OpDesc__Var *message); +/* PaddleMobile__Framework__Proto__OpDesc methods */ +void paddle_mobile__framework__proto__op_desc__init( + PaddleMobile__Framework__Proto__OpDesc *message); + +size_t paddle_mobile__framework__proto__op_desc__get_packed_size( + const PaddleMobile__Framework__Proto__OpDesc *message); + +PaddleMobile__Framework__Proto__OpDesc * +paddle_mobile__framework__proto__op_desc__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void paddle_mobile__framework__proto__op_desc__free_unpacked( + PaddleMobile__Framework__Proto__OpDesc *message, + ProtobufCAllocator *allocator); +/* PaddleMobile__Framework__Proto__OpProto__Var methods */ +void paddle_mobile__framework__proto__op_proto__var__init( + PaddleMobile__Framework__Proto__OpProto__Var *message); +/* PaddleMobile__Framework__Proto__OpProto__Attr methods */ +void paddle_mobile__framework__proto__op_proto__attr__init( + PaddleMobile__Framework__Proto__OpProto__Attr *message); +/* PaddleMobile__Framework__Proto__OpProto methods */ +void paddle_mobile__framework__proto__op_proto__init( + PaddleMobile__Framework__Proto__OpProto *message); +size_t paddle_mobile__framework__proto__op_proto__get_packed_size( + const PaddleMobile__Framework__Proto__OpProto *message); +PaddleMobile__Framework__Proto__OpProto * +paddle_mobile__framework__proto__op_proto__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void paddle_mobile__framework__proto__op_proto__free_unpacked( + PaddleMobile__Framework__Proto__OpProto *message, + ProtobufCAllocator *allocator); +/* PaddleMobile__Framework__Proto__VarType__TensorDesc methods */ +void paddle_mobile__framework__proto__var_type__tensor_desc__init( + PaddleMobile__Framework__Proto__VarType__TensorDesc *message); +/* PaddleMobile__Framework__Proto__VarType__LoDTensorDesc methods */ +void paddle_mobile__framework__proto__var_type__lo_dtensor_desc__init( + PaddleMobile__Framework__Proto__VarType__LoDTensorDesc *message); +/* PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc methods */ +void paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__init( + PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc *message); +/* PaddleMobile__Framework__Proto__VarType__ReaderDesc methods */ +void paddle_mobile__framework__proto__var_type__reader_desc__init( + PaddleMobile__Framework__Proto__VarType__ReaderDesc *message); +/* PaddleMobile__Framework__Proto__VarType__ChannelDesc methods */ +void paddle_mobile__framework__proto__var_type__channel_desc__init( + PaddleMobile__Framework__Proto__VarType__ChannelDesc *message); +/* PaddleMobile__Framework__Proto__VarType__Tuple methods */ +void paddle_mobile__framework__proto__var_type__tuple__init( + PaddleMobile__Framework__Proto__VarType__Tuple *message); +/* PaddleMobile__Framework__Proto__VarType methods */ +void paddle_mobile__framework__proto__var_type__init( + PaddleMobile__Framework__Proto__VarType *message); +size_t paddle_mobile__framework__proto__var_type__get_packed_size( + const PaddleMobile__Framework__Proto__VarType *message); +PaddleMobile__Framework__Proto__VarType * +paddle_mobile__framework__proto__var_type__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void paddle_mobile__framework__proto__var_type__free_unpacked( + PaddleMobile__Framework__Proto__VarType *message, + ProtobufCAllocator *allocator); +/* PaddleMobile__Framework__Proto__VarDesc methods */ +void paddle_mobile__framework__proto__var_desc__init( + PaddleMobile__Framework__Proto__VarDesc *message); +size_t paddle_mobile__framework__proto__var_desc__get_packed_size( + const PaddleMobile__Framework__Proto__VarDesc *message); +PaddleMobile__Framework__Proto__VarDesc * +paddle_mobile__framework__proto__var_desc__unpack(ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void paddle_mobile__framework__proto__var_desc__free_unpacked( + PaddleMobile__Framework__Proto__VarDesc *message, + ProtobufCAllocator *allocator); +/* PaddleMobile__Framework__Proto__BlockDesc methods */ +void paddle_mobile__framework__proto__block_desc__init( + PaddleMobile__Framework__Proto__BlockDesc *message); +size_t paddle_mobile__framework__proto__block_desc__get_packed_size( + const PaddleMobile__Framework__Proto__BlockDesc *message); +PaddleMobile__Framework__Proto__BlockDesc * +paddle_mobile__framework__proto__block_desc__unpack( + ProtobufCAllocator *allocator, size_t len, const uint8_t *data); +void paddle_mobile__framework__proto__block_desc__free_unpacked( + PaddleMobile__Framework__Proto__BlockDesc *message, + ProtobufCAllocator *allocator); +/* PaddleMobile__Framework__Proto__ProgramDesc methods */ +void paddle_mobile__framework__proto__program_desc__init( + PaddleMobile__Framework__Proto__ProgramDesc *message); +size_t paddle_mobile__framework__proto__program_desc__get_packed_size( + const PaddleMobile__Framework__Proto__ProgramDesc *message); +PaddleMobile__Framework__Proto__ProgramDesc * +paddle_mobile__framework__proto__program_desc__unpack( + ProtobufCAllocator *allocator, size_t len, const uint8_t *data); +void paddle_mobile__framework__proto__program_desc__free_unpacked( + PaddleMobile__Framework__Proto__ProgramDesc *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*PaddleMobile__Framework__Proto__OpDesc__Attr_Closure)( + const PaddleMobile__Framework__Proto__OpDesc__Attr *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__OpDesc__Var_Closure)( + const PaddleMobile__Framework__Proto__OpDesc__Var *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__OpDesc_Closure)( + const PaddleMobile__Framework__Proto__OpDesc *message, void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__OpProto__Var_Closure)( + const PaddleMobile__Framework__Proto__OpProto__Var *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__OpProto__Attr_Closure)( + const PaddleMobile__Framework__Proto__OpProto__Attr *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__OpProto_Closure)( + const PaddleMobile__Framework__Proto__OpProto *message, void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarType__TensorDesc_Closure)( + const PaddleMobile__Framework__Proto__VarType__TensorDesc *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarType__LoDTensorDesc_Closure)( + const PaddleMobile__Framework__Proto__VarType__LoDTensorDesc *message, + void *closure_data); +typedef void ( + *PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc_Closure)( + const PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarType__ReaderDesc_Closure)( + const PaddleMobile__Framework__Proto__VarType__ReaderDesc *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarType__ChannelDesc_Closure)( + const PaddleMobile__Framework__Proto__VarType__ChannelDesc *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarType__Tuple_Closure)( + const PaddleMobile__Framework__Proto__VarType__Tuple *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarType_Closure)( + const PaddleMobile__Framework__Proto__VarType *message, void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__VarDesc_Closure)( + const PaddleMobile__Framework__Proto__VarDesc *message, void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__BlockDesc_Closure)( + const PaddleMobile__Framework__Proto__BlockDesc *message, + void *closure_data); +typedef void (*PaddleMobile__Framework__Proto__ProgramDesc_Closure)( + const PaddleMobile__Framework__Proto__ProgramDesc *message, + void *closure_data); + +/* --- services --- */ + +/* --- descriptors --- */ + +extern const ProtobufCEnumDescriptor + paddle_mobile__framework__proto__attr_type__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_desc__attr__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_desc__var__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_proto__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_proto__var__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__op_proto__attr__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__tensor_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__reader_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__channel_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_type__tuple__descriptor; +extern const ProtobufCEnumDescriptor + paddle_mobile__framework__proto__var_type__type__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__var_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__block_desc__descriptor; +extern const ProtobufCMessageDescriptor + paddle_mobile__framework__proto__program_desc__descriptor; + +PROTOBUF_C__END_DECLS + +#endif /* PROTOBUF_C_framework_2eproto__INCLUDED */ diff --git a/src/framework/framework.pb.cpp b/src/framework/framework.pb.cpp deleted file mode 100644 index ae4016e8b137a0f5e27c032f08b7e50d24c2dc5b..0000000000000000000000000000000000000000 --- a/src/framework/framework.pb.cpp +++ /dev/null @@ -1,8011 +0,0 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: framework.proto - -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION -#include "framework.pb.h" - -#include - -#include -#include -#include -#include -#include -#include -// @@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; - } -} - -#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; -#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; - } -} - - // =================================================================== - -#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; -#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_) - - reinterpret_cast(&type_)) + - 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; -#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"; -} - -#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) -} -#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) -} -#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) -} -#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) -} -#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); -} -#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)); -} -#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) -} -#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) -} -#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) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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) -} -#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) -} -#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); -} -#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)); -} -#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) -} -#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) -} -#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_; -} - -#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; -#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) { -#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; -#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"; -} - -#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) -} -#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) -} -#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) -} - -#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; -#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_) - - reinterpret_cast(&duplicable_)) + - 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; -#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"; -} - -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} - -#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; -#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_) - - reinterpret_cast(&type_)) + - 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; -#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"; -} - -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} - -#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; -#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) { -#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; -#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"; -} - -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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_) - - reinterpret_cast(&capacity_)) + - 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; -#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"; -} - -#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) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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_; -} - -#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; -#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) { -#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; -#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"; -} - -#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) -} - -#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; -#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) { -#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; -#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"; -} - -#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) -} -#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) -} -#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) -} - -#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; -#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_) - - reinterpret_cast(&idx_)) + - 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; -#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"; -} - -#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) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - - // =================================================================== - -#if !defined(_MSC_VER) || _MSC_VER >= 1900 -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) { -#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; -#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"; -} - -#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_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS - -// @@protoc_insertion_point(namespace_scope) - -} // 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 deleted file mode 100644 index fa75a92e57ddee571a611146e91fa93e8b943b60..0000000000000000000000000000000000000000 --- a/src/framework/framework.pb.h +++ /dev/null @@ -1,5047 +0,0 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: framework.proto - -#ifndef PROTOBUF_framework_2eproto__INCLUDED -#define PROTOBUF_framework_2eproto__INCLUDED - -#include - -#include - -#if GOOGLE_PROTOBUF_VERSION < 3004000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif - -#include -#include -#include // IWYU pragma: export -#include -#include -#include -#include -#include -#include -#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 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; - } -#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; - } -#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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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; - } -#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; - } -#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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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; - } -#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; - } -#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); -#if LANG_CXX11 - 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; - } -#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; - } -#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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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; - } -#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; - } -#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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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; - } -#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; - } -#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); -#if LANG_CXX11 - 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); -#if LANG_CXX11 - 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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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; - } -#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); -#if LANG_CXX11 - 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; - } -#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; - } -#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; - } -#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; - } -#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; -}; -// =================================================================== - -// =================================================================== - -#if !PROTOBUF_INLINE_NOT_IN_HEADERS -#ifdef __GNUC__ -#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) -} -#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) -} -#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) -} -#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) -} -#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); -} -#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)); -} -#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) -} -#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) -} -#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) -} -#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) -} -#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); -} -#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)); -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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) -} -#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, - ::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) -} -#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) -} -#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_; -} - -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS - // ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// @@protoc_insertion_point(namespace_scope) - -} // namespace proto -} // namespace framework -} // namespace paddle_mobile - -namespace google { -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 {}; - -} // namespace protobuf -} // namespace google - -// @@protoc_insertion_point(global_scope) - -#endif // PROTOBUF_framework_2eproto__INCLUDED diff --git a/src/framework/lod_tensor.cpp b/src/framework/lod_tensor.cpp index 90e9274f572b3a1bec724a2a9d74b20f16947689..48c2c46989e2d477ed0a005f25a8252da0955f13 100644 --- a/src/framework/lod_tensor.cpp +++ b/src/framework/lod_tensor.cpp @@ -244,58 +244,5 @@ void AppendLoD(LoD *lod, const LoD &lod_length) { } } -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/op_info.h b/src/framework/op_info.h index 4839c8feb6e8d6c66d04bc33640d584f981fbba3..7475d155232e31cf00dab6273200f5bc4671f2e9 100644 --- a/src/framework/op_info.h +++ b/src/framework/op_info.h @@ -17,7 +17,6 @@ limitations under the License. */ #include #include "common/log.h" #include "common/type_define.h" -#include "framework/framework.pb.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/op_kernel_type.h b/src/framework/op_kernel_type.h index c8424a5d065b9b3945a1c1124166e8a5b21ffe27..fd59eb494df33ee39f65f8c325fabbef51195d47 100644 --- a/src/framework/op_kernel_type.h +++ b/src/framework/op_kernel_type.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "framework/data_layout.h" -#include "framework/framework.pb.h" +#include "framework/program/tensor_desc.h" namespace paddle_mobile { namespace framework { @@ -33,10 +33,10 @@ struct OpKernelType { // place, data_type, library_type kinds less than 2^8 constexpr static int LEFT_SHIFT = 8; - proto::VarType::Type data_type_; + VarType_Type data_type_; DataLayout data_layout_; - OpKernelType(proto::VarType::Type data_type, + OpKernelType(VarType_Type data_type, DataLayout data_layout = DataLayout::kAnyLayout) : data_type_(data_type), data_layout_(data_layout) {} diff --git a/src/framework/program/block_desc.cpp b/src/framework/program/block_desc.cpp index 471cd0eda00d7fa79f9a268c2bd3fb454baabbfd..7342abe284406a66b654639a171e23f9d6d680d7 100644 --- a/src/framework/program/block_desc.cpp +++ b/src/framework/program/block_desc.cpp @@ -33,12 +33,16 @@ std::vector> BlockDesc::Ops() const { return res; } -BlockDesc::BlockDesc(const proto::BlockDesc &desc) - : index_(desc.idx()), parent_index_(desc.parent_idx()) { - for (const proto::VarDesc &var_desc : desc.vars()) { - vars_[var_desc.name()].reset(new VarDesc(var_desc)); +BlockDesc::BlockDesc(PaddleMobile__Framework__Proto__BlockDesc *desc) + : index_(desc->idx), parent_index_(desc->idx) { + for (int i = 0; i < desc->n_vars; ++i) { + PaddleMobile__Framework__Proto__VarDesc *var_desc = desc->vars[i]; + vars_[std::string(var_desc->name)] = + std::shared_ptr(new VarDesc(var_desc)); } - for (const proto::OpDesc &op_desc : desc.ops()) { + + for (int j = 0; j < desc->n_ops; ++j) { + PaddleMobile__Framework__Proto__OpDesc *op_desc = desc->ops[j]; ops_.emplace_back(new framework::OpDesc(op_desc)); } } diff --git a/src/framework/program/block_desc.h b/src/framework/program/block_desc.h index 4b0fb8b865712be68f3c374ac92132bb8b1b3a57..1a22714b52a9454a561db1d6ae0cd1f4c215633a 100644 --- a/src/framework/program/block_desc.h +++ b/src/framework/program/block_desc.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#include "framework/framework.pb.h" +#include "framework/framework.pb-c.h" #include "framework/paddle_mobile_object.h" #include "framework/program/op_desc.h" #include "framework/program/var_desc.h" @@ -26,8 +26,7 @@ class BlockDesc : PaddleMobileObject { public: friend class Node; friend class ProgramOptimize; - BlockDesc(const proto::BlockDesc &desc); - + BlockDesc(PaddleMobile__Framework__Proto__BlockDesc *desc); BlockDesc(const BlockDesc &block_desc) : index_(block_desc.index_), parent_index_(block_desc.parent_index_) { for (auto &op_desc : block_desc.ops_) { diff --git a/src/framework/program/op_desc.cpp b/src/framework/program/op_desc.cpp index 5bd8a0fc26e26d865faf3bb7ac954ce122eb63c1..c8cbe3b608cc0b7e4e57b318756389bc89a3dec0 100644 --- a/src/framework/program/op_desc.cpp +++ b/src/framework/program/op_desc.cpp @@ -20,28 +20,28 @@ limitations under the License. */ namespace paddle_mobile { namespace framework { -OpDesc::OpDesc(const proto::OpDesc &desc) : type_(desc.type()) { - 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)); +OpDesc::OpDesc(PaddleMobile__Framework__Proto__OpDesc *desc) { + this->type_ = std::string(desc->type); + for (int i = 0; i < desc->n_inputs; ++i) { + PaddleMobile__Framework__Proto__OpDesc__Var *var = desc->inputs[i]; + std::vector &args = inputs_[std::string(var->parameter)]; + for (int j = 0; j < var->n_arguments; ++j) { + args.emplace_back(std::string(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 (int i = 0; i < desc->n_outputs; ++i) { + PaddleMobile__Framework__Proto__OpDesc__Var *var = desc->outputs[i]; + std::vector &args = outputs_[std::string(var->parameter)]; + for (int j = 0; j < var->n_arguments; ++j) { + args.emplace_back(std::string(var->arguments[j])); } } - for (const proto::OpDesc::Attr &attr : desc.attrs()) { - std::string attr_name = attr.name(); - if (attr.type() != proto::AttrType::BLOCK) { + for (int k = 0; k < desc->n_attrs; ++k) { + PaddleMobile__Framework__Proto__OpDesc__Attr *attr = desc->attrs[k]; + std::string attr_name(attr->name); + if (attr->type != PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BLOCK) { attrs_[attr_name] = Attribute::GetAttrValue(attr); } } diff --git a/src/framework/program/op_desc.h b/src/framework/program/op_desc.h index df32c9f64a4ca6b83603a84a481e82711dbfb869..07b903085d5d9044b93e3e9309390c9a3976580d 100644 --- a/src/framework/program/op_desc.h +++ b/src/framework/program/op_desc.h @@ -19,7 +19,7 @@ limitations under the License. */ #include "common/log.h" #include "common/type_define.h" -#include "framework/framework.pb.h" +#include "framework/framework.pb-c.h" #include "framework/paddle_mobile_object.h" namespace paddle_mobile { @@ -30,8 +30,7 @@ class OpDesc : PaddleMobileObject { friend class ProgramOptimize; friend class FusionOpMatcher; friend class Node; - explicit OpDesc(const proto::OpDesc &desc); - + explicit OpDesc(PaddleMobile__Framework__Proto__OpDesc *op_desc); OpDesc(const OpDesc &op_desc) : type_(op_desc.type_) { this->inputs_ = op_desc.inputs_; this->outputs_ = op_desc.outputs_; diff --git a/src/framework/program/program_desc.cpp b/src/framework/program/program_desc.cpp index 13d3ba65886ff833ef7de9b0b98f12d759c36c85..071f5cf5719853d60e0345cb1c3ceff3761b8401 100644 --- a/src/framework/program/program_desc.cpp +++ b/src/framework/program/program_desc.cpp @@ -15,15 +15,15 @@ limitations under the License. */ #include #include +#include "framework/program/tensor_desc.h" #include "program_desc.h" namespace paddle_mobile { namespace framework { -ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) { - for (auto &block_desc : desc.blocks()) { - // new framework::BlockDesc(block_desc) - blocks_.emplace_back(std::make_shared(block_desc)); +ProgramDesc::ProgramDesc(PaddleMobile__Framework__Proto__ProgramDesc *desc) { + for (int i = 0; i < desc->n_blocks; ++i) { + blocks_.emplace_back(std::make_shared(desc->blocks[i])); } } @@ -55,6 +55,21 @@ void ProgramDesc::Description(std::string header) { LOG(kLOG_DEBUG3) << "argument - " << attr.second; } } + + for (const auto &var_desc : block->Vars()) { + if (var_desc->Type() == VARTYPE_TYPE_LOD_TENSOR) { + LOG(kLOG_DEBUG1) << "var name: " << var_desc->Name(); + + const TensorDesc &tensor_desc = var_desc->Tensor_desc(); + + LOG(kLOG_DEBUG2) << "in var tensor desc dims size: " + << tensor_desc.Dims().size(); + for (int l = 0; l < tensor_desc.Dims().size(); ++l) { + LOG(kLOG_DEBUG3) << "var tensor desc dim " << l + << " value: " << tensor_desc.Dims()[l]; + } + } + } } #endif } diff --git a/src/framework/program/program_desc.h b/src/framework/program/program_desc.h index 1bcd5b562c91a0e7d0910466e91dee642794ee8e..6aa7dd44ce5880d8b1db0e2b3ffad2e0bd31d46e 100644 --- a/src/framework/program/program_desc.h +++ b/src/framework/program/program_desc.h @@ -17,6 +17,7 @@ limitations under the License. */ #include #include "common/types.h" +#include "framework/framework.pb-c.h" #include "framework/paddle_mobile_object.h" #include "framework/program/block_desc.h" @@ -27,8 +28,10 @@ class ProgramDesc : PaddleMobileObject { public: friend class Node; friend class ProgramOptimize; - explicit ProgramDesc(const proto::ProgramDesc &desc); + explicit ProgramDesc(PaddleMobile__Framework__Proto__ProgramDesc *desc); + std::shared_ptr Block(size_t idx); + const std::vector> &Blocks() { return blocks_; } ProgramDesc(const ProgramDesc &program_desc) { for (auto &block : program_desc.blocks_) { diff --git a/src/framework/program/tensor_desc.cpp b/src/framework/program/tensor_desc.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b4bd93f6f19426407868052e5366ebeeaedda69 --- /dev/null +++ b/src/framework/program/tensor_desc.cpp @@ -0,0 +1,19 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +// +// Created by liuRuiLong on 2018/5/26. +// + +#include "tensor_desc.h" diff --git a/src/framework/program/tensor_desc.h b/src/framework/program/tensor_desc.h new file mode 100644 index 0000000000000000000000000000000000000000..b5fdf9ee45a441a45ed9dc91f09499bf22ce7fe0 --- /dev/null +++ b/src/framework/program/tensor_desc.h @@ -0,0 +1,71 @@ +/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#pragma once + +#include + +#include "framework/framework.pb-c.h" + +namespace paddle_mobile { +namespace framework { + +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_STEP_LOD_RANK_TABLE = 12, + VARTYPE_TYPE_STEP_LOD_TENSOR_ARRAY = 13, + VARTYPE_TYPE_STEP_PLACE_LIST = 14, + VARTYPE_TYPE_READER = 15, + VARTYPE_TYPE_CHANNEL = 16, + VARTYPE_TYPE_RAW = 17, + VARTYPE_TYPE_TUPLE = 18 +}; + +class TensorDesc { + public: + TensorDesc() = default; + TensorDesc(const TensorDesc &desc) { + this->dims_ = desc.dims_; + this->data_type_ = desc.data_type_; + } + + TensorDesc(PaddleMobile__Framework__Proto__VarType__TensorDesc *desc) { + for (int i = 0; i < desc->n_dims; ++i) { + int64_t d = desc->dims[i]; + dims_.emplace_back(d); + } + data_type_ = (VarType_Type)desc->data_type; + } + + std::vector Dims() const { return dims_; }; + VarType_Type DataType() const { return data_type_; } + + private: + std::vector dims_; + VarType_Type data_type_; +}; + +} // namespace framework +} // namespace paddle_mobile diff --git a/src/framework/program/var_desc.cpp b/src/framework/program/var_desc.cpp index d5919ba2774d1d8d13a13d3badd340416a53e992..e54ae67b55c15540a0232dc6fdd97e70ae721ddb 100644 --- a/src/framework/program/var_desc.cpp +++ b/src/framework/program/var_desc.cpp @@ -16,9 +16,5 @@ limitations under the License. */ namespace paddle_mobile { -namespace framework { - -VarDesc::VarDesc(const proto::VarDesc &desc) : desc_(desc) {} - -} // namespace framework +namespace framework {} // namespace framework } // namespace paddle_mobile diff --git a/src/framework/program/var_desc.h b/src/framework/program/var_desc.h index 827e7ac00c409eadd0dc1b6bd2315b1ac5b3386e..5ab2fc56178b8d48d2dfb637817eca13b53677d5 100644 --- a/src/framework/program/var_desc.h +++ b/src/framework/program/var_desc.h @@ -14,72 +14,133 @@ limitations under the License. */ #pragma once -#include "framework/framework.pb.h" +#include "framework/framework.pb-c.h" #include "framework/paddle_mobile_object.h" +#include "framework/program/tensor_desc.h" namespace paddle_mobile { namespace framework { -class VarDesc { - public: - VarDesc(const proto::VarDesc &desc); +/* - VarDesc(const VarDesc &var_desc) : desc_(var_desc.desc_) {} +PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL = 0, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT16 = 1, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT32 = 2, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT64 = 3, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP16 = 4, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP32 = 5, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FP64 = 6, - std::string Name() const { return desc_.name(); } + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_TENSOR = 7, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__SELECTED_ROWS = 8, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FEED_MINIBATCH = 9, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__FETCH_LIST = 10, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__STEP_SCOPES = 11, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_RANK_TABLE = 12, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__LOD_TENSOR_ARRAY = 13, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__PLACE_LIST = 14, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__READER = 15, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__CHANNEL = 16, - proto::VarType::Type GetType() const { return desc_.type().type(); } + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__RAW = 17, + PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__TUPLE = 18 - 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; - } + */ + +class VarDesc { + public: + VarDesc(const VarDesc &var_desc) { + this->data_type_ = var_desc.data_type_; + this->name_ = var_desc.name_; + this->persistable_ = var_desc.persistable_; + this->tensor_desc_ = var_desc.tensor_desc_; + this->type_ = var_desc.type_; + /* + * + * std::string name_; + bool persistable_; + TensorDesc tensor_desc_; + VarType_Type type_; + VarType_Type data_type_; + * */ } + VarDesc(PaddleMobile__Framework__Proto__VarDesc *desc) { + type_ = (VarType_Type)desc->type->type; + name_ = std::string(desc->name); + persistable_ = (bool)desc->persistable; + + switch (type_) { + case VARTYPE_TYPE_SELECTED_ROWS: + tensor_desc_ = TensorDesc(desc->type->selected_rows); + break; + case VARTYPE_TYPE_LOD_TENSOR: + tensor_desc_ = TensorDesc(desc->type->lod_tensor->tensor); + break; + case VARTYPE_TYPE_STEP_LOD_TENSOR_ARRAY: + desc->type->tensor_array->tensor->data_type; + tensor_desc_ = TensorDesc(desc->type->tensor_array->tensor); - 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(); + break; default: break; } - } - - proto::VarType::Type GetDataType() const { - switch (desc_.type().type()) { - case proto::VarType::CHANNEL: - return channel_desc().data_type(); + switch (type_) { + case VARTYPE_TYPE_CHANNEL: + data_type_ = (VarType_Type)desc->type->channel->data_type; break; default: - return tensor_desc().data_type(); + data_type_ = tensor_desc_.DataType(); + break; } } - - 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::string Name() const { return name_; } + + VarType_Type Type() const { return type_; } + + bool Persistable() const { return persistable_; } + + const TensorDesc &Tensor_desc() const { return tensor_desc_; } + + // const proto::VarType::ChannelDesc &channel_desc() const { + // switch (desc_.type().type()) { + // case proto::VarType::CHANNEL: + // return desc_.type().channel(); + // 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(); + // } + // } + + // 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()); + // } private: - proto::VarDesc desc_; + std::string name_; + bool persistable_; + TensorDesc tensor_desc_; + VarType_Type type_; + VarType_Type data_type_; }; } // namespace framework diff --git a/src/framework/tensor_util.cpp b/src/framework/tensor_util.cpp index 1326e63e3b0b71fbe11bae19defd58a9fe0963f0..23b775b095d04c46764791f9f8438f2b888263bd 100644 --- a/src/framework/tensor_util.cpp +++ b/src/framework/tensor_util.cpp @@ -132,37 +132,6 @@ bool TensorContainsInf(const framework::Tensor &tensor) { 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) {} @@ -176,32 +145,5 @@ struct DeserializedDataFunctor { 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 e32721a5cde7cc61630e7f5fffb3b7fbd5bc96ab..9af873d34a914b966a20c79a9c8f815309cba680 100644 --- a/src/framework/tensor_util.h +++ b/src/framework/tensor_util.h @@ -14,7 +14,6 @@ limitations under the License. */ #pragma once #include -#include "framework.pb.h" #include "memory/t_malloc.h" #include "platform/data_type.h" #include "tensor.h" diff --git a/src/io.cpp b/src/io.cpp index eaab40b519fa566627dc31571e3d246d52747004..d2aa9cd62a14f13a240f85a8240376d0d8a9312a 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -18,10 +18,11 @@ limitations under the License. */ #include "common/enforce.h" #include "common/log.h" -#include "framework/framework.pb.h" +#include "framework/framework.pb-c.h" #include "framework/lod_tensor.h" #include "framework/operator.h" #include "framework/program/program_desc.h" +#include "framework/program/var_desc.h" #include "framework/scope.h" #include "framework/tensor.h" @@ -39,12 +40,38 @@ void ReadBinaryFile(const std::string &filename, std::string *contents) { fin.close(); } +static size_t ReadBuffer(const char *file_name, uint8_t **out) { + printf("%s \n", file_name); + FILE *fp; + fp = fopen(file_name, "rb"); + PADDLE_MOBILE_ENFORCE(fp != NULL, "open failed !"); + + fseek(fp, 0, SEEK_END); + size_t size = ftell(fp); + rewind(fp); + + DLOG << "model size: " << size; + + *out = (uint8_t *)malloc(size); + + size_t cur_len = 0; + size_t nread; + while ((nread = fread(*out + cur_len, 1, size - cur_len, fp)) != 0) { + cur_len += nread; + } + fclose(fp); + return cur_len; +} + template -void Loader::LoadVar(framework::LoDTensor *tensor, +void Loader::LoadVar(framework::Variable *variable, + const framework::VarDesc &var_desc, const std::string &file_path) { + auto tensor = variable->GetMutable(); std::ifstream is(file_path); PADDLE_MOBILE_ENFORCE(is.is_open(), "open file: %s failed", file_path.c_str()); + std::fpos pos; pos = is.tellg(); // save current position is.seekg(0, std::ios::end); @@ -81,39 +108,52 @@ void Loader::LoadVar(framework::LoDTensor *tensor, std::unique_ptr buf(new char[size]); is.read(reinterpret_cast(buf.get()), size); - framework::proto::VarType::TensorDesc desc; - desc.ParseFromArray(buf.get(), size); + const framework::TensorDesc &desc = var_desc.Tensor_desc(); + + PaddleMobile__Framework__Proto__VarType__TensorDesc *tensor_desc = NULL; + // void *v; + // PaddleMobile__Framework__Proto__VarType__TensorDesc_Closure()(tensor_desc, + // buf.get()); + + // DLOG << "PaddleMobile__Framework__Proto__VarType__TensorDesc_Closure- " << + // tensor_desc; + + // framework::TensorDesc &tensor_desc = variable-> + // PaddleMobile__Framework__Proto__ProgramDesc *c_program; + // uint8_t *proto_buf = NULL; + // size_t read_size = ReadBuffer(file_path.c_str(), &proto_buf); + // c_program = paddle_mobile__framework__proto__program_desc__unpack(NULL, + // read_size, buf); + + // paddle_mobile__framework__proto__var_type__tensor_desc__init() int memory_size = 1; - for (auto l : desc.dims()) { + for (auto l : desc.Dims()) { memory_size *= 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)); + tensor->Resize(framework::make_ddim(desc.Dims())); void *memory = tensor; int type_size = 0; - switch (desc.data_type()) { - case framework::proto::VarType::FP16: + switch (desc.DataType()) { + case framework::VARTYPE_TYPE_FP16: type_size = 2; break; - case framework::proto::VarType::FP32: + case framework::VARTYPE_TYPE_FP32: type_size = 4; memory = tensor->mutable_data(); break; - case framework::proto::VarType::FP64: + case framework::VARTYPE_TYPE_FP64: type_size = 8; break; - case framework::proto::VarType::INT32: + case framework::VARTYPE_TYPE_INT32: type_size = 4; break; - case framework::proto::VarType::INT64: + case framework::VARTYPE_TYPE_INT64: type_size = 8; break; - case framework::proto::VarType::BOOL: + case framework::VARTYPE_TYPE_BOOL: type_size = 1; break; default: @@ -128,13 +168,21 @@ 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); + PaddleMobile__Framework__Proto__ProgramDesc *c_program; + uint8_t *buf = NULL; + size_t read_size = ReadBuffer(model_filename.c_str(), &buf); + + PADDLE_MOBILE_ENFORCE(buf != NULL, "read from __model__ is null"); + + c_program = paddle_mobile__framework__proto__program_desc__unpack( + NULL, read_size, buf); + + PADDLE_MOBILE_ENFORCE(c_program != NULL, "program is null"); + + DLOG << "n_ops: " << (*c_program->blocks)->n_ops; std::shared_ptr originProgramDesc = - std::make_shared(program_desc_proto); + std::make_shared(c_program); framework::Program program; program.model_path = dirname; @@ -148,172 +196,26 @@ const framework::Program Loader::Load( for (const auto &block : originProgramDesc->Blocks()) { for (int i = 0; i < block->Vars().size(); ++i) { std::shared_ptr var_desc = block->Vars()[i]; + // DLOG << "var name-- " << var_desc->Name(); auto var = scope->Var(var_desc->Name()); - if (var_desc->GetType() == framework::proto::VarType::LOD_TENSOR) { + + if (var_desc->Type() == framework::VARTYPE_TYPE_LOD_TENSOR) { if (var_desc->Persistable() && - var_desc->GetType() != framework::proto::VarType::FEED_MINIBATCH && - var_desc->GetType() != framework::proto::VarType::FETCH_LIST) { - auto tensor = var->GetMutable(); - // to load - LoadVar(tensor, dirname + "/" + var_desc->Name()); + var_desc->Type() != framework::VARTYPE_TYPE_FEED_MINIBATCH && + var_desc->Type() != framework::VARTYPE_TYPE_FETCH_LIST) { + // DLOG << "to load var "; + LoadVar(var, *var_desc, dirname + "/" + var_desc->Name()); } + } else { // TODO(codeWorm): some. } } } -#ifdef PADDLE_MOBILE_DEBUG - for (const auto &block : program_desc_proto.blocks()) { - LOG(kLOG_DEBUG) << "block: " << block.idx(); - for (int j = 0; j < block.ops().size(); ++j) { - framework::proto::OpDesc op = block.ops()[j]; - LOG(kLOG_DEBUG1) << "op: " << op.type(); - for (int m = 0; m < op.inputs_size(); ++m) { - const framework::proto::OpDesc::Var &var = op.inputs(m); - LOG(kLOG_DEBUG2) << "input parameter: " << var.parameter(); - for (const auto &n : var.arguments()) { - LOG(kLOG_DEBUG3) << "argument - " << n; - } - } - - for (int y = 0; y < op.outputs_size(); ++y) { - const framework::proto::OpDesc::Var &var = op.outputs(y); - LOG(kLOG_DEBUG2) << "out parameter: " << var.parameter(); - for (const auto &z : var.arguments()) { - LOG(kLOG_DEBUG3) << "argument - " << z; - } - } - - for (const auto &attr : op.attrs()) { - LOG(kLOG_DEBUG2) << "attr name: " << attr.name(); - - switch (attr.type()) { - case framework::proto::AttrType::BOOLEAN: - LOG(kLOG_DEBUG3) << "boolen: " << attr.b(); - break; - case framework::proto::AttrType::INT: - LOG(kLOG_DEBUG3) << "int: " << attr.i(); - break; - case framework::proto::AttrType::FLOAT: - LOG(kLOG_DEBUG3) << "float: " << attr.f(); - case framework::proto::AttrType::STRING: - LOG(kLOG_DEBUG3) << "string: " << attr.s(); - case framework::proto::AttrType::BOOLEANS: - for (int y = 0; y < attr.bools_size(); ++y) { - LOG(kLOG_DEBUG3) << "bools: " << attr.bools(y); - } - case framework::proto::AttrType::LONG: - LOG(kLOG_DEBUG3) << "long: " << attr.l(); - case framework::proto::AttrType::FLOATS: - for (int y = 0; y < attr.floats_size(); ++y) { - LOG(kLOG_DEBUG3) << "floats: " << attr.floats(y); - } - case framework::proto::AttrType::INTS: - for (int y = 0; y < attr.ints_size(); ++y) { - LOG(kLOG_DEBUG3) << "ints: " << attr.ints(y); - } - case framework::proto::AttrType::STRINGS: - for (int y = 0; y < attr.strings_size(); ++y) { - LOG(kLOG_DEBUG3) << "strings: " << attr.strings(y); - } - case framework::proto::BLOCK: - break; - } - } - } - - for (const auto &var : block.vars()) { - if (var.type().type() == framework::proto::VarType::LOD_TENSOR) { - LOG(kLOG_DEBUG1) << "var name: " << var.name(); - const framework::proto::VarType::TensorDesc &tensor_desc = - var.type().lod_tensor().tensor(); - LOG(kLOG_DEBUG2) << "in var tensor desc dims size: " - << tensor_desc.dims().size(); - for (int l = 0; l < tensor_desc.dims().size(); ++l) { - LOG(kLOG_DEBUG3) << "var tensor desc dim " << l - << " value: " << tensor_desc.dims()[l]; - } - } - - if (var.persistable() && - var.type().type() != framework::proto::VarType::FEED_MINIBATCH && - var.type().type() != framework::proto::VarType::FETCH_LIST) { - std::string file_path = dirname + "/" + var.name(); - std::ifstream is(file_path); - PADDLE_MOBILE_ENFORCE(is.is_open(), "open file: %s failed", - file_path.c_str()); - std::fpos pos; - pos = is.tellg(); // save current position - is.seekg(0, std::ios::end); - is.seekg(pos); // restore saved position - - // 1. version - uint32_t version; - is.read(reinterpret_cast(&version), sizeof(version)); - - // 2 Lod information - uint64_t lod_level; - is.read(reinterpret_cast(&lod_level), sizeof(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) { - } - } - - is.read(reinterpret_cast(&version), sizeof(version)); - - int32_t size; - is.read(reinterpret_cast(&size), sizeof(size)); - std::unique_ptr buf(new char[size]); - is.read(reinterpret_cast(buf.get()), size); - - framework::proto::VarType::TensorDesc desc; - desc.ParseFromArray(buf.get(), size); - - int memory_size = 1; - for (long long l : desc.dims()) { - memory_size *= l; - } - - int type_size = 0; - switch (desc.data_type()) { - case framework::proto::VarType::FP16: - type_size = 2; - break; - case framework::proto::VarType::FP32: - type_size = 4; - break; - case framework::proto::VarType::FP64: - type_size = 8; - break; - case framework::proto::VarType::INT32: - type_size = 4; - break; - case framework::proto::VarType::INT64: - type_size = 8; - break; - case framework::proto::VarType::BOOL: - type_size = 1; - break; - default: - break; - } - - void *memory = malloc(memory_size * type_size); - is.read(static_cast(memory), memory_size * type_size); - is.close(); - } else { - // TODO - } - } - } + originProgramDesc->Description("program: "); -#endif + paddle_mobile__framework__proto__program_desc__free_unpacked(c_program, NULL); return program; } @@ -347,7 +249,8 @@ Executor::Executor(const framework::Program p) : program_(p) { } template -void Executor::LoadMemory(framework::LoDTensor *tensor, +void Executor::LoadMemory(const framework::VarDesc var_desc, + framework::LoDTensor *tensor, const std::string &file_path) { std::ifstream is(file_path); PADDLE_MOBILE_ENFORCE(is.is_open(), "open file: %s failed", @@ -388,39 +291,35 @@ void Executor::LoadMemory(framework::LoDTensor *tensor, std::unique_ptr buf(new char[size]); is.read(reinterpret_cast(buf.get()), size); - framework::proto::VarType::TensorDesc desc; - desc.ParseFromArray(buf.get(), size); + const framework::TensorDesc &desc = var_desc.Tensor_desc(); int memory_size = 1; - for (auto l : desc.dims()) { + for (auto l : desc.Dims()) { memory_size *= 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)); + tensor->Resize(framework::make_ddim(desc.Dims())); void *memory = tensor; int type_size = 0; - switch (desc.data_type()) { - case framework::proto::VarType::FP16: + switch (desc.DataType()) { + case framework::VARTYPE_TYPE_FP16: type_size = 2; break; - case framework::proto::VarType::FP32: + case framework::VARTYPE_TYPE_FP32: type_size = 4; memory = tensor->mutable_data(); break; - case framework::proto::VarType::FP64: + case framework::VARTYPE_TYPE_FP64: type_size = 8; break; - case framework::proto::VarType::INT32: + case framework::VARTYPE_TYPE_INT32: type_size = 4; break; - case framework::proto::VarType::INT64: + case framework::VARTYPE_TYPE_INT64: type_size = 8; break; - case framework::proto::VarType::BOOL: + case framework::VARTYPE_TYPE_BOOL: type_size = 1; break; default: @@ -438,9 +337,10 @@ void Executor::InitMemory() { auto var = program_.scope->Var(var_desc->Name()); if (var_desc->Persistable()) { auto tensor = var->template GetMutable(); - LoadMemory(tensor, program_.model_path + "/" + var_desc->Name()); + LoadMemory(*var_desc, tensor, + program_.model_path + "/" + var_desc->Name()); } else { - if (var_desc->GetType() == framework::proto::VarType::LOD_TENSOR) { + if (var_desc->Type() == framework::VARTYPE_TYPE_LOD_TENSOR) { auto tensor = var->template GetMutable(); tensor->template mutable_data(); } diff --git a/src/io.h b/src/io.h index f58c7d312c6459470d25eec25b1632c9b77848e0..d0ed5e67526d65e3d7d1a8f7ba72e9b2f7730a42 100644 --- a/src/io.h +++ b/src/io.h @@ -33,7 +33,9 @@ class Loader : PaddleMobileObject { const framework::Program Load(const std::string &dirname); private: - void LoadVar(framework::LoDTensor *tensor, const std::string &file_path); + void LoadVar(framework::Variable *variable, + const framework::VarDesc &var_desc, + const std::string &file_path); }; template @@ -52,7 +54,8 @@ class Executor { protected: void InitMemory(); - void LoadMemory(framework::LoDTensor *tensor, const std::string &file_path); + void LoadMemory(const framework::VarDesc var_desc, + framework::LoDTensor *tensor, const std::string &file_path); framework::Program program_; std::shared_ptr to_predict_program_; void predict(const framework::Tensor &t, int block_id); diff --git a/src/platform/data_type.h b/src/platform/data_type.h index 86e5c0ac7759252f2caec3c380ffec9e6f5d03b5..44e0158a7cd7f912689f8514c9c8cfddae5654a1 100644 --- a/src/platform/data_type.h +++ b/src/platform/data_type.h @@ -16,12 +16,13 @@ limitations under the License. */ #include #include -#include "framework/framework.pb.h" + +#include "framework/program/tensor_desc.h" namespace paddle_mobile { namespace framework { -inline proto::VarType::Type ToDataType(std::type_index type) { +inline VarType_Type ToDataType(std::type_index type) { /*if (typeid(platform::float16).hash_code() == type.hash_code()) { return proto::VarType::FP16; } else */ @@ -31,34 +32,34 @@ inline proto::VarType::Type ToDataType(std::type_index type) { // 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; + return VARTYPE_TYPE_FP32; } else if (typeid(const double).hash_code() == type.hash_code()) { - return proto::VarType::FP64; + return VARTYPE_TYPE_FP64; } else if (typeid(const int).hash_code() == type.hash_code()) { - return proto::VarType::INT32; + return VARTYPE_TYPE_INT32; } else if (typeid(const int64_t).hash_code() == type.hash_code()) { - return proto::VarType::INT64; + return VARTYPE_TYPE_INT64; } else if (typeid(const bool).hash_code() == type.hash_code()) { - return proto::VarType::BOOL; + return VARTYPE_TYPE_BOOL; } else { // PADDLE_THROW("Not supported"); // std::cout << "Not supported"; } } -inline std::type_index ToTypeIndex(proto::VarType::Type type) { +inline std::type_index ToTypeIndex(VarType_Type type) { switch (type) { // case proto::VarType::FP16: // return typeid(platform::float16); - case proto::VarType::FP32: + case VARTYPE_TYPE_FP32: return typeid(float); - case proto::VarType::FP64: + case VARTYPE_TYPE_FP64: return typeid(double); - case proto::VarType::INT32: + case VARTYPE_TYPE_INT32: return typeid(int); - case proto::VarType::INT64: + case VARTYPE_TYPE_INT64: return typeid(int64_t); - case proto::VarType::BOOL: + case VARTYPE_TYPE_BOOL: return typeid(bool); default: // PADDLE_THROW("Not support type %d", type); @@ -67,24 +68,24 @@ inline std::type_index ToTypeIndex(proto::VarType::Type type) { } template -inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { +inline void VisitDataType(VarType_Type type, Visitor visitor) { switch (type) { // case proto::VarType::FP16: // visitor.template operator()(); // break; - case proto::VarType::FP32: + case VARTYPE_TYPE_FP32: visitor.template operator()(); break; - case proto::VarType::FP64: + case VARTYPE_TYPE_FP64: visitor.template operator()(); break; - case proto::VarType::INT32: + case VARTYPE_TYPE_INT32: visitor.template operator()(); break; - case proto::VarType::INT64: + case VARTYPE_TYPE_INT64: visitor.template operator()(); break; - case proto::VarType::BOOL: + case VARTYPE_TYPE_BOOL: visitor.template operator()(); break; default: @@ -93,21 +94,21 @@ inline void VisitDataType(proto::VarType::Type type, Visitor visitor) { } } -inline std::string DataTypeToString(const proto::VarType::Type type) { +inline std::string DataTypeToString(const VarType_Type type) { switch (type) { - case proto::VarType::FP16: + case VARTYPE_TYPE_FP16: return "float16"; - case proto::VarType::FP32: + case VARTYPE_TYPE_FP32: return "float32"; - case proto::VarType::FP64: + case VARTYPE_TYPE_FP64: return "float64"; - case proto::VarType::INT16: + case VARTYPE_TYPE_INT16: return "int16"; - case proto::VarType::INT32: + case VARTYPE_TYPE_INT32: return "int32"; - case proto::VarType::INT64: + case VARTYPE_TYPE_INT64: return "int64"; - case proto::VarType::BOOL: + case VARTYPE_TYPE_BOOL: return "bool"; default: // PADDLE_THROW("Not support type %d", type); @@ -115,8 +116,7 @@ inline std::string DataTypeToString(const proto::VarType::Type type) { } } -inline std::ostream &operator<<(std::ostream &out, - const proto::VarType::Type &type) { +inline std::ostream &operator<<(std::ostream &out, const VarType_Type &type) { out << DataTypeToString(type); return out; } diff --git a/test/test_include.h b/test/test_include.h index 1cc859ff8c4cbb3b5be172bdafec3c0500bb972a..25efbb9f4c00921495a5ab054acdde329c4ef58a 100644 --- a/test/test_include.h +++ b/test/test_include.h @@ -21,7 +21,6 @@ limitations under the License. */ #include "./test_helper.h" #include "common/enforce.h" #include "common/log.h" -#include "framework/framework.pb.h" #include "framework/lod_tensor.h" #include "framework/operator.h" #include "framework/program/block_desc.h"