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

#include "object_detection/protos/train.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 TrainConfig::TrainConfig(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.data_augmentation_options_)*/{}
  , /*decltype(_impl_.freeze_variables_)*/{}
  , /*decltype(_impl_.update_trainable_variables_)*/{}
  , /*decltype(_impl_.fine_tune_checkpoint_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.fine_tune_checkpoint_type_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
  , /*decltype(_impl_.optimizer_)*/nullptr
  , /*decltype(_impl_.gradient_clipping_by_norm_)*/0
  , /*decltype(_impl_.num_steps_)*/0u
  , /*decltype(_impl_.bias_grad_multiplier_)*/0
  , /*decltype(_impl_.sync_replicas_)*/false
  , /*decltype(_impl_.from_detection_checkpoint_)*/false
  , /*decltype(_impl_.load_all_detection_checkpoint_vars_)*/false
  , /*decltype(_impl_.merge_multiple_label_boxes_)*/false
  , /*decltype(_impl_.use_multiclass_scores_)*/false
  , /*decltype(_impl_.retain_original_images_)*/false
  , /*decltype(_impl_.use_bfloat16_)*/false
  , /*decltype(_impl_.summarize_gradients_)*/false
  , /*decltype(_impl_.max_number_of_boxes_)*/100
  , /*decltype(_impl_.batch_size_)*/32u
  , /*decltype(_impl_.keep_checkpoint_every_n_hours_)*/10000
  , /*decltype(_impl_.startup_delay_steps_)*/15
  , /*decltype(_impl_.replicas_to_aggregate_)*/1
  , /*decltype(_impl_.batch_queue_capacity_)*/150
  , /*decltype(_impl_.num_batch_queue_threads_)*/8
  , /*decltype(_impl_.prefetch_queue_capacity_)*/5
  , /*decltype(_impl_.add_regularization_loss_)*/true
  , /*decltype(_impl_.unpad_groundtruth_tensors_)*/true} {}
struct TrainConfigDefaultTypeInternal {
  PROTOBUF_CONSTEXPR TrainConfigDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~TrainConfigDefaultTypeInternal() {}
  union {
    TrainConfig _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 TrainConfigDefaultTypeInternal _TrainConfig_default_instance_;
}  // namespace protos
}  // namespace object_detection
static ::_pb::Metadata file_level_metadata_object_5fdetection_2fprotos_2ftrain_2eproto[1];
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_object_5fdetection_2fprotos_2ftrain_2eproto = nullptr;
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_object_5fdetection_2fprotos_2ftrain_2eproto = nullptr;

const uint32_t TableStruct_object_5fdetection_2fprotos_2ftrain_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_._has_bits_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _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::TrainConfig, _impl_.batch_size_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.data_augmentation_options_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.sync_replicas_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.keep_checkpoint_every_n_hours_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.optimizer_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.gradient_clipping_by_norm_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.fine_tune_checkpoint_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.fine_tune_checkpoint_type_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.from_detection_checkpoint_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.load_all_detection_checkpoint_vars_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.num_steps_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.startup_delay_steps_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.bias_grad_multiplier_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.update_trainable_variables_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.freeze_variables_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.replicas_to_aggregate_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.batch_queue_capacity_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.num_batch_queue_threads_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.prefetch_queue_capacity_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.merge_multiple_label_boxes_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.use_multiclass_scores_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.add_regularization_loss_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.max_number_of_boxes_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.unpad_groundtruth_tensors_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.retain_original_images_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.use_bfloat16_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::TrainConfig, _impl_.summarize_gradients_),
  15,
  ~0u,
  6,
  16,
  2,
  3,
  0,
  1,
  7,
  8,
  4,
  17,
  5,
  ~0u,
  ~0u,
  18,
  19,
  20,
  21,
  9,
  10,
  22,
  14,
  23,
  11,
  12,
  13,
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 33, -1, sizeof(::object_detection::protos::TrainConfig)},
};

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

