// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: function.proto

#include "function.pb.h"

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)
namespace opencv_tensorflow {
class FunctionDefLibraryDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<FunctionDefLibrary>
      _instance;
} _FunctionDefLibrary_default_instance_;
class FunctionDef_Node_AttrEntry_DoNotUseDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<FunctionDef_Node_AttrEntry_DoNotUse>
      _instance;
} _FunctionDef_Node_AttrEntry_DoNotUse_default_instance_;
class FunctionDef_NodeDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<FunctionDef_Node>
      _instance;
} _FunctionDef_Node_default_instance_;
class FunctionDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<FunctionDef>
      _instance;
} _FunctionDef_default_instance_;
class GradientDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<GradientDef>
      _instance;
} _GradientDef_default_instance_;
}  // namespace opencv_tensorflow
namespace protobuf_function_2eproto {
void InitDefaultsFunctionDefLibraryImpl() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
  ::google::protobuf::internal::InitProtobufDefaults();
#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  protobuf_function_2eproto::InitDefaultsFunctionDef();
  protobuf_function_2eproto::InitDefaultsGradientDef();
  {
    void* ptr = &::opencv_tensorflow::_FunctionDefLibrary_default_instance_;
    new (ptr) ::opencv_tensorflow::FunctionDefLibrary();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::opencv_tensorflow::FunctionDefLibrary::InitAsDefaultInstance();
}

void InitDefaultsFunctionDefLibrary() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFunctionDefLibraryImpl);
}

void InitDefaultsFunctionDef_Node_AttrEntry_DoNotUseImpl() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
  ::google::protobuf::internal::InitProtobufDefaults();
#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  protobuf_attr_5fvalue_2eproto::InitDefaultsAttrValue();
  {
    void* ptr = &::opencv_tensorflow::_FunctionDef_Node_AttrEntry_DoNotUse_default_instance_;
    new (ptr) ::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse();
  }
  ::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse::InitAsDefaultInstance();
}

void InitDefaultsFunctionDef_Node_AttrEntry_DoNotUse() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFunctionDef_Node_AttrEntry_DoNotUseImpl);
}

void InitDefaultsFunctionDef_NodeImpl() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
  ::google::protobuf::internal::InitProtobufDefaults();
#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  protobuf_function_2eproto::InitDefaultsFunctionDef_Node_AttrEntry_DoNotUse();
  {
    void* ptr = &::opencv_tensorflow::_FunctionDef_Node_default_instance_;
    new (ptr) ::opencv_tensorflow::FunctionDef_Node();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::opencv_tensorflow::FunctionDef_Node::InitAsDefaultInstance();
}

void InitDefaultsFunctionDef_Node() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFunctionDef_NodeImpl);
}

void InitDefaultsFunctionDefImpl() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
  ::google::protobuf::internal::InitProtobufDefaults();
#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  protobuf_op_5fdef_2eproto::InitDefaultsOpDef();
  protobuf_function_2eproto::InitDefaultsFunctionDef_Node();
  {
    void* ptr = &::opencv_tensorflow::_FunctionDef_default_instance_;
    new (ptr) ::opencv_tensorflow::FunctionDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::opencv_tensorflow::FunctionDef::InitAsDefaultInstance();
}

void InitDefaultsFunctionDef() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsFunctionDefImpl);
}

void InitDefaultsGradientDefImpl() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
  ::google::protobuf::internal::InitProtobufDefaults();
#endif  // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  {
    void* ptr = &::opencv_tensorflow::_GradientDef_default_instance_;
    new (ptr) ::opencv_tensorflow::GradientDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::opencv_tensorflow::GradientDef::InitAsDefaultInstance();
}

void InitDefaultsGradientDef() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsGradientDefImpl);
}

