// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: object_detection/protos/flexible_grid_anchor_generator.proto

#include "object_detection/protos/flexible_grid_anchor_generator.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.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>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG

namespace _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace object_detection {
namespace protos {
PROTOBUF_CONSTEXPR FlexibleGridAnchorGenerator::FlexibleGridAnchorGenerator(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.anchor_grid_)*/{}
  , /*decltype(_impl_.normalize_coordinates_)*/true} {}
struct FlexibleGridAnchorGeneratorDefaultTypeInternal {
  PROTOBUF_CONSTEXPR FlexibleGridAnchorGeneratorDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~FlexibleGridAnchorGeneratorDefaultTypeInternal() {}
  union {
    FlexibleGridAnchorGenerator _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 FlexibleGridAnchorGeneratorDefaultTypeInternal _FlexibleGridAnchorGenerator_default_instance_;
PROTOBUF_CONSTEXPR AnchorGrid::AnchorGrid(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.base_sizes_)*/{}
  , /*decltype(_impl_.aspect_ratios_)*/{}
  , /*decltype(_impl_.height_stride_)*/0u
  , /*decltype(_impl_.width_stride_)*/0u
  , /*decltype(_impl_.height_offset_)*/0u
  , /*decltype(_impl_.width_offset_)*/0u} {}
struct AnchorGridDefaultTypeInternal {
  PROTOBUF_CONSTEXPR AnchorGridDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~AnchorGridDefaultTypeInternal() {}
  union {
    AnchorGrid _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AnchorGridDefaultTypeInternal _AnchorGrid_default_instance_;
}  // namespace protos
}  // namespace object_detection
static ::_pb::Metadata file_level_metadata_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto[2];
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto = nullptr;
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto = nullptr;

const uint32_t TableStruct_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::FlexibleGridAnchorGenerator, _impl_._has_bits_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::FlexibleGridAnchorGenerator, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::FlexibleGridAnchorGenerator, _impl_.anchor_grid_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::FlexibleGridAnchorGenerator, _impl_.normalize_coordinates_),
  ~0u,
  0,
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_._has_bits_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_.base_sizes_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_.aspect_ratios_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_.height_stride_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_.width_stride_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_.height_offset_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::AnchorGrid, _impl_.width_offset_),
  ~0u,
  ~0u,
  0,
  1,
  2,
  3,
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 8, -1, sizeof(::object_detection::protos::FlexibleGridAnchorGenerator)},
  { 10, 22, -1, sizeof(::object_detection::protos::AnchorGrid)},
};

static const ::_pb::Message* const file_default_instances[] = {
  &::object_detection::protos::_FlexibleGridAnchorGenerator_default_instance_._instance,
  &::object_detection::protos::_AnchorGrid_default_instance_._instance,
};

const char descriptor_table_protodef_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n<object_detection/protos/flexible_grid_"
  "anchor_generator.proto\022\027object_detection"
  ".protos\"|\n\033FlexibleGridAnchorGenerator\0228"
  "\n\013anchor_grid\030\001 \003(\0132#.object_detection.p"
  "rotos.AnchorGrid\022#\n\025normalize_coordinate"
  "s\030\002 \001(\010:\004true\"\227\001\n\nAnchorGrid\022\022\n\nbase_siz"
  "es\030\001 \003(\002\022\025\n\raspect_ratios\030\002 \003(\002\022\025\n\rheigh"
  "t_stride\030\003 \001(\r\022\024\n\014width_stride\030\004 \001(\r\022\030\n\r"
  "height_offset\030\005 \001(\r:\0010\022\027\n\014width_offset\030\006"
  " \001(\r:\0010"
  ;