const char descriptor_table_protodef_object_5fdetection_2fprotos_2ftrain_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n#object_detection/protos/train.proto\022\027o"
  "bject_detection.protos\032\'object_detection"
  "/protos/optimizer.proto\032*object_detectio"
  "n/protos/preprocessor.proto\"\241\010\n\013TrainCon"
  "fig\022\026\n\nbatch_size\030\001 \001(\r:\00232\022M\n\031data_augm"
  "entation_options\030\002 \003(\0132*.object_detectio"
  "n.protos.PreprocessingStep\022\034\n\rsync_repli"
  "cas\030\003 \001(\010:\005false\022,\n\035keep_checkpoint_ever"
  "y_n_hours\030\004 \001(\002:\00510000\0225\n\toptimizer\030\005 \001("
  "\0132\".object_detection.protos.Optimizer\022$\n"
  "\031gradient_clipping_by_norm\030\006 \001(\002:\0010\022\036\n\024f"
  "ine_tune_checkpoint\030\007 \001(\t:\000\022#\n\031fine_tune"
  "_checkpoint_type\030\026 \001(\t:\000\022,\n\031from_detecti"
  "on_checkpoint\030\010 \001(\010:\005falseB\002\030\001\0221\n\"load_a"
  "ll_detection_checkpoint_vars\030\023 \001(\010:\005fals"
  "e\022\024\n\tnum_steps\030\t \001(\r:\0010\022\037\n\023startup_delay"
  "_steps\030\n \001(\002:\00215\022\037\n\024bias_grad_multiplier"
  "\030\013 \001(\002:\0010\022\"\n\032update_trainable_variables\030"
  "\031 \003(\t\022\030\n\020freeze_variables\030\014 \003(\t\022 \n\025repli"
  "cas_to_aggregate\030\r \001(\005:\0011\022%\n\024batch_queue"
  "_capacity\030\016 \001(\005:\003150B\002\030\001\022&\n\027num_batch_qu"
  "eue_threads\030\017 \001(\005:\0018B\002\030\001\022&\n\027prefetch_que"
  "ue_capacity\030\020 \001(\005:\0015B\002\030\001\022)\n\032merge_multip"
  "le_label_boxes\030\021 \001(\010:\005false\022$\n\025use_multi"
  "class_scores\030\030 \001(\010:\005false\022%\n\027add_regular"
  "ization_loss\030\022 \001(\010:\004true\022$\n\023max_number_o"
  "f_boxes\030\024 \001(\005:\003100B\002\030\001\022\'\n\031unpad_groundtr"
  "uth_tensors\030\025 \001(\010:\004true\022%\n\026retain_origin"
  "al_images\030\027 \001(\010:\005false\022\033\n\014use_bfloat16\030\032"
  " \001(\010:\005false\022\"\n\023summarize_gradients\030\033 \001(\010"
  ":\005false"
  ;