::google::protobuf::Metadata file_level_metadata[5];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDefLibrary, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDefLibrary, function_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDefLibrary, gradient_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse, key_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse, value_),
  0,
  1,
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node, ret_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node, op_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node, arg_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node, dep_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef_Node, attr_),
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef, signature_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::FunctionDef, node_),
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::GradientDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::GradientDef, function_name_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::opencv_tensorflow::GradientDef, gradient_func_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, sizeof(::opencv_tensorflow::FunctionDefLibrary)},
  { 7, 14, sizeof(::opencv_tensorflow::FunctionDef_Node_AttrEntry_DoNotUse)},
  { 16, -1, sizeof(::opencv_tensorflow::FunctionDef_Node)},
  { 26, -1, sizeof(::opencv_tensorflow::FunctionDef)},
  { 33, -1, sizeof(::opencv_tensorflow::GradientDef)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::opencv_tensorflow::_FunctionDefLibrary_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::opencv_tensorflow::_FunctionDef_Node_AttrEntry_DoNotUse_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::opencv_tensorflow::_FunctionDef_Node_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::opencv_tensorflow::_FunctionDef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::opencv_tensorflow::_GradientDef_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  ::google::protobuf::MessageFactory* factory = NULL;
  AssignDescriptors(
      "function.proto", schemas, file_default_instances, TableStruct::offsets, factory,
      file_level_metadata, NULL, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 5);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n\016function.proto\022\021opencv_tensorflow\032\020att"
      "r_value.proto\032\014op_def.proto\"x\n\022FunctionD"
      "efLibrary\0220\n\010function\030\001 \003(\0132\036.opencv_ten"
      "sorflow.FunctionDef\0220\n\010gradient\030\002 \003(\0132\036."
      "opencv_tensorflow.GradientDef\"\261\002\n\013Functi"
      "onDef\022+\n\tsignature\030\001 \001(\0132\030.opencv_tensor"
      "flow.OpDef\0221\n\004node\030\002 \003(\0132#.opencv_tensor"
      "flow.FunctionDef.Node\032\301\001\n\004Node\022\013\n\003ret\030\001 "
      "\003(\t\022\n\n\002op\030\002 \001(\t\022\013\n\003arg\030\003 \003(\t\022\013\n\003dep\030\004 \003("
      "\t\022;\n\004attr\030\005 \003(\0132-.opencv_tensorflow.Func"
      "tionDef.Node.AttrEntry\032I\n\tAttrEntry\022\013\n\003k"
      "ey\030\001 \001(\t\022+\n\005value\030\002 \001(\0132\034.opencv_tensorf"
      "low.AttrValue:\0028\001\";\n\013GradientDef\022\025\n\rfunc"
      "tion_name\030\001 \001(\t\022\025\n\rgradient_func\030\002 \001(\tB/"
      "\n\030org.tensorflow.frameworkB\016FunctionProt"
      "osP\001\370\001\001b\006proto3"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 615);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "function.proto", &protobuf_RegisterTypes);
  ::protobuf_attr_5fvalue_2eproto::AddDescriptors();
  ::protobuf_op_5fdef_2eproto::AddDescriptors();
}

void AddDescriptors() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_function_2eproto
namespace opencv_tensorflow {

// ===================================================================

void FunctionDefLibrary::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FunctionDefLibrary::kFunctionFieldNumber;
const int FunctionDefLibrary::kGradientFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

FunctionDefLibrary::FunctionDefLibrary()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
    ::protobuf_function_2eproto::InitDefaultsFunctionDefLibrary();
  }
  SharedCtor();
  // @@protoc_insertion_point(constructor:opencv_tensorflow.FunctionDefLibrary)
}
FunctionDefLibrary::FunctionDefLibrary(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena),
  function_(arena),
  gradient_(arena) {
  ::protobuf_function_2eproto::InitDefaultsFunctionDefLibrary();
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:opencv_tensorflow.FunctionDefLibrary)
}
FunctionDefLibrary::FunctionDefLibrary(const FunctionDefLibrary& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      function_(from.function_),
      gradient_(from.gradient_),
      _cached_size_(0) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:opencv_tensorflow.FunctionDefLibrary)
}

void FunctionDefLibrary::SharedCtor() {
  _cached_size_ = 0;
}

FunctionDefLibrary::~FunctionDefLibrary() {
  // @@protoc_insertion_point(destructor:opencv_tensorflow.FunctionDefLibrary)
  SharedDtor();
}

void FunctionDefLibrary::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
}

void FunctionDefLibrary::ArenaDtor(void* object) {
  FunctionDefLibrary* _this = reinterpret_cast< FunctionDefLibrary* >(object);
  (void)_this;
}
void FunctionDefLibrary::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void FunctionDefLibrary::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FunctionDefLibrary::descriptor() {
  ::protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const FunctionDefLibrary& FunctionDefLibrary::default_instance() {
  ::protobuf_function_2eproto::InitDefaultsFunctionDefLibrary();
  return *internal_default_instance();
}

FunctionDefLibrary* FunctionDefLibrary::New(::google::protobuf::Arena* arena) const {
  return ::google::protobuf::Arena::CreateMessage<FunctionDefLibrary>(arena);
}

void FunctionDefLibrary::Clear() {
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.FunctionDefLibrary)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  function_.Clear();
  gradient_.Clear();
  _internal_metadata_.Clear();
}

bool FunctionDefLibrary::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:opencv_tensorflow.FunctionDefLibrary)
  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 .opencv_tensorflow.FunctionDef function = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_function()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .opencv_tensorflow.GradientDef gradient = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_gradient()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:opencv_tensorflow.FunctionDefLibrary)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:opencv_tensorflow.FunctionDefLibrary)
  return false;
#undef DO_
}