static ::_pbi::once_flag descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto = {
    false, false, 367, descriptor_table_protodef_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto,
    "object_detection/protos/flexible_grid_anchor_generator.proto",
    &descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_once, nullptr, 0, 2,
    schemas, file_default_instances, TableStruct_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto::offsets,
    file_level_metadata_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto, file_level_enum_descriptors_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto,
    file_level_service_descriptors_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_getter() {
  return &descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto;
}

// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto(&descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto);
namespace object_detection {
namespace protos {

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

class FlexibleGridAnchorGenerator::_Internal {
 public:
  using HasBits = decltype(std::declval<FlexibleGridAnchorGenerator>()._impl_._has_bits_);
  static void set_has_normalize_coordinates(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
};

FlexibleGridAnchorGenerator::FlexibleGridAnchorGenerator(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.FlexibleGridAnchorGenerator)
}
FlexibleGridAnchorGenerator::FlexibleGridAnchorGenerator(const FlexibleGridAnchorGenerator& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  FlexibleGridAnchorGenerator* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.anchor_grid_){from._impl_.anchor_grid_}
    , decltype(_impl_.normalize_coordinates_){}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  _this->_impl_.normalize_coordinates_ = from._impl_.normalize_coordinates_;
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.FlexibleGridAnchorGenerator)
}

inline void FlexibleGridAnchorGenerator::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.anchor_grid_){arena}
    , decltype(_impl_.normalize_coordinates_){true}
  };
}

FlexibleGridAnchorGenerator::~FlexibleGridAnchorGenerator() {
  // @@protoc_insertion_point(destructor:object_detection.protos.FlexibleGridAnchorGenerator)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void FlexibleGridAnchorGenerator::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.anchor_grid_.~RepeatedPtrField();
}

void FlexibleGridAnchorGenerator::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void FlexibleGridAnchorGenerator::Clear() {
// @@protoc_insertion_point(message_clear_start:object_detection.protos.FlexibleGridAnchorGenerator)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _impl_.anchor_grid_.Clear();
  _impl_.normalize_coordinates_ = true;
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* FlexibleGridAnchorGenerator::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // repeated .object_detection.protos.AnchorGrid anchor_grid = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_anchor_grid(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional bool normalize_coordinates = 2 [default = true];
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
          _Internal::set_has_normalize_coordinates(&has_bits);
          _impl_.normalize_coordinates_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* FlexibleGridAnchorGenerator::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.FlexibleGridAnchorGenerator)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .object_detection.protos.AnchorGrid anchor_grid = 1;
  for (unsigned i = 0,
      n = static_cast<unsigned>(this->_internal_anchor_grid_size()); i < n; i++) {
    const auto& repfield = this->_internal_anchor_grid(i);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream);
  }

  cached_has_bits = _impl_._has_bits_[0];
  // optional bool normalize_coordinates = 2 [default = true];
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(2, this->_internal_normalize_coordinates(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:object_detection.protos.FlexibleGridAnchorGenerator)
  return target;
}

size_t FlexibleGridAnchorGenerator::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.FlexibleGridAnchorGenerator)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .object_detection.protos.AnchorGrid anchor_grid = 1;
  total_size += 1UL * this->_internal_anchor_grid_size();
  for (const auto& msg : this->_impl_.anchor_grid_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // optional bool normalize_coordinates = 2 [default = true];
  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    total_size += 1 + 1;
  }

  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData FlexibleGridAnchorGenerator::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
    FlexibleGridAnchorGenerator::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*FlexibleGridAnchorGenerator::GetClassData() const { return &_class_data_; }


void FlexibleGridAnchorGenerator::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<FlexibleGridAnchorGenerator*>(&to_msg);
  auto& from = static_cast<const FlexibleGridAnchorGenerator&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:object_detection.protos.FlexibleGridAnchorGenerator)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _this->_impl_.anchor_grid_.MergeFrom(from._impl_.anchor_grid_);
  if (from._internal_has_normalize_coordinates()) {
    _this->_internal_set_normalize_coordinates(from._internal_normalize_coordinates());
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void FlexibleGridAnchorGenerator::InternalSwap(FlexibleGridAnchorGenerator* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  _impl_.anchor_grid_.InternalSwap(&other->_impl_.anchor_grid_);
  swap(_impl_.normalize_coordinates_, other->_impl_.normalize_coordinates_);
}

::PROTOBUF_NAMESPACE_ID::Metadata FlexibleGridAnchorGenerator::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto[0]);
}

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