static const ::_pbi::DescriptorTable* const descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_deps[2] = {
  &::descriptor_table_object_5fdetection_2fprotos_2foptimizer_2eproto,
  &::descriptor_table_object_5fdetection_2fprotos_2fpreprocessor_2eproto,
};
static ::_pbi::once_flag descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto = {
    false, false, 1207, descriptor_table_protodef_object_5fdetection_2fprotos_2ftrain_2eproto,
    "object_detection/protos/train.proto",
    &descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_once, descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_deps, 2, 1,
    schemas, file_default_instances, TableStruct_object_5fdetection_2fprotos_2ftrain_2eproto::offsets,
    file_level_metadata_object_5fdetection_2fprotos_2ftrain_2eproto, file_level_enum_descriptors_object_5fdetection_2fprotos_2ftrain_2eproto,
    file_level_service_descriptors_object_5fdetection_2fprotos_2ftrain_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_getter() {
  return &descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto;
}

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

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

class TrainConfig::_Internal {
 public:
  using HasBits = decltype(std::declval<TrainConfig>()._impl_._has_bits_);
  static void set_has_batch_size(HasBits* has_bits) {
    (*has_bits)[0] |= 32768u;
  }
  static void set_has_sync_replicas(HasBits* has_bits) {
    (*has_bits)[0] |= 64u;
  }
  static void set_has_keep_checkpoint_every_n_hours(HasBits* has_bits) {
    (*has_bits)[0] |= 65536u;
  }
  static const ::object_detection::protos::Optimizer& optimizer(const TrainConfig* msg);
  static void set_has_optimizer(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_gradient_clipping_by_norm(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static void set_has_fine_tune_checkpoint(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_fine_tune_checkpoint_type(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_from_detection_checkpoint(HasBits* has_bits) {
    (*has_bits)[0] |= 128u;
  }
  static void set_has_load_all_detection_checkpoint_vars(HasBits* has_bits) {
    (*has_bits)[0] |= 256u;
  }
  static void set_has_num_steps(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static void set_has_startup_delay_steps(HasBits* has_bits) {
    (*has_bits)[0] |= 131072u;
  }
  static void set_has_bias_grad_multiplier(HasBits* has_bits) {
    (*has_bits)[0] |= 32u;
  }
  static void set_has_replicas_to_aggregate(HasBits* has_bits) {
    (*has_bits)[0] |= 262144u;
  }
  static void set_has_batch_queue_capacity(HasBits* has_bits) {
    (*has_bits)[0] |= 524288u;
  }
  static void set_has_num_batch_queue_threads(HasBits* has_bits) {
    (*has_bits)[0] |= 1048576u;
  }
  static void set_has_prefetch_queue_capacity(HasBits* has_bits) {
    (*has_bits)[0] |= 2097152u;
  }
  static void set_has_merge_multiple_label_boxes(HasBits* has_bits) {
    (*has_bits)[0] |= 512u;
  }
  static void set_has_use_multiclass_scores(HasBits* has_bits) {
    (*has_bits)[0] |= 1024u;
  }
  static void set_has_add_regularization_loss(HasBits* has_bits) {
    (*has_bits)[0] |= 4194304u;
  }
  static void set_has_max_number_of_boxes(HasBits* has_bits) {
    (*has_bits)[0] |= 16384u;
  }
  static void set_has_unpad_groundtruth_tensors(HasBits* has_bits) {
    (*has_bits)[0] |= 8388608u;
  }
  static void set_has_retain_original_images(HasBits* has_bits) {
    (*has_bits)[0] |= 2048u;
  }
  static void set_has_use_bfloat16(HasBits* has_bits) {
    (*has_bits)[0] |= 4096u;
  }
  static void set_has_summarize_gradients(HasBits* has_bits) {
    (*has_bits)[0] |= 8192u;
  }
};

const ::object_detection::protos::Optimizer&
TrainConfig::_Internal::optimizer(const TrainConfig* msg) {
  return *msg->_impl_.optimizer_;
}
void TrainConfig::clear_data_augmentation_options() {
  _impl_.data_augmentation_options_.Clear();
}
void TrainConfig::clear_optimizer() {
  if (_impl_.optimizer_ != nullptr) _impl_.optimizer_->Clear();
  _impl_._has_bits_[0] &= ~0x00000004u;
}
TrainConfig::TrainConfig(::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.TrainConfig)
}
TrainConfig::TrainConfig(const TrainConfig& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  TrainConfig* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.data_augmentation_options_){from._impl_.data_augmentation_options_}
    , decltype(_impl_.freeze_variables_){from._impl_.freeze_variables_}
    , decltype(_impl_.update_trainable_variables_){from._impl_.update_trainable_variables_}
    , decltype(_impl_.fine_tune_checkpoint_){}
    , decltype(_impl_.fine_tune_checkpoint_type_){}
    , decltype(_impl_.optimizer_){nullptr}
    , decltype(_impl_.gradient_clipping_by_norm_){}
    , decltype(_impl_.num_steps_){}
    , decltype(_impl_.bias_grad_multiplier_){}
    , decltype(_impl_.sync_replicas_){}
    , decltype(_impl_.from_detection_checkpoint_){}
    , decltype(_impl_.load_all_detection_checkpoint_vars_){}
    , decltype(_impl_.merge_multiple_label_boxes_){}
    , decltype(_impl_.use_multiclass_scores_){}
    , decltype(_impl_.retain_original_images_){}
    , decltype(_impl_.use_bfloat16_){}
    , decltype(_impl_.summarize_gradients_){}
    , decltype(_impl_.max_number_of_boxes_){}
    , decltype(_impl_.batch_size_){}
    , decltype(_impl_.keep_checkpoint_every_n_hours_){}
    , decltype(_impl_.startup_delay_steps_){}
    , decltype(_impl_.replicas_to_aggregate_){}
    , decltype(_impl_.batch_queue_capacity_){}
    , decltype(_impl_.num_batch_queue_threads_){}
    , decltype(_impl_.prefetch_queue_capacity_){}
    , decltype(_impl_.add_regularization_loss_){}
    , decltype(_impl_.unpad_groundtruth_tensors_){}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  _impl_.fine_tune_checkpoint_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.fine_tune_checkpoint_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_fine_tune_checkpoint()) {
    _this->_impl_.fine_tune_checkpoint_.Set(from._internal_fine_tune_checkpoint(), 
      _this->GetArenaForAllocation());
  }
  _impl_.fine_tune_checkpoint_type_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.fine_tune_checkpoint_type_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  if (from._internal_has_fine_tune_checkpoint_type()) {
    _this->_impl_.fine_tune_checkpoint_type_.Set(from._internal_fine_tune_checkpoint_type(), 
      _this->GetArenaForAllocation());
  }
  if (from._internal_has_optimizer()) {
    _this->_impl_.optimizer_ = new ::object_detection::protos::Optimizer(*from._impl_.optimizer_);
  }
  ::memcpy(&_impl_.gradient_clipping_by_norm_, &from._impl_.gradient_clipping_by_norm_,
    static_cast<size_t>(reinterpret_cast<char*>(&_impl_.unpad_groundtruth_tensors_) -
    reinterpret_cast<char*>(&_impl_.gradient_clipping_by_norm_)) + sizeof(_impl_.unpad_groundtruth_tensors_));
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.TrainConfig)
}

inline void TrainConfig::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_.data_augmentation_options_){arena}
    , decltype(_impl_.freeze_variables_){arena}
    , decltype(_impl_.update_trainable_variables_){arena}
    , decltype(_impl_.fine_tune_checkpoint_){}
    , decltype(_impl_.fine_tune_checkpoint_type_){}
    , decltype(_impl_.optimizer_){nullptr}
    , decltype(_impl_.gradient_clipping_by_norm_){0}
    , decltype(_impl_.num_steps_){0u}
    , decltype(_impl_.bias_grad_multiplier_){0}
    , decltype(_impl_.sync_replicas_){false}
    , decltype(_impl_.from_detection_checkpoint_){false}
    , decltype(_impl_.load_all_detection_checkpoint_vars_){false}
    , decltype(_impl_.merge_multiple_label_boxes_){false}
    , decltype(_impl_.use_multiclass_scores_){false}
    , decltype(_impl_.retain_original_images_){false}
    , decltype(_impl_.use_bfloat16_){false}
    , decltype(_impl_.summarize_gradients_){false}
    , decltype(_impl_.max_number_of_boxes_){100}
    , decltype(_impl_.batch_size_){32u}
    , decltype(_impl_.keep_checkpoint_every_n_hours_){10000}
    , decltype(_impl_.startup_delay_steps_){15}
    , decltype(_impl_.replicas_to_aggregate_){1}
    , decltype(_impl_.batch_queue_capacity_){150}
    , decltype(_impl_.num_batch_queue_threads_){8}
    , decltype(_impl_.prefetch_queue_capacity_){5}
    , decltype(_impl_.add_regularization_loss_){true}
    , decltype(_impl_.unpad_groundtruth_tensors_){true}
  };
  _impl_.fine_tune_checkpoint_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.fine_tune_checkpoint_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
  _impl_.fine_tune_checkpoint_type_.InitDefault();
  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
    _impl_.fine_tune_checkpoint_type_.Set("", GetArenaForAllocation());
  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}

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