void FunctionDefLibrary::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:opencv_tensorflow.FunctionDefLibrary)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .opencv_tensorflow.FunctionDef function = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->function_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->function(static_cast<int>(i)), output);
  }

  // repeated .opencv_tensorflow.GradientDef gradient = 2;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->gradient_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->gradient(static_cast<int>(i)), output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:opencv_tensorflow.FunctionDefLibrary)
}

::google::protobuf::uint8* FunctionDefLibrary::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.FunctionDefLibrary)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .opencv_tensorflow.FunctionDef function = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->function_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->function(static_cast<int>(i)), deterministic, target);
  }

  // repeated .opencv_tensorflow.GradientDef gradient = 2;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->gradient_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->gradient(static_cast<int>(i)), deterministic, target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.FunctionDefLibrary)
  return target;
}

size_t FunctionDefLibrary::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.FunctionDefLibrary)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // repeated .opencv_tensorflow.FunctionDef function = 1;
  {
    unsigned int count = static_cast<unsigned int>(this->function_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->function(static_cast<int>(i)));
    }
  }

  // repeated .opencv_tensorflow.GradientDef gradient = 2;
  {
    unsigned int count = static_cast<unsigned int>(this->gradient_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->gradient(static_cast<int>(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 FunctionDefLibrary::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:opencv_tensorflow.FunctionDefLibrary)
  GOOGLE_DCHECK_NE(&from, this);
  const FunctionDefLibrary* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const FunctionDefLibrary>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:opencv_tensorflow.FunctionDefLibrary)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:opencv_tensorflow.FunctionDefLibrary)
    MergeFrom(*source);
  }
}

void FunctionDefLibrary::MergeFrom(const FunctionDefLibrary& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.FunctionDefLibrary)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  function_.MergeFrom(from.function_);
  gradient_.MergeFrom(from.gradient_);
}

void FunctionDefLibrary::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:opencv_tensorflow.FunctionDefLibrary)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void FunctionDefLibrary::CopyFrom(const FunctionDefLibrary& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.FunctionDefLibrary)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool FunctionDefLibrary::IsInitialized() const {
  return true;
}

void FunctionDefLibrary::Swap(FunctionDefLibrary* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    FunctionDefLibrary* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void FunctionDefLibrary::UnsafeArenaSwap(FunctionDefLibrary* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void FunctionDefLibrary::InternalSwap(FunctionDefLibrary* other) {
  using std::swap;
  function_.InternalSwap(&other->function_);
  gradient_.InternalSwap(&other->gradient_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
  swap(_cached_size_, other->_cached_size_);
}

::google::protobuf::Metadata FunctionDefLibrary::GetMetadata() const {
  protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

FunctionDef_Node_AttrEntry_DoNotUse::FunctionDef_Node_AttrEntry_DoNotUse() {}
FunctionDef_Node_AttrEntry_DoNotUse::FunctionDef_Node_AttrEntry_DoNotUse(::google::protobuf::Arena* arena) : SuperType(arena) {}
void FunctionDef_Node_AttrEntry_DoNotUse::MergeFrom(const FunctionDef_Node_AttrEntry_DoNotUse& other) {
  MergeFromInternal(other);
}
::google::protobuf::Metadata FunctionDef_Node_AttrEntry_DoNotUse::GetMetadata() const {
  ::protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[1];
}
void FunctionDef_Node_AttrEntry_DoNotUse::MergeFrom(
    const ::google::protobuf::Message& other) {
  ::google::protobuf::Message::MergeFrom(other);
}


// ===================================================================

void FunctionDef_Node::InitAsDefaultInstance() {
}
void FunctionDef_Node::clear_attr() {
  attr_.Clear();
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FunctionDef_Node::kRetFieldNumber;
const int FunctionDef_Node::kOpFieldNumber;
const int FunctionDef_Node::kArgFieldNumber;
const int FunctionDef_Node::kDepFieldNumber;
const int FunctionDef_Node::kAttrFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

FunctionDef_Node::FunctionDef_Node()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
    ::protobuf_function_2eproto::InitDefaultsFunctionDef_Node();
  }
  SharedCtor();
  // @@protoc_insertion_point(constructor:opencv_tensorflow.FunctionDef.Node)
}
FunctionDef_Node::FunctionDef_Node(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena),
  ret_(arena),
  arg_(arena),
  dep_(arena),
  attr_(arena) {
  ::protobuf_function_2eproto::InitDefaultsFunctionDef_Node();
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:opencv_tensorflow.FunctionDef.Node)
}
FunctionDef_Node::FunctionDef_Node(const FunctionDef_Node& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      ret_(from.ret_),
      arg_(from.arg_),
      dep_(from.dep_),
      _cached_size_(0) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  attr_.MergeFrom(from.attr_);
  op_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.op().size() > 0) {
    op_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.op(),
      GetArenaNoVirtual());
  }
  // @@protoc_insertion_point(copy_constructor:opencv_tensorflow.FunctionDef.Node)
}