class AnchorGrid::_Internal {
 public:
  using HasBits = decltype(std::declval<AnchorGrid>()._impl_._has_bits_);
  static void set_has_height_stride(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_width_stride(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_height_offset(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_width_offset(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
};

AnchorGrid::AnchorGrid(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.AnchorGrid)
}
AnchorGrid::AnchorGrid(const AnchorGrid& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  AnchorGrid* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.base_sizes_){from._impl_.base_sizes_}
    , decltype(_impl_.aspect_ratios_){from._impl_.aspect_ratios_}
    , decltype(_impl_.height_stride_){}
    , decltype(_impl_.width_stride_){}
    , decltype(_impl_.height_offset_){}
    , decltype(_impl_.width_offset_){}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::memcpy(&_impl_.height_stride_, &from._impl_.height_stride_,
    static_cast<size_t>(reinterpret_cast<char*>(&_impl_.width_offset_) -
    reinterpret_cast<char*>(&_impl_.height_stride_)) + sizeof(_impl_.width_offset_));
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.AnchorGrid)
}

inline void AnchorGrid::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.base_sizes_){arena}
    , decltype(_impl_.aspect_ratios_){arena}
    , decltype(_impl_.height_stride_){0u}
    , decltype(_impl_.width_stride_){0u}
    , decltype(_impl_.height_offset_){0u}
    , decltype(_impl_.width_offset_){0u}
  };
}

AnchorGrid::~AnchorGrid() {
  // @@protoc_insertion_point(destructor:object_detection.protos.AnchorGrid)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void AnchorGrid::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.base_sizes_.~RepeatedField();
  _impl_.aspect_ratios_.~RepeatedField();
}

void AnchorGrid::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void AnchorGrid::Clear() {
// @@protoc_insertion_point(message_clear_start:object_detection.protos.AnchorGrid)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _impl_.base_sizes_.Clear();
  _impl_.aspect_ratios_.Clear();
  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    ::memset(&_impl_.height_stride_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&_impl_.width_offset_) -
        reinterpret_cast<char*>(&_impl_.height_stride_)) + sizeof(_impl_.width_offset_));
  }
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* AnchorGrid::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // repeated float base_sizes = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
          ptr -= 1;
          do {
            ptr += 1;
            _internal_add_base_sizes(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr));
            ptr += sizeof(float);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<13>(ptr));
        } else if (static_cast<uint8_t>(tag) == 10) {
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedFloatParser(_internal_mutable_base_sizes(), ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated float aspect_ratios = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 21)) {
          ptr -= 1;
          do {
            ptr += 1;
            _internal_add_aspect_ratios(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr));
            ptr += sizeof(float);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<21>(ptr));
        } else if (static_cast<uint8_t>(tag) == 18) {
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedFloatParser(_internal_mutable_aspect_ratios(), ptr, ctx);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional uint32 height_stride = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
          _Internal::set_has_height_stride(&has_bits);
          _impl_.height_stride_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional uint32 width_stride = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
          _Internal::set_has_width_stride(&has_bits);
          _impl_.width_stride_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional uint32 height_offset = 5 [default = 0];
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
          _Internal::set_has_height_offset(&has_bits);
          _impl_.height_offset_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional uint32 width_offset = 6 [default = 0];
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
          _Internal::set_has_width_offset(&has_bits);
          _impl_.width_offset_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* AnchorGrid::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.AnchorGrid)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated float base_sizes = 1;
  for (int i = 0, n = this->_internal_base_sizes_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(1, this->_internal_base_sizes(i), target);
  }

  // repeated float aspect_ratios = 2;
  for (int i = 0, n = this->_internal_aspect_ratios_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(2, this->_internal_aspect_ratios(i), target);
  }

  cached_has_bits = _impl_._has_bits_[0];
  // optional uint32 height_stride = 3;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_height_stride(), target);
  }

  // optional uint32 width_stride = 4;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_width_stride(), target);
  }

  // optional uint32 height_offset = 5 [default = 0];
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteUInt32ToArray(5, this->_internal_height_offset(), target);
  }

  // optional uint32 width_offset = 6 [default = 0];
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteUInt32ToArray(6, this->_internal_width_offset(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:object_detection.protos.AnchorGrid)
  return target;
}