inline void TrainConfig::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  _impl_.data_augmentation_options_.~RepeatedPtrField();
  _impl_.freeze_variables_.~RepeatedPtrField();
  _impl_.update_trainable_variables_.~RepeatedPtrField();
  _impl_.fine_tune_checkpoint_.Destroy();
  _impl_.fine_tune_checkpoint_type_.Destroy();
  if (this != internal_default_instance()) delete _impl_.optimizer_;
}

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

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

  _impl_.data_augmentation_options_.Clear();
  _impl_.freeze_variables_.Clear();
  _impl_.update_trainable_variables_.Clear();
  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      _impl_.fine_tune_checkpoint_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      _impl_.fine_tune_checkpoint_type_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000004u) {
      GOOGLE_DCHECK(_impl_.optimizer_ != nullptr);
      _impl_.optimizer_->Clear();
    }
  }
  if (cached_has_bits & 0x000000f8u) {
    ::memset(&_impl_.gradient_clipping_by_norm_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&_impl_.from_detection_checkpoint_) -
        reinterpret_cast<char*>(&_impl_.gradient_clipping_by_norm_)) + sizeof(_impl_.from_detection_checkpoint_));
  }
  if (cached_has_bits & 0x0000ff00u) {
    ::memset(&_impl_.load_all_detection_checkpoint_vars_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&_impl_.summarize_gradients_) -
        reinterpret_cast<char*>(&_impl_.load_all_detection_checkpoint_vars_)) + sizeof(_impl_.summarize_gradients_));
    _impl_.max_number_of_boxes_ = 100;
    _impl_.batch_size_ = 32u;
  }
  if (cached_has_bits & 0x00ff0000u) {
    _impl_.keep_checkpoint_every_n_hours_ = 10000;
    _impl_.startup_delay_steps_ = 15;
    _impl_.replicas_to_aggregate_ = 1;
    _impl_.batch_queue_capacity_ = 150;
    _impl_.num_batch_queue_threads_ = 8;
    _impl_.prefetch_queue_capacity_ = 5;
    _impl_.add_regularization_loss_ = true;
    _impl_.unpad_groundtruth_tensors_ = true;
  }
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* TrainConfig::_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) {
      // optional uint32 batch_size = 1 [default = 32];
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          _Internal::set_has_batch_size(&has_bits);
          _impl_.batch_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated .object_detection.protos.PreprocessingStep data_augmentation_options = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_data_augmentation_options(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional bool sync_replicas = 3 [default = false];
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
          _Internal::set_has_sync_replicas(&has_bits);
          _impl_.sync_replicas_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional float keep_checkpoint_every_n_hours = 4 [default = 10000];
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 37)) {
          _Internal::set_has_keep_checkpoint_every_n_hours(&has_bits);
          _impl_.keep_checkpoint_every_n_hours_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // optional .object_detection.protos.Optimizer optimizer = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          ptr = ctx->ParseMessage(_internal_mutable_optimizer(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional float gradient_clipping_by_norm = 6 [default = 0];
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 53)) {
          _Internal::set_has_gradient_clipping_by_norm(&has_bits);
          _impl_.gradient_clipping_by_norm_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // optional string fine_tune_checkpoint = 7 [default = ""];
      case 7:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
          auto str = _internal_mutable_fine_tune_checkpoint();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          #ifndef NDEBUG
          ::_pbi::VerifyUTF8(str, "object_detection.protos.TrainConfig.fine_tune_checkpoint");
          #endif  // !NDEBUG
        } else
          goto handle_unusual;
        continue;
      // optional bool from_detection_checkpoint = 8 [default = false, deprecated = true];
      case 8:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) {
          _Internal::set_has_from_detection_checkpoint(&has_bits);
          _impl_.from_detection_checkpoint_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional uint32 num_steps = 9 [default = 0];
      case 9:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) {
          _Internal::set_has_num_steps(&has_bits);
          _impl_.num_steps_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional float startup_delay_steps = 10 [default = 15];
      case 10:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 85)) {
          _Internal::set_has_startup_delay_steps(&has_bits);
          _impl_.startup_delay_steps_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // optional float bias_grad_multiplier = 11 [default = 0];
      case 11:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 93)) {
          _Internal::set_has_bias_grad_multiplier(&has_bits);
          _impl_.bias_grad_multiplier_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      // repeated string freeze_variables = 12;
      case 12:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) {
          ptr -= 1;
          do {
            ptr += 1;
            auto str = _internal_add_freeze_variables();
            ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
            CHK_(ptr);
            #ifndef NDEBUG
            ::_pbi::VerifyUTF8(str, "object_detection.protos.TrainConfig.freeze_variables");
            #endif  // !NDEBUG
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<98>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional int32 replicas_to_aggregate = 13 [default = 1];
      case 13:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 104)) {
          _Internal::set_has_replicas_to_aggregate(&has_bits);
          _impl_.replicas_to_aggregate_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 batch_queue_capacity = 14 [default = 150, deprecated = true];
      case 14:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 112)) {
          _Internal::set_has_batch_queue_capacity(&has_bits);
          _impl_.batch_queue_capacity_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 num_batch_queue_threads = 15 [default = 8, deprecated = true];
      case 15:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 120)) {
          _Internal::set_has_num_batch_queue_threads(&has_bits);
          _impl_.num_batch_queue_threads_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 prefetch_queue_capacity = 16 [default = 5, deprecated = true];
      case 16:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 128)) {
          _Internal::set_has_prefetch_queue_capacity(&has_bits);
          _impl_.prefetch_queue_capacity_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool merge_multiple_label_boxes = 17 [default = false];
      case 17:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 136)) {
          _Internal::set_has_merge_multiple_label_boxes(&has_bits);
          _impl_.merge_multiple_label_boxes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool add_regularization_loss = 18 [default = true];
      case 18:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 144)) {
          _Internal::set_has_add_regularization_loss(&has_bits);
          _impl_.add_regularization_loss_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool load_all_detection_checkpoint_vars = 19 [default = false];
      case 19:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 152)) {
          _Internal::set_has_load_all_detection_checkpoint_vars(&has_bits);
          _impl_.load_all_detection_checkpoint_vars_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional int32 max_number_of_boxes = 20 [default = 100, deprecated = true];
      case 20:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 160)) {
          _Internal::set_has_max_number_of_boxes(&has_bits);
          _impl_.max_number_of_boxes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool unpad_groundtruth_tensors = 21 [default = true];
      case 21:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 168)) {
          _Internal::set_has_unpad_groundtruth_tensors(&has_bits);
          _impl_.unpad_groundtruth_tensors_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional string fine_tune_checkpoint_type = 22 [default = ""];
      case 22:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 178)) {
          auto str = _internal_mutable_fine_tune_checkpoint_type();
          ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(ptr);
          #ifndef NDEBUG
          ::_pbi::VerifyUTF8(str, "object_detection.protos.TrainConfig.fine_tune_checkpoint_type");
          #endif  // !NDEBUG
        } else
          goto handle_unusual;
        continue;
      // optional bool retain_original_images = 23 [default = false];
      case 23:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 184)) {
          _Internal::set_has_retain_original_images(&has_bits);
          _impl_.retain_original_images_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool use_multiclass_scores = 24 [default = false];
      case 24:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 192)) {
          _Internal::set_has_use_multiclass_scores(&has_bits);
          _impl_.use_multiclass_scores_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated string update_trainable_variables = 25;
      case 25:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 202)) {
          ptr -= 2;
          do {
            ptr += 2;
            auto str = _internal_add_update_trainable_variables();
            ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
            CHK_(ptr);
            #ifndef NDEBUG
            ::_pbi::VerifyUTF8(str, "object_detection.protos.TrainConfig.update_trainable_variables");
            #endif  // !NDEBUG
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<202>(ptr));
        } else
          goto handle_unusual;
        continue;
      // optional bool use_bfloat16 = 26 [default = false];
      case 26:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 208)) {
          _Internal::set_has_use_bfloat16(&has_bits);
          _impl_.use_bfloat16_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool summarize_gradients = 27 [default = false];
      case 27:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 216)) {
          _Internal::set_has_summarize_gradients(&has_bits);
          _impl_.summarize_gradients_ = ::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* TrainConfig::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.TrainConfig)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  // optional uint32 batch_size = 1 [default = 32];
  if (cached_has_bits & 0x00008000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_batch_size(), target);
  }

  // repeated .object_detection.protos.PreprocessingStep data_augmentation_options = 2;
  for (unsigned i = 0,
      n = static_cast<unsigned>(this->_internal_data_augmentation_options_size()); i < n; i++) {
    const auto& repfield = this->_internal_data_augmentation_options(i);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(2, repfield, repfield.GetCachedSize(), target, stream);
  }

  // optional bool sync_replicas = 3 [default = false];
  if (cached_has_bits & 0x00000040u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(3, this->_internal_sync_replicas(), target);
  }

  // optional float keep_checkpoint_every_n_hours = 4 [default = 10000];
  if (cached_has_bits & 0x00010000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(4, this->_internal_keep_checkpoint_every_n_hours(), target);
  }

  // optional .object_detection.protos.Optimizer optimizer = 5;
  if (cached_has_bits & 0x00000004u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(5, _Internal::optimizer(this),
        _Internal::optimizer(this).GetCachedSize(), target, stream);
  }

  // optional float gradient_clipping_by_norm = 6 [default = 0];
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(6, this->_internal_gradient_clipping_by_norm(), target);
  }

  // optional string fine_tune_checkpoint = 7 [default = ""];
  if (cached_has_bits & 0x00000001u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_fine_tune_checkpoint().data(), static_cast<int>(this->_internal_fine_tune_checkpoint().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "object_detection.protos.TrainConfig.fine_tune_checkpoint");
    target = stream->WriteStringMaybeAliased(
        7, this->_internal_fine_tune_checkpoint(), target);
  }

  // optional bool from_detection_checkpoint = 8 [default = false, deprecated = true];
  if (cached_has_bits & 0x00000080u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(8, this->_internal_from_detection_checkpoint(), target);
  }

  // optional uint32 num_steps = 9 [default = 0];
  if (cached_has_bits & 0x00000010u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteUInt32ToArray(9, this->_internal_num_steps(), target);
  }

  // optional float startup_delay_steps = 10 [default = 15];
  if (cached_has_bits & 0x00020000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(10, this->_internal_startup_delay_steps(), target);
  }

  // optional float bias_grad_multiplier = 11 [default = 0];
  if (cached_has_bits & 0x00000020u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(11, this->_internal_bias_grad_multiplier(), target);
  }

  // repeated string freeze_variables = 12;
  for (int i = 0, n = this->_internal_freeze_variables_size(); i < n; i++) {
    const auto& s = this->_internal_freeze_variables(i);
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      s.data(), static_cast<int>(s.length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "object_detection.protos.TrainConfig.freeze_variables");
    target = stream->WriteString(12, s, target);
  }

  // optional int32 replicas_to_aggregate = 13 [default = 1];
  if (cached_has_bits & 0x00040000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(13, this->_internal_replicas_to_aggregate(), target);
  }

  // optional int32 batch_queue_capacity = 14 [default = 150, deprecated = true];
  if (cached_has_bits & 0x00080000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(14, this->_internal_batch_queue_capacity(), target);
  }

  // optional int32 num_batch_queue_threads = 15 [default = 8, deprecated = true];
  if (cached_has_bits & 0x00100000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(15, this->_internal_num_batch_queue_threads(), target);
  }

  // optional int32 prefetch_queue_capacity = 16 [default = 5, deprecated = true];
  if (cached_has_bits & 0x00200000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(16, this->_internal_prefetch_queue_capacity(), target);
  }

  // optional bool merge_multiple_label_boxes = 17 [default = false];
  if (cached_has_bits & 0x00000200u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(17, this->_internal_merge_multiple_label_boxes(), target);
  }

  // optional bool add_regularization_loss = 18 [default = true];
  if (cached_has_bits & 0x00400000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(18, this->_internal_add_regularization_loss(), target);
  }

  // optional bool load_all_detection_checkpoint_vars = 19 [default = false];
  if (cached_has_bits & 0x00000100u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(19, this->_internal_load_all_detection_checkpoint_vars(), target);
  }

  // optional int32 max_number_of_boxes = 20 [default = 100, deprecated = true];
  if (cached_has_bits & 0x00004000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteInt32ToArray(20, this->_internal_max_number_of_boxes(), target);
  }

  // optional bool unpad_groundtruth_tensors = 21 [default = true];
  if (cached_has_bits & 0x00800000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(21, this->_internal_unpad_groundtruth_tensors(), target);
  }

  // optional string fine_tune_checkpoint_type = 22 [default = ""];
  if (cached_has_bits & 0x00000002u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_fine_tune_checkpoint_type().data(), static_cast<int>(this->_internal_fine_tune_checkpoint_type().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "object_detection.protos.TrainConfig.fine_tune_checkpoint_type");
    target = stream->WriteStringMaybeAliased(
        22, this->_internal_fine_tune_checkpoint_type(), target);
  }

  // optional bool retain_original_images = 23 [default = false];
  if (cached_has_bits & 0x00000800u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(23, this->_internal_retain_original_images(), target);
  }

  // optional bool use_multiclass_scores = 24 [default = false];
  if (cached_has_bits & 0x00000400u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(24, this->_internal_use_multiclass_scores(), target);
  }

  // repeated string update_trainable_variables = 25;
  for (int i = 0, n = this->_internal_update_trainable_variables_size(); i < n; i++) {
    const auto& s = this->_internal_update_trainable_variables(i);
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      s.data(), static_cast<int>(s.length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "object_detection.protos.TrainConfig.update_trainable_variables");
    target = stream->WriteString(25, s, target);
  }

  // optional bool use_bfloat16 = 26 [default = false];
  if (cached_has_bits & 0x00001000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(26, this->_internal_use_bfloat16(), target);
  }

  // optional bool summarize_gradients = 27 [default = false];
  if (cached_has_bits & 0x00002000u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(27, this->_internal_summarize_gradients(), 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.TrainConfig)
  return target;
}