void FunctionDef_Node::SharedCtor() {
  op_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  _cached_size_ = 0;
}

FunctionDef_Node::~FunctionDef_Node() {
  // @@protoc_insertion_point(destructor:opencv_tensorflow.FunctionDef.Node)
  SharedDtor();
}

void FunctionDef_Node::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  op_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void FunctionDef_Node::ArenaDtor(void* object) {
  FunctionDef_Node* _this = reinterpret_cast< FunctionDef_Node* >(object);
  (void)_this;
}
void FunctionDef_Node::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void FunctionDef_Node::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FunctionDef_Node::descriptor() {
  ::protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const FunctionDef_Node& FunctionDef_Node::default_instance() {
  ::protobuf_function_2eproto::InitDefaultsFunctionDef_Node();
  return *internal_default_instance();
}

FunctionDef_Node* FunctionDef_Node::New(::google::protobuf::Arena* arena) const {
  return ::google::protobuf::Arena::CreateMessage<FunctionDef_Node>(arena);
}

void FunctionDef_Node::Clear() {
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.FunctionDef.Node)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  ret_.Clear();
  arg_.Clear();
  dep_.Clear();
  attr_.Clear();
  op_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
  _internal_metadata_.Clear();
}

bool FunctionDef_Node::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:opencv_tensorflow.FunctionDef.Node)
  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 string ret = 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->add_ret()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->ret(this->ret_size() - 1).data(),
            static_cast<int>(this->ret(this->ret_size() - 1).length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.FunctionDef.Node.ret"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // string op = 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_op()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->op().data(), static_cast<int>(this->op().length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.FunctionDef.Node.op"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated string arg = 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->add_arg()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->arg(this->arg_size() - 1).data(),
            static_cast<int>(this->arg(this->arg_size() - 1).length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.FunctionDef.Node.arg"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated string dep = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->add_dep()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->dep(this->dep_size() - 1).data(),
            static_cast<int>(this->dep(this->dep_size() - 1).length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.FunctionDef.Node.dep"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // map<string, .opencv_tensorflow.AttrValue> attr = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
          FunctionDef_Node_AttrEntry_DoNotUse::Parser< ::google::protobuf::internal::MapField<
              FunctionDef_Node_AttrEntry_DoNotUse,
              ::std::string, ::opencv_tensorflow::AttrValue,
              ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
              ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
              0 >,
            ::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue > > parser(&attr_);
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
              input, &parser));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            parser.key().data(), static_cast<int>(parser.key().length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.FunctionDef.Node.AttrEntry.key"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:opencv_tensorflow.FunctionDef.Node)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:opencv_tensorflow.FunctionDef.Node)
  return false;
#undef DO_
}

void FunctionDef_Node::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:opencv_tensorflow.FunctionDef.Node)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated string ret = 1;
  for (int i = 0, n = this->ret_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->ret(i).data(), static_cast<int>(this->ret(i).length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.ret");
    ::google::protobuf::internal::WireFormatLite::WriteString(
      1, this->ret(i), output);
  }

  // string op = 2;
  if (this->op().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->op().data(), static_cast<int>(this->op().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.op");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      2, this->op(), output);
  }

  // repeated string arg = 3;
  for (int i = 0, n = this->arg_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->arg(i).data(), static_cast<int>(this->arg(i).length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.arg");
    ::google::protobuf::internal::WireFormatLite::WriteString(
      3, this->arg(i), output);
  }

  // repeated string dep = 4;
  for (int i = 0, n = this->dep_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->dep(i).data(), static_cast<int>(this->dep(i).length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.dep");
    ::google::protobuf::internal::WireFormatLite::WriteString(
      4, this->dep(i), output);
  }

  // map<string, .opencv_tensorflow.AttrValue> attr = 5;
  if (!this->attr().empty()) {
    typedef ::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_pointer
        ConstPtr;
    typedef ConstPtr SortItem;
    typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
    struct Utf8Check {
      static void Check(ConstPtr p) {
        ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
          p->first.data(), static_cast<int>(p->first.length()),
          ::google::protobuf::internal::WireFormatLite::SERIALIZE,
          "opencv_tensorflow.FunctionDef.Node.AttrEntry.key");
      }
    };

    if (output->IsSerializationDeterministic() &&
        this->attr().size() > 1) {
      ::google::protobuf::scoped_array<SortItem> items(
          new SortItem[this->attr().size()]);
      typedef ::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::size_type size_type;
      size_type n = 0;
      for (::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_iterator
          it = this->attr().begin();
          it != this->attr().end(); ++it, ++n) {
        items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
      }
      ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
      ::google::protobuf::scoped_ptr<FunctionDef_Node_AttrEntry_DoNotUse> entry;
      for (size_type i = 0; i < n; i++) {
        entry.reset(attr_.NewEntryWrapper(
            items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
        ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
            5, *entry, output);
        if (entry->GetArena() != NULL) {
          entry.release();
        }
        Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
      }
    } else {
      ::google::protobuf::scoped_ptr<FunctionDef_Node_AttrEntry_DoNotUse> entry;
      for (::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_iterator
          it = this->attr().begin();
          it != this->attr().end(); ++it) {
        entry.reset(attr_.NewEntryWrapper(
            it->first, it->second));
        ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
            5, *entry, output);
        if (entry->GetArena() != NULL) {
          entry.release();
        }
        Utf8Check::Check(&*it);
      }
    }
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:opencv_tensorflow.FunctionDef.Node)
}

::google::protobuf::uint8* FunctionDef_Node::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.FunctionDef.Node)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated string ret = 1;
  for (int i = 0, n = this->ret_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->ret(i).data(), static_cast<int>(this->ret(i).length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.ret");
    target = ::google::protobuf::internal::WireFormatLite::
      WriteStringToArray(1, this->ret(i), target);
  }

  // string op = 2;
  if (this->op().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->op().data(), static_cast<int>(this->op().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.op");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        2, this->op(), target);
  }

  // repeated string arg = 3;
  for (int i = 0, n = this->arg_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->arg(i).data(), static_cast<int>(this->arg(i).length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.arg");
    target = ::google::protobuf::internal::WireFormatLite::
      WriteStringToArray(3, this->arg(i), target);
  }

  // repeated string dep = 4;
  for (int i = 0, n = this->dep_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->dep(i).data(), static_cast<int>(this->dep(i).length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.FunctionDef.Node.dep");
    target = ::google::protobuf::internal::WireFormatLite::
      WriteStringToArray(4, this->dep(i), target);
  }

  // map<string, .opencv_tensorflow.AttrValue> attr = 5;
  if (!this->attr().empty()) {
    typedef ::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_pointer
        ConstPtr;
    typedef ConstPtr SortItem;
    typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
    struct Utf8Check {
      static void Check(ConstPtr p) {
        ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
          p->first.data(), static_cast<int>(p->first.length()),
          ::google::protobuf::internal::WireFormatLite::SERIALIZE,
          "opencv_tensorflow.FunctionDef.Node.AttrEntry.key");
      }
    };

    if (deterministic &&
        this->attr().size() > 1) {
      ::google::protobuf::scoped_array<SortItem> items(
          new SortItem[this->attr().size()]);
      typedef ::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::size_type size_type;
      size_type n = 0;
      for (::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_iterator
          it = this->attr().begin();
          it != this->attr().end(); ++it, ++n) {
        items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
      }
      ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
      ::google::protobuf::scoped_ptr<FunctionDef_Node_AttrEntry_DoNotUse> entry;
      for (size_type i = 0; i < n; i++) {
        entry.reset(attr_.NewEntryWrapper(
            items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
        target = ::google::protobuf::internal::WireFormatLite::
                   InternalWriteMessageNoVirtualToArray(
                       5, *entry, deterministic, target);
;
        if (entry->GetArena() != NULL) {
          entry.release();
        }
        Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
      }
    } else {
      ::google::protobuf::scoped_ptr<FunctionDef_Node_AttrEntry_DoNotUse> entry;
      for (::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_iterator
          it = this->attr().begin();
          it != this->attr().end(); ++it) {
        entry.reset(attr_.NewEntryWrapper(
            it->first, it->second));
        target = ::google::protobuf::internal::WireFormatLite::
                   InternalWriteMessageNoVirtualToArray(
                       5, *entry, deterministic, target);
;
        if (entry->GetArena() != NULL) {
          entry.release();
        }
        Utf8Check::Check(&*it);
      }
    }
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.FunctionDef.Node)
  return target;
}

size_t FunctionDef_Node::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.FunctionDef.Node)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // repeated string ret = 1;
  total_size += 1 *
      ::google::protobuf::internal::FromIntSize(this->ret_size());
  for (int i = 0, n = this->ret_size(); i < n; i++) {
    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
      this->ret(i));
  }

  // repeated string arg = 3;
  total_size += 1 *
      ::google::protobuf::internal::FromIntSize(this->arg_size());
  for (int i = 0, n = this->arg_size(); i < n; i++) {
    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
      this->arg(i));
  }

  // repeated string dep = 4;
  total_size += 1 *
      ::google::protobuf::internal::FromIntSize(this->dep_size());
  for (int i = 0, n = this->dep_size(); i < n; i++) {
    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
      this->dep(i));
  }

  // map<string, .opencv_tensorflow.AttrValue> attr = 5;
  total_size += 1 *
      ::google::protobuf::internal::FromIntSize(this->attr_size());
  {
    ::google::protobuf::scoped_ptr<FunctionDef_Node_AttrEntry_DoNotUse> entry;
    for (::google::protobuf::Map< ::std::string, ::opencv_tensorflow::AttrValue >::const_iterator
        it = this->attr().begin();
        it != this->attr().end(); ++it) {
      if (entry.get() != NULL && entry->GetArena() != NULL) {
        entry.release();
      }
      entry.reset(attr_.NewEntryWrapper(it->first, it->second));
      total_size += ::google::protobuf::internal::WireFormatLite::
          MessageSizeNoVirtual(*entry);
    }
    if (entry.get() != NULL && entry->GetArena() != NULL) {
      entry.release();
    }
  }

  // string op = 2;
  if (this->op().size() > 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->op());
  }

  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 FunctionDef_Node::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:opencv_tensorflow.FunctionDef.Node)
  GOOGLE_DCHECK_NE(&from, this);
  const FunctionDef_Node* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const FunctionDef_Node>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:opencv_tensorflow.FunctionDef.Node)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:opencv_tensorflow.FunctionDef.Node)
    MergeFrom(*source);
  }
}