size_t AnchorGrid::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.AnchorGrid)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated float base_sizes = 1;
  {
    unsigned int count = static_cast<unsigned int>(this->_internal_base_sizes_size());
    size_t data_size = 4UL * count;
    total_size += 1 *
                  ::_pbi::FromIntSize(this->_internal_base_sizes_size());
    total_size += data_size;
  }

  // repeated float aspect_ratios = 2;
  {
    unsigned int count = static_cast<unsigned int>(this->_internal_aspect_ratios_size());
    size_t data_size = 4UL * count;
    total_size += 1 *
                  ::_pbi::FromIntSize(this->_internal_aspect_ratios_size());
    total_size += data_size;
  }

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    // optional uint32 height_stride = 3;
    if (cached_has_bits & 0x00000001u) {
      total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_height_stride());
    }

    // optional uint32 width_stride = 4;
    if (cached_has_bits & 0x00000002u) {
      total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_width_stride());
    }

    // optional uint32 height_offset = 5 [default = 0];
    if (cached_has_bits & 0x00000004u) {
      total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_height_offset());
    }

    // optional uint32 width_offset = 6 [default = 0];
    if (cached_has_bits & 0x00000008u) {
      total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_width_offset());
    }

  }
  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData AnchorGrid::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
    AnchorGrid::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*AnchorGrid::GetClassData() const { return &_class_data_; }


void AnchorGrid::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<AnchorGrid*>(&to_msg);
  auto& from = static_cast<const AnchorGrid&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:object_detection.protos.AnchorGrid)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _this->_impl_.base_sizes_.MergeFrom(from._impl_.base_sizes_);
  _this->_impl_.aspect_ratios_.MergeFrom(from._impl_.aspect_ratios_);
  cached_has_bits = from._impl_._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    if (cached_has_bits & 0x00000001u) {
      _this->_impl_.height_stride_ = from._impl_.height_stride_;
    }
    if (cached_has_bits & 0x00000002u) {
      _this->_impl_.width_stride_ = from._impl_.width_stride_;
    }
    if (cached_has_bits & 0x00000004u) {
      _this->_impl_.height_offset_ = from._impl_.height_offset_;
    }
    if (cached_has_bits & 0x00000008u) {
      _this->_impl_.width_offset_ = from._impl_.width_offset_;
    }
    _this->_impl_._has_bits_[0] |= cached_has_bits;
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void AnchorGrid::InternalSwap(AnchorGrid* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  _impl_.base_sizes_.InternalSwap(&other->_impl_.base_sizes_);
  _impl_.aspect_ratios_.InternalSwap(&other->_impl_.aspect_ratios_);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(AnchorGrid, _impl_.width_offset_)
      + sizeof(AnchorGrid::_impl_.width_offset_)
      - PROTOBUF_FIELD_OFFSET(AnchorGrid, _impl_.height_stride_)>(
          reinterpret_cast<char*>(&_impl_.height_stride_),
          reinterpret_cast<char*>(&other->_impl_.height_stride_));
}

::PROTOBUF_NAMESPACE_ID::Metadata AnchorGrid::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fflexible_5fgrid_5fanchor_5fgenerator_2eproto[1]);
}

// @@protoc_insertion_point(namespace_scope)
}  // namespace protos
}  // namespace object_detection
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::object_detection::protos::FlexibleGridAnchorGenerator*
Arena::CreateMaybeMessage< ::object_detection::protos::FlexibleGridAnchorGenerator >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::FlexibleGridAnchorGenerator >(arena);
}
template<> PROTOBUF_NOINLINE ::object_detection::protos::AnchorGrid*
Arena::CreateMaybeMessage< ::object_detection::protos::AnchorGrid >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::AnchorGrid >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