size_t TrainConfig::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.TrainConfig)
  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.PreprocessingStep data_augmentation_options = 2;
  total_size += 1UL * this->_internal_data_augmentation_options_size();
  for (const auto& msg : this->_impl_.data_augmentation_options_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated string freeze_variables = 12;
  total_size += 1 *
      ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.freeze_variables_.size());
  for (int i = 0, n = _impl_.freeze_variables_.size(); i < n; i++) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
      _impl_.freeze_variables_.Get(i));
  }

  // repeated string update_trainable_variables = 25;
  total_size += 2 *
      ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.update_trainable_variables_.size());
  for (int i = 0, n = _impl_.update_trainable_variables_.size(); i < n; i++) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
      _impl_.update_trainable_variables_.Get(i));
  }

  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x000000ffu) {
    // optional string fine_tune_checkpoint = 7 [default = ""];
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_fine_tune_checkpoint());
    }

    // optional string fine_tune_checkpoint_type = 22 [default = ""];
    if (cached_has_bits & 0x00000002u) {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_fine_tune_checkpoint_type());
    }

    // optional .object_detection.protos.Optimizer optimizer = 5;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.optimizer_);
    }

    // optional float gradient_clipping_by_norm = 6 [default = 0];
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 + 4;
    }

    // optional uint32 num_steps = 9 [default = 0];
    if (cached_has_bits & 0x00000010u) {
      total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_num_steps());
    }

    // optional float bias_grad_multiplier = 11 [default = 0];
    if (cached_has_bits & 0x00000020u) {
      total_size += 1 + 4;
    }

    // optional bool sync_replicas = 3 [default = false];
    if (cached_has_bits & 0x00000040u) {
      total_size += 1 + 1;
    }

    // optional bool from_detection_checkpoint = 8 [default = false, deprecated = true];
    if (cached_has_bits & 0x00000080u) {
      total_size += 1 + 1;
    }

  }
  if (cached_has_bits & 0x0000ff00u) {
    // optional bool load_all_detection_checkpoint_vars = 19 [default = false];
    if (cached_has_bits & 0x00000100u) {
      total_size += 2 + 1;
    }

    // optional bool merge_multiple_label_boxes = 17 [default = false];
    if (cached_has_bits & 0x00000200u) {
      total_size += 2 + 1;
    }

    // optional bool use_multiclass_scores = 24 [default = false];
    if (cached_has_bits & 0x00000400u) {
      total_size += 2 + 1;
    }

    // optional bool retain_original_images = 23 [default = false];
    if (cached_has_bits & 0x00000800u) {
      total_size += 2 + 1;
    }

    // optional bool use_bfloat16 = 26 [default = false];
    if (cached_has_bits & 0x00001000u) {
      total_size += 2 + 1;
    }

    // optional bool summarize_gradients = 27 [default = false];
    if (cached_has_bits & 0x00002000u) {
      total_size += 2 + 1;
    }

    // optional int32 max_number_of_boxes = 20 [default = 100, deprecated = true];
    if (cached_has_bits & 0x00004000u) {
      total_size += 2 +
        ::_pbi::WireFormatLite::Int32Size(
          this->_internal_max_number_of_boxes());
    }

    // optional uint32 batch_size = 1 [default = 32];
    if (cached_has_bits & 0x00008000u) {
      total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_batch_size());
    }

  }
  if (cached_has_bits & 0x00ff0000u) {
    // optional float keep_checkpoint_every_n_hours = 4 [default = 10000];
    if (cached_has_bits & 0x00010000u) {
      total_size += 1 + 4;
    }

    // optional float startup_delay_steps = 10 [default = 15];
    if (cached_has_bits & 0x00020000u) {
      total_size += 1 + 4;
    }

    // optional int32 replicas_to_aggregate = 13 [default = 1];
    if (cached_has_bits & 0x00040000u) {
      total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_replicas_to_aggregate());
    }

    // optional int32 batch_queue_capacity = 14 [default = 150, deprecated = true];
    if (cached_has_bits & 0x00080000u) {
      total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_batch_queue_capacity());
    }

    // optional int32 num_batch_queue_threads = 15 [default = 8, deprecated = true];
    if (cached_has_bits & 0x00100000u) {
      total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_num_batch_queue_threads());
    }

    // optional int32 prefetch_queue_capacity = 16 [default = 5, deprecated = true];
    if (cached_has_bits & 0x00200000u) {
      total_size += 2 +
        ::_pbi::WireFormatLite::Int32Size(
          this->_internal_prefetch_queue_capacity());
    }

    // optional bool add_regularization_loss = 18 [default = true];
    if (cached_has_bits & 0x00400000u) {
      total_size += 2 + 1;
    }

    // optional bool unpad_groundtruth_tensors = 21 [default = true];
    if (cached_has_bits & 0x00800000u) {
      total_size += 2 + 1;
    }

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

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


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

  _this->_impl_.data_augmentation_options_.MergeFrom(from._impl_.data_augmentation_options_);
  _this->_impl_.freeze_variables_.MergeFrom(from._impl_.freeze_variables_);
  _this->_impl_.update_trainable_variables_.MergeFrom(from._impl_.update_trainable_variables_);
  cached_has_bits = from._impl_._has_bits_[0];
  if (cached_has_bits & 0x000000ffu) {
    if (cached_has_bits & 0x00000001u) {
      _this->_internal_set_fine_tune_checkpoint(from._internal_fine_tune_checkpoint());
    }
    if (cached_has_bits & 0x00000002u) {
      _this->_internal_set_fine_tune_checkpoint_type(from._internal_fine_tune_checkpoint_type());
    }
    if (cached_has_bits & 0x00000004u) {
      _this->_internal_mutable_optimizer()->::object_detection::protos::Optimizer::MergeFrom(
          from._internal_optimizer());
    }
    if (cached_has_bits & 0x00000008u) {
      _this->_impl_.gradient_clipping_by_norm_ = from._impl_.gradient_clipping_by_norm_;
    }
    if (cached_has_bits & 0x00000010u) {
      _this->_impl_.num_steps_ = from._impl_.num_steps_;
    }
    if (cached_has_bits & 0x00000020u) {
      _this->_impl_.bias_grad_multiplier_ = from._impl_.bias_grad_multiplier_;
    }
    if (cached_has_bits & 0x00000040u) {
      _this->_impl_.sync_replicas_ = from._impl_.sync_replicas_;
    }
    if (cached_has_bits & 0x00000080u) {
      _this->_impl_.from_detection_checkpoint_ = from._impl_.from_detection_checkpoint_;
    }
    _this->_impl_._has_bits_[0] |= cached_has_bits;
  }
  if (cached_has_bits & 0x0000ff00u) {
    if (cached_has_bits & 0x00000100u) {
      _this->_impl_.load_all_detection_checkpoint_vars_ = from._impl_.load_all_detection_checkpoint_vars_;
    }
    if (cached_has_bits & 0x00000200u) {
      _this->_impl_.merge_multiple_label_boxes_ = from._impl_.merge_multiple_label_boxes_;
    }
    if (cached_has_bits & 0x00000400u) {
      _this->_impl_.use_multiclass_scores_ = from._impl_.use_multiclass_scores_;
    }
    if (cached_has_bits & 0x00000800u) {
      _this->_impl_.retain_original_images_ = from._impl_.retain_original_images_;
    }
    if (cached_has_bits & 0x00001000u) {
      _this->_impl_.use_bfloat16_ = from._impl_.use_bfloat16_;
    }
    if (cached_has_bits & 0x00002000u) {
      _this->_impl_.summarize_gradients_ = from._impl_.summarize_gradients_;
    }
    if (cached_has_bits & 0x00004000u) {
      _this->_impl_.max_number_of_boxes_ = from._impl_.max_number_of_boxes_;
    }
    if (cached_has_bits & 0x00008000u) {
      _this->_impl_.batch_size_ = from._impl_.batch_size_;
    }
    _this->_impl_._has_bits_[0] |= cached_has_bits;
  }
  if (cached_has_bits & 0x00ff0000u) {
    if (cached_has_bits & 0x00010000u) {
      _this->_impl_.keep_checkpoint_every_n_hours_ = from._impl_.keep_checkpoint_every_n_hours_;
    }
    if (cached_has_bits & 0x00020000u) {
      _this->_impl_.startup_delay_steps_ = from._impl_.startup_delay_steps_;
    }
    if (cached_has_bits & 0x00040000u) {
      _this->_impl_.replicas_to_aggregate_ = from._impl_.replicas_to_aggregate_;
    }
    if (cached_has_bits & 0x00080000u) {
      _this->_impl_.batch_queue_capacity_ = from._impl_.batch_queue_capacity_;
    }
    if (cached_has_bits & 0x00100000u) {
      _this->_impl_.num_batch_queue_threads_ = from._impl_.num_batch_queue_threads_;
    }
    if (cached_has_bits & 0x00200000u) {
      _this->_impl_.prefetch_queue_capacity_ = from._impl_.prefetch_queue_capacity_;
    }
    if (cached_has_bits & 0x00400000u) {
      _this->_impl_.add_regularization_loss_ = from._impl_.add_regularization_loss_;
    }
    if (cached_has_bits & 0x00800000u) {
      _this->_impl_.unpad_groundtruth_tensors_ = from._impl_.unpad_groundtruth_tensors_;
    }
    _this->_impl_._has_bits_[0] |= cached_has_bits;
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

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

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

void TrainConfig::InternalSwap(TrainConfig* other) {
  using std::swap;
  auto* lhs_arena = GetArenaForAllocation();
  auto* rhs_arena = other->GetArenaForAllocation();
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  _impl_.data_augmentation_options_.InternalSwap(&other->_impl_.data_augmentation_options_);
  _impl_.freeze_variables_.InternalSwap(&other->_impl_.freeze_variables_);
  _impl_.update_trainable_variables_.InternalSwap(&other->_impl_.update_trainable_variables_);
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.fine_tune_checkpoint_, lhs_arena,
      &other->_impl_.fine_tune_checkpoint_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
      &_impl_.fine_tune_checkpoint_type_, lhs_arena,
      &other->_impl_.fine_tune_checkpoint_type_, rhs_arena
  );
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(TrainConfig, _impl_.summarize_gradients_)
      + sizeof(TrainConfig::_impl_.summarize_gradients_)
      - PROTOBUF_FIELD_OFFSET(TrainConfig, _impl_.optimizer_)>(
          reinterpret_cast<char*>(&_impl_.optimizer_),
          reinterpret_cast<char*>(&other->_impl_.optimizer_));
  swap(_impl_.max_number_of_boxes_, other->_impl_.max_number_of_boxes_);
  swap(_impl_.batch_size_, other->_impl_.batch_size_);
  swap(_impl_.keep_checkpoint_every_n_hours_, other->_impl_.keep_checkpoint_every_n_hours_);
  swap(_impl_.startup_delay_steps_, other->_impl_.startup_delay_steps_);
  swap(_impl_.replicas_to_aggregate_, other->_impl_.replicas_to_aggregate_);
  swap(_impl_.batch_queue_capacity_, other->_impl_.batch_queue_capacity_);
  swap(_impl_.num_batch_queue_threads_, other->_impl_.num_batch_queue_threads_);
  swap(_impl_.prefetch_queue_capacity_, other->_impl_.prefetch_queue_capacity_);
  swap(_impl_.add_regularization_loss_, other->_impl_.add_regularization_loss_);
  swap(_impl_.unpad_groundtruth_tensors_, other->_impl_.unpad_groundtruth_tensors_);
}

::PROTOBUF_NAMESPACE_ID::Metadata TrainConfig::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2ftrain_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2ftrain_2eproto[0]);
}

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

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