void FunctionDef_Node::MergeFrom(const FunctionDef_Node& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.FunctionDef.Node)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  ret_.MergeFrom(from.ret_);
  arg_.MergeFrom(from.arg_);
  dep_.MergeFrom(from.dep_);
  attr_.MergeFrom(from.attr_);
  if (from.op().size() > 0) {
    set_op(from.op());
  }
}

void FunctionDef_Node::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:opencv_tensorflow.FunctionDef.Node)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void FunctionDef_Node::CopyFrom(const FunctionDef_Node& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.FunctionDef.Node)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool FunctionDef_Node::IsInitialized() const {
  return true;
}

void FunctionDef_Node::Swap(FunctionDef_Node* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    FunctionDef_Node* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void FunctionDef_Node::UnsafeArenaSwap(FunctionDef_Node* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void FunctionDef_Node::InternalSwap(FunctionDef_Node* other) {
  using std::swap;
  ret_.InternalSwap(&other->ret_);
  arg_.InternalSwap(&other->arg_);
  dep_.InternalSwap(&other->dep_);
  attr_.Swap(&other->attr_);
  op_.Swap(&other->op_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
  swap(_cached_size_, other->_cached_size_);
}

::google::protobuf::Metadata FunctionDef_Node::GetMetadata() const {
  protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void FunctionDef::InitAsDefaultInstance() {
  ::opencv_tensorflow::_FunctionDef_default_instance_._instance.get_mutable()->signature_ = const_cast< ::opencv_tensorflow::OpDef*>(
      ::opencv_tensorflow::OpDef::internal_default_instance());
}
void FunctionDef::_slow_mutable_signature() {
  signature_ = ::google::protobuf::Arena::CreateMessage< ::opencv_tensorflow::OpDef >(
      GetArenaNoVirtual());
}
void FunctionDef::unsafe_arena_set_allocated_signature(
    ::opencv_tensorflow::OpDef* signature) {
  if (GetArenaNoVirtual() == NULL) {
    delete signature_;
  }
  signature_ = signature;
  if (signature) {

  } else {

  }
  // @@protoc_insertion_point(field_unsafe_arena_set_allocated:opencv_tensorflow.FunctionDef.signature)
}
void FunctionDef::clear_signature() {
  if (GetArenaNoVirtual() == NULL && signature_ != NULL) {
    delete signature_;
  }
  signature_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int FunctionDef::kSignatureFieldNumber;
const int FunctionDef::kNodeFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

FunctionDef::FunctionDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
    ::protobuf_function_2eproto::InitDefaultsFunctionDef();
  }
  SharedCtor();
  // @@protoc_insertion_point(constructor:opencv_tensorflow.FunctionDef)
}
FunctionDef::FunctionDef(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena),
  node_(arena) {
  ::protobuf_function_2eproto::InitDefaultsFunctionDef();
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:opencv_tensorflow.FunctionDef)
}
FunctionDef::FunctionDef(const FunctionDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      node_(from.node_),
      _cached_size_(0) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_signature()) {
    signature_ = new ::opencv_tensorflow::OpDef(*from.signature_);
  } else {
    signature_ = NULL;
  }
  // @@protoc_insertion_point(copy_constructor:opencv_tensorflow.FunctionDef)
}

void FunctionDef::SharedCtor() {
  signature_ = NULL;
  _cached_size_ = 0;
}

FunctionDef::~FunctionDef() {
  // @@protoc_insertion_point(destructor:opencv_tensorflow.FunctionDef)
  SharedDtor();
}

void FunctionDef::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  if (this != internal_default_instance()) delete signature_;
}

void FunctionDef::ArenaDtor(void* object) {
  FunctionDef* _this = reinterpret_cast< FunctionDef* >(object);
  (void)_this;
}
void FunctionDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void FunctionDef::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FunctionDef::descriptor() {
  ::protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const FunctionDef& FunctionDef::default_instance() {
  ::protobuf_function_2eproto::InitDefaultsFunctionDef();
  return *internal_default_instance();
}

FunctionDef* FunctionDef::New(::google::protobuf::Arena* arena) const {
  return ::google::protobuf::Arena::CreateMessage<FunctionDef>(arena);
}

void FunctionDef::Clear() {
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.FunctionDef)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  node_.Clear();
  if (GetArenaNoVirtual() == NULL && signature_ != NULL) {
    delete signature_;
  }
  signature_ = NULL;
  _internal_metadata_.Clear();
}

bool FunctionDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:opencv_tensorflow.FunctionDef)
  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)) {
      // .opencv_tensorflow.OpDef signature = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_signature()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .opencv_tensorflow.FunctionDef.Node node = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_node()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:opencv_tensorflow.FunctionDef)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:opencv_tensorflow.FunctionDef)
  return false;
#undef DO_
}

void FunctionDef::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:opencv_tensorflow.FunctionDef)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .opencv_tensorflow.OpDef signature = 1;
  if (this->has_signature()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, *this->signature_, output);
  }

  // repeated .opencv_tensorflow.FunctionDef.Node node = 2;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->node_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->node(static_cast<int>(i)), output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:opencv_tensorflow.FunctionDef)
}

::google::protobuf::uint8* FunctionDef::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.FunctionDef)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .opencv_tensorflow.OpDef signature = 1;
  if (this->has_signature()) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, *this->signature_, deterministic, target);
  }

  // repeated .opencv_tensorflow.FunctionDef.Node node = 2;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->node_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->node(static_cast<int>(i)), deterministic, target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.FunctionDef)
  return target;
}

size_t FunctionDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.FunctionDef)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // repeated .opencv_tensorflow.FunctionDef.Node node = 2;
  {
    unsigned int count = static_cast<unsigned int>(this->node_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->node(static_cast<int>(i)));
    }
  }

  // .opencv_tensorflow.OpDef signature = 1;
  if (this->has_signature()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *this->signature_);
  }

  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 FunctionDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:opencv_tensorflow.FunctionDef)
  GOOGLE_DCHECK_NE(&from, this);
  const FunctionDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const FunctionDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:opencv_tensorflow.FunctionDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:opencv_tensorflow.FunctionDef)
    MergeFrom(*source);
  }
}

void FunctionDef::MergeFrom(const FunctionDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.FunctionDef)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  node_.MergeFrom(from.node_);
  if (from.has_signature()) {
    mutable_signature()->::opencv_tensorflow::OpDef::MergeFrom(from.signature());
  }
}

void FunctionDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:opencv_tensorflow.FunctionDef)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void FunctionDef::CopyFrom(const FunctionDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.FunctionDef)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool FunctionDef::IsInitialized() const {
  return true;
}

void FunctionDef::Swap(FunctionDef* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    FunctionDef* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void FunctionDef::UnsafeArenaSwap(FunctionDef* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void FunctionDef::InternalSwap(FunctionDef* other) {
  using std::swap;
  node_.InternalSwap(&other->node_);
  swap(signature_, other->signature_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
  swap(_cached_size_, other->_cached_size_);
}

::google::protobuf::Metadata FunctionDef::GetMetadata() const {
  protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages];
}


// ===================================================================

void GradientDef::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int GradientDef::kFunctionNameFieldNumber;
const int GradientDef::kGradientFuncFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

GradientDef::GradientDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
    ::protobuf_function_2eproto::InitDefaultsGradientDef();
  }
  SharedCtor();
  // @@protoc_insertion_point(constructor:opencv_tensorflow.GradientDef)
}
GradientDef::GradientDef(::google::protobuf::Arena* arena)
  : ::google::protobuf::Message(),
  _internal_metadata_(arena) {
  ::protobuf_function_2eproto::InitDefaultsGradientDef();
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:opencv_tensorflow.GradientDef)
}
GradientDef::GradientDef(const GradientDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _cached_size_(0) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  function_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.function_name().size() > 0) {
    function_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.function_name(),
      GetArenaNoVirtual());
  }
  gradient_func_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.gradient_func().size() > 0) {
    gradient_func_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.gradient_func(),
      GetArenaNoVirtual());
  }
  // @@protoc_insertion_point(copy_constructor:opencv_tensorflow.GradientDef)
}

void GradientDef::SharedCtor() {
  function_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  gradient_func_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  _cached_size_ = 0;
}

GradientDef::~GradientDef() {
  // @@protoc_insertion_point(destructor:opencv_tensorflow.GradientDef)
  SharedDtor();
}

void GradientDef::SharedDtor() {
  GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  function_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  gradient_func_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void GradientDef::ArenaDtor(void* object) {
  GradientDef* _this = reinterpret_cast< GradientDef* >(object);
  (void)_this;
}
void GradientDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void GradientDef::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* GradientDef::descriptor() {
  ::protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const GradientDef& GradientDef::default_instance() {
  ::protobuf_function_2eproto::InitDefaultsGradientDef();
  return *internal_default_instance();
}

GradientDef* GradientDef::New(::google::protobuf::Arena* arena) const {
  return ::google::protobuf::Arena::CreateMessage<GradientDef>(arena);
}

void GradientDef::Clear() {
// @@protoc_insertion_point(message_clear_start:opencv_tensorflow.GradientDef)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  function_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
  gradient_func_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
  _internal_metadata_.Clear();
}

bool GradientDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:opencv_tensorflow.GradientDef)
  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)) {
      // string function_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_function_name()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->function_name().data(), static_cast<int>(this->function_name().length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.GradientDef.function_name"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // string gradient_func = 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_gradient_func()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->gradient_func().data(), static_cast<int>(this->gradient_func().length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "opencv_tensorflow.GradientDef.gradient_func"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:opencv_tensorflow.GradientDef)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:opencv_tensorflow.GradientDef)
  return false;
#undef DO_
}

void GradientDef::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:opencv_tensorflow.GradientDef)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // string function_name = 1;
  if (this->function_name().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->function_name().data(), static_cast<int>(this->function_name().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.GradientDef.function_name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      1, this->function_name(), output);
  }

  // string gradient_func = 2;
  if (this->gradient_func().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->gradient_func().data(), static_cast<int>(this->gradient_func().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.GradientDef.gradient_func");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      2, this->gradient_func(), output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:opencv_tensorflow.GradientDef)
}

::google::protobuf::uint8* GradientDef::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:opencv_tensorflow.GradientDef)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // string function_name = 1;
  if (this->function_name().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->function_name().data(), static_cast<int>(this->function_name().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.GradientDef.function_name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        1, this->function_name(), target);
  }

  // string gradient_func = 2;
  if (this->gradient_func().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->gradient_func().data(), static_cast<int>(this->gradient_func().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "opencv_tensorflow.GradientDef.gradient_func");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        2, this->gradient_func(), target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:opencv_tensorflow.GradientDef)
  return target;
}

size_t GradientDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:opencv_tensorflow.GradientDef)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // string function_name = 1;
  if (this->function_name().size() > 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->function_name());
  }

  // string gradient_func = 2;
  if (this->gradient_func().size() > 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->gradient_func());
  }

  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 GradientDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:opencv_tensorflow.GradientDef)
  GOOGLE_DCHECK_NE(&from, this);
  const GradientDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const GradientDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:opencv_tensorflow.GradientDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:opencv_tensorflow.GradientDef)
    MergeFrom(*source);
  }
}

void GradientDef::MergeFrom(const GradientDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:opencv_tensorflow.GradientDef)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.function_name().size() > 0) {
    set_function_name(from.function_name());
  }
  if (from.gradient_func().size() > 0) {
    set_gradient_func(from.gradient_func());
  }
}

void GradientDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:opencv_tensorflow.GradientDef)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void GradientDef::CopyFrom(const GradientDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:opencv_tensorflow.GradientDef)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool GradientDef::IsInitialized() const {
  return true;
}

void GradientDef::Swap(GradientDef* other) {
  if (other == this) return;
  if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
    InternalSwap(other);
  } else {
    GradientDef* temp = New(GetArenaNoVirtual());
    temp->MergeFrom(*other);
    other->CopyFrom(*this);
    InternalSwap(temp);
    if (GetArenaNoVirtual() == NULL) {
      delete temp;
    }
  }
}
void GradientDef::UnsafeArenaSwap(GradientDef* other) {
  if (other == this) return;
  GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  InternalSwap(other);
}
void GradientDef::InternalSwap(GradientDef* other) {
  using std::swap;
  function_name_.Swap(&other->function_name_);
  gradient_func_.Swap(&other->gradient_func_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
  swap(_cached_size_, other->_cached_size_);
}

::google::protobuf::Metadata GradientDef::GetMetadata() const {
  protobuf_function_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_function_2eproto::file_level_metadata[kIndexInFileMessages];
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace opencv_tensorflow

// @@protoc_insertion_point(global_scope)