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

#include "NearestNeighbors.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/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace CoreML {
namespace Specification {
constexpr KNearestNeighborsClassifier::KNearestNeighborsClassifier(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : nearestneighborsindex_(nullptr)
  , numberofneighbors_(nullptr)
  , _oneof_case_{}{}
struct KNearestNeighborsClassifierDefaultTypeInternal {
  constexpr KNearestNeighborsClassifierDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~KNearestNeighborsClassifierDefaultTypeInternal() {}
  union {
    KNearestNeighborsClassifier _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT KNearestNeighborsClassifierDefaultTypeInternal _KNearestNeighborsClassifier_default_instance_;
constexpr NearestNeighborsIndex::NearestNeighborsIndex(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : floatsamples_()
  , numberofdimensions_(0)
  , _oneof_case_{}{}
struct NearestNeighborsIndexDefaultTypeInternal {
  constexpr NearestNeighborsIndexDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~NearestNeighborsIndexDefaultTypeInternal() {}
  union {
    NearestNeighborsIndex _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT NearestNeighborsIndexDefaultTypeInternal _NearestNeighborsIndex_default_instance_;
constexpr UniformWeighting::UniformWeighting(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){}
struct UniformWeightingDefaultTypeInternal {
  constexpr UniformWeightingDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~UniformWeightingDefaultTypeInternal() {}
  union {
    UniformWeighting _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT UniformWeightingDefaultTypeInternal _UniformWeighting_default_instance_;
constexpr InverseDistanceWeighting::InverseDistanceWeighting(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){}
struct InverseDistanceWeightingDefaultTypeInternal {
  constexpr InverseDistanceWeightingDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~InverseDistanceWeightingDefaultTypeInternal() {}
  union {
    InverseDistanceWeighting _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT InverseDistanceWeightingDefaultTypeInternal _InverseDistanceWeighting_default_instance_;
constexpr LinearIndex::LinearIndex(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){}
struct LinearIndexDefaultTypeInternal {
  constexpr LinearIndexDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~LinearIndexDefaultTypeInternal() {}
  union {
    LinearIndex _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LinearIndexDefaultTypeInternal _LinearIndex_default_instance_;
constexpr SingleKdTreeIndex::SingleKdTreeIndex(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : leafsize_(0){}
struct SingleKdTreeIndexDefaultTypeInternal {
  constexpr SingleKdTreeIndexDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~SingleKdTreeIndexDefaultTypeInternal() {}
  union {
    SingleKdTreeIndex _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SingleKdTreeIndexDefaultTypeInternal _SingleKdTreeIndex_default_instance_;
constexpr SquaredEuclideanDistance::SquaredEuclideanDistance(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){}
struct SquaredEuclideanDistanceDefaultTypeInternal {
  constexpr SquaredEuclideanDistanceDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~SquaredEuclideanDistanceDefaultTypeInternal() {}
  union {
    SquaredEuclideanDistance _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SquaredEuclideanDistanceDefaultTypeInternal _SquaredEuclideanDistance_default_instance_;
}  // namespace Specification
}  // namespace CoreML
namespace CoreML {
namespace Specification {

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

class KNearestNeighborsClassifier::_Internal {
 public:
  static const ::CoreML::Specification::NearestNeighborsIndex& nearestneighborsindex(const KNearestNeighborsClassifier* msg);
  static const ::CoreML::Specification::Int64Parameter& numberofneighbors(const KNearestNeighborsClassifier* msg);
  static const ::CoreML::Specification::StringVector& stringclasslabels(const KNearestNeighborsClassifier* msg);
  static const ::CoreML::Specification::Int64Vector& int64classlabels(const KNearestNeighborsClassifier* msg);
  static const ::CoreML::Specification::UniformWeighting& uniformweighting(const KNearestNeighborsClassifier* msg);
  static const ::CoreML::Specification::InverseDistanceWeighting& inversedistanceweighting(const KNearestNeighborsClassifier* msg);
};

const ::CoreML::Specification::NearestNeighborsIndex&
KNearestNeighborsClassifier::_Internal::nearestneighborsindex(const KNearestNeighborsClassifier* msg) {
  return *msg->nearestneighborsindex_;
}
const ::CoreML::Specification::Int64Parameter&
KNearestNeighborsClassifier::_Internal::numberofneighbors(const KNearestNeighborsClassifier* msg) {
  return *msg->numberofneighbors_;
}
const ::CoreML::Specification::StringVector&
KNearestNeighborsClassifier::_Internal::stringclasslabels(const KNearestNeighborsClassifier* msg) {
  return *msg->ClassLabels_.stringclasslabels_;
}
const ::CoreML::Specification::Int64Vector&
KNearestNeighborsClassifier::_Internal::int64classlabels(const KNearestNeighborsClassifier* msg) {
  return *msg->ClassLabels_.int64classlabels_;
}
const ::CoreML::Specification::UniformWeighting&
KNearestNeighborsClassifier::_Internal::uniformweighting(const KNearestNeighborsClassifier* msg) {
  return *msg->WeightingScheme_.uniformweighting_;
}
const ::CoreML::Specification::InverseDistanceWeighting&
KNearestNeighborsClassifier::_Internal::inversedistanceweighting(const KNearestNeighborsClassifier* msg) {
  return *msg->WeightingScheme_.inversedistanceweighting_;
}
void KNearestNeighborsClassifier::clear_numberofneighbors() {
  if (GetArenaForAllocation() == nullptr && numberofneighbors_ != nullptr) {
    delete numberofneighbors_;
  }
  numberofneighbors_ = nullptr;
}
void KNearestNeighborsClassifier::set_allocated_stringclasslabels(::CoreML::Specification::StringVector* stringclasslabels) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_ClassLabels();
  if (stringclasslabels) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
        ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
            ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
                reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(stringclasslabels));
    if (message_arena != submessage_arena) {
      stringclasslabels = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, stringclasslabels, submessage_arena);
    }
    set_has_stringclasslabels();
    ClassLabels_.stringclasslabels_ = stringclasslabels;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.KNearestNeighborsClassifier.stringClassLabels)
}
void KNearestNeighborsClassifier::clear_stringclasslabels() {
  if (_internal_has_stringclasslabels()) {
    if (GetArenaForAllocation() == nullptr) {
      delete ClassLabels_.stringclasslabels_;
    }
    clear_has_ClassLabels();
  }
}
void KNearestNeighborsClassifier::set_allocated_int64classlabels(::CoreML::Specification::Int64Vector* int64classlabels) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_ClassLabels();
  if (int64classlabels) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
        ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
            ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
                reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(int64classlabels));
    if (message_arena != submessage_arena) {
      int64classlabels = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, int64classlabels, submessage_arena);
    }
    set_has_int64classlabels();
    ClassLabels_.int64classlabels_ = int64classlabels;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.KNearestNeighborsClassifier.int64ClassLabels)
}
void KNearestNeighborsClassifier::clear_int64classlabels() {
  if (_internal_has_int64classlabels()) {
    if (GetArenaForAllocation() == nullptr) {
      delete ClassLabels_.int64classlabels_;
    }
    clear_has_ClassLabels();
  }
}
void KNearestNeighborsClassifier::set_allocated_uniformweighting(::CoreML::Specification::UniformWeighting* uniformweighting) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_WeightingScheme();
  if (uniformweighting) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::CoreML::Specification::UniformWeighting>::GetOwningArena(uniformweighting);
    if (message_arena != submessage_arena) {
      uniformweighting = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, uniformweighting, submessage_arena);
    }
    set_has_uniformweighting();
    WeightingScheme_.uniformweighting_ = uniformweighting;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.KNearestNeighborsClassifier.uniformWeighting)
}
void KNearestNeighborsClassifier::set_allocated_inversedistanceweighting(::CoreML::Specification::InverseDistanceWeighting* inversedistanceweighting) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_WeightingScheme();
  if (inversedistanceweighting) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::CoreML::Specification::InverseDistanceWeighting>::GetOwningArena(inversedistanceweighting);
    if (message_arena != submessage_arena) {
      inversedistanceweighting = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, inversedistanceweighting, submessage_arena);
    }
    set_has_inversedistanceweighting();
    WeightingScheme_.inversedistanceweighting_ = inversedistanceweighting;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.KNearestNeighborsClassifier.inverseDistanceWeighting)
}
KNearestNeighborsClassifier::KNearestNeighborsClassifier(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.KNearestNeighborsClassifier)
}
KNearestNeighborsClassifier::KNearestNeighborsClassifier(const KNearestNeighborsClassifier& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  if (from._internal_has_nearestneighborsindex()) {
    nearestneighborsindex_ = new ::CoreML::Specification::NearestNeighborsIndex(*from.nearestneighborsindex_);
  } else {
    nearestneighborsindex_ = nullptr;
  }
  if (from._internal_has_numberofneighbors()) {
    numberofneighbors_ = new ::CoreML::Specification::Int64Parameter(*from.numberofneighbors_);
  } else {
    numberofneighbors_ = nullptr;
  }
  clear_has_ClassLabels();
  switch (from.ClassLabels_case()) {
    case kStringClassLabels: {
      _internal_mutable_stringclasslabels()->::CoreML::Specification::StringVector::MergeFrom(from._internal_stringclasslabels());
      break;
    }
    case kInt64ClassLabels: {
      _internal_mutable_int64classlabels()->::CoreML::Specification::Int64Vector::MergeFrom(from._internal_int64classlabels());
      break;
    }
    case CLASSLABELS_NOT_SET: {
      break;
    }
  }
  clear_has_DefaultClassLabel();
  switch (from.DefaultClassLabel_case()) {
    case kDefaultStringLabel: {
      _internal_set_defaultstringlabel(from._internal_defaultstringlabel());
      break;
    }
    case kDefaultInt64Label: {
      _internal_set_defaultint64label(from._internal_defaultint64label());
      break;
    }
    case DEFAULTCLASSLABEL_NOT_SET: {
      break;
    }
  }
  clear_has_WeightingScheme();
  switch (from.WeightingScheme_case()) {
    case kUniformWeighting: {
      _internal_mutable_uniformweighting()->::CoreML::Specification::UniformWeighting::MergeFrom(from._internal_uniformweighting());
      break;
    }
    case kInverseDistanceWeighting: {
      _internal_mutable_inversedistanceweighting()->::CoreML::Specification::InverseDistanceWeighting::MergeFrom(from._internal_inversedistanceweighting());
      break;
    }
    case WEIGHTINGSCHEME_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.KNearestNeighborsClassifier)
}

inline void KNearestNeighborsClassifier::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&nearestneighborsindex_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&numberofneighbors_) -
    reinterpret_cast<char*>(&nearestneighborsindex_)) + sizeof(numberofneighbors_));
clear_has_ClassLabels();
clear_has_DefaultClassLabel();
clear_has_WeightingScheme();
}

KNearestNeighborsClassifier::~KNearestNeighborsClassifier() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.KNearestNeighborsClassifier)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void KNearestNeighborsClassifier::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (this != internal_default_instance()) delete nearestneighborsindex_;
  if (this != internal_default_instance()) delete numberofneighbors_;
  if (has_ClassLabels()) {
    clear_ClassLabels();
  }
  if (has_DefaultClassLabel()) {
    clear_DefaultClassLabel();
  }
  if (has_WeightingScheme()) {
    clear_WeightingScheme();
  }
}

void KNearestNeighborsClassifier::ArenaDtor(void* object) {
  KNearestNeighborsClassifier* _this = reinterpret_cast< KNearestNeighborsClassifier* >(object);
  (void)_this;
}
void KNearestNeighborsClassifier::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void KNearestNeighborsClassifier::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void KNearestNeighborsClassifier::clear_ClassLabels() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.KNearestNeighborsClassifier)
  switch (ClassLabels_case()) {
    case kStringClassLabels: {
      if (GetArenaForAllocation() == nullptr) {
        delete ClassLabels_.stringclasslabels_;
      }
      break;
    }
    case kInt64ClassLabels: {
      if (GetArenaForAllocation() == nullptr) {
        delete ClassLabels_.int64classlabels_;
      }
      break;
    }
    case CLASSLABELS_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = CLASSLABELS_NOT_SET;
}

void KNearestNeighborsClassifier::clear_DefaultClassLabel() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.KNearestNeighborsClassifier)
  switch (DefaultClassLabel_case()) {
    case kDefaultStringLabel: {
      DefaultClassLabel_.defaultstringlabel_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
      break;
    }
    case kDefaultInt64Label: {
      // No need to clear
      break;
    }
    case DEFAULTCLASSLABEL_NOT_SET: {
      break;
    }
  }
  _oneof_case_[1] = DEFAULTCLASSLABEL_NOT_SET;
}

void KNearestNeighborsClassifier::clear_WeightingScheme() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.KNearestNeighborsClassifier)
  switch (WeightingScheme_case()) {
    case kUniformWeighting: {
      if (GetArenaForAllocation() == nullptr) {
        delete WeightingScheme_.uniformweighting_;
      }
      break;
    }
    case kInverseDistanceWeighting: {
      if (GetArenaForAllocation() == nullptr) {
        delete WeightingScheme_.inversedistanceweighting_;
      }
      break;
    }
    case WEIGHTINGSCHEME_NOT_SET: {
      break;
    }
  }
  _oneof_case_[2] = WEIGHTINGSCHEME_NOT_SET;
}


void KNearestNeighborsClassifier::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.KNearestNeighborsClassifier)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  if (GetArenaForAllocation() == nullptr && nearestneighborsindex_ != nullptr) {
    delete nearestneighborsindex_;
  }
  nearestneighborsindex_ = nullptr;
  if (GetArenaForAllocation() == nullptr && numberofneighbors_ != nullptr) {
    delete numberofneighbors_;
  }
  numberofneighbors_ = nullptr;
  clear_ClassLabels();
  clear_DefaultClassLabel();
  clear_WeightingScheme();
  _internal_metadata_.Clear<std::string>();
}

const char* KNearestNeighborsClassifier::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .CoreML.Specification.NearestNeighborsIndex nearestNeighborsIndex = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_nearestneighborsindex(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.Int64Parameter numberOfNeighbors = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_numberofneighbors(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.StringVector stringClassLabels = 100;
      case 100:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_stringclasslabels(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.Int64Vector int64ClassLabels = 101;
      case 101:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
          ptr = ctx->ParseMessage(_internal_mutable_int64classlabels(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // string defaultStringLabel = 110;
      case 110:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 114)) {
          auto str = _internal_mutable_defaultstringlabel();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, nullptr));
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // int64 defaultInt64Label = 111;
      case 111:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 120)) {
          _internal_set_defaultint64label(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.UniformWeighting uniformWeighting = 200;
      case 200:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
          ptr = ctx->ParseMessage(_internal_mutable_uniformweighting(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.InverseDistanceWeighting inverseDistanceWeighting = 210;
      case 210:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 146)) {
          ptr = ctx->ParseMessage(_internal_mutable_inversedistanceweighting(), 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<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  // .CoreML.Specification.NearestNeighborsIndex nearestNeighborsIndex = 1;
  if (this->_internal_has_nearestneighborsindex()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        1, _Internal::nearestneighborsindex(this), target, stream);
  }

  // .CoreML.Specification.Int64Parameter numberOfNeighbors = 3;
  if (this->_internal_has_numberofneighbors()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        3, _Internal::numberofneighbors(this), target, stream);
  }

  // .CoreML.Specification.StringVector stringClassLabels = 100;
  if (_internal_has_stringclasslabels()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        100, _Internal::stringclasslabels(this), target, stream);
  }

  // .CoreML.Specification.Int64Vector int64ClassLabels = 101;
  if (_internal_has_int64classlabels()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        101, _Internal::int64classlabels(this), target, stream);
  }

  // string defaultStringLabel = 110;
  if (_internal_has_defaultstringlabel()) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_defaultstringlabel().data(), static_cast<int>(this->_internal_defaultstringlabel().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "CoreML.Specification.KNearestNeighborsClassifier.defaultStringLabel");
    target = stream->WriteStringMaybeAliased(
        110, this->_internal_defaultstringlabel(), target);
  }

  // int64 defaultInt64Label = 111;
  if (_internal_has_defaultint64label()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(111, this->_internal_defaultint64label(), target);
  }

  // .CoreML.Specification.UniformWeighting uniformWeighting = 200;
  if (_internal_has_uniformweighting()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        200, _Internal::uniformweighting(this), target, stream);
  }

  // .CoreML.Specification.InverseDistanceWeighting inverseDistanceWeighting = 210;
  if (_internal_has_inversedistanceweighting()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        210, _Internal::inversedistanceweighting(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.KNearestNeighborsClassifier)
  return target;
}

size_t KNearestNeighborsClassifier::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.KNearestNeighborsClassifier)
  size_t total_size = 0;

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

  // .CoreML.Specification.NearestNeighborsIndex nearestNeighborsIndex = 1;
  if (this->_internal_has_nearestneighborsindex()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *nearestneighborsindex_);
  }

  // .CoreML.Specification.Int64Parameter numberOfNeighbors = 3;
  if (this->_internal_has_numberofneighbors()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *numberofneighbors_);
  }

  switch (ClassLabels_case()) {
    // .CoreML.Specification.StringVector stringClassLabels = 100;
    case kStringClassLabels: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *ClassLabels_.stringclasslabels_);
      break;
    }
    // .CoreML.Specification.Int64Vector int64ClassLabels = 101;
    case kInt64ClassLabels: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *ClassLabels_.int64classlabels_);
      break;
    }
    case CLASSLABELS_NOT_SET: {
      break;
    }
  }
  switch (DefaultClassLabel_case()) {
    // string defaultStringLabel = 110;
    case kDefaultStringLabel: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_defaultstringlabel());
      break;
    }
    // int64 defaultInt64Label = 111;
    case kDefaultInt64Label: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size(
          this->_internal_defaultint64label());
      break;
    }
    case DEFAULTCLASSLABEL_NOT_SET: {
      break;
    }
  }
  switch (WeightingScheme_case()) {
    // .CoreML.Specification.UniformWeighting uniformWeighting = 200;
    case kUniformWeighting: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *WeightingScheme_.uniformweighting_);
      break;
    }
    // .CoreML.Specification.InverseDistanceWeighting inverseDistanceWeighting = 210;
    case kInverseDistanceWeighting: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *WeightingScheme_.inversedistanceweighting_);
      break;
    }
    case WEIGHTINGSCHEME_NOT_SET: {
      break;
    }
  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void KNearestNeighborsClassifier::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const KNearestNeighborsClassifier*>(
      &from));
}

void KNearestNeighborsClassifier::MergeFrom(const KNearestNeighborsClassifier& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.KNearestNeighborsClassifier)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (from._internal_has_nearestneighborsindex()) {
    _internal_mutable_nearestneighborsindex()->::CoreML::Specification::NearestNeighborsIndex::MergeFrom(from._internal_nearestneighborsindex());
  }
  if (from._internal_has_numberofneighbors()) {
    _internal_mutable_numberofneighbors()->::CoreML::Specification::Int64Parameter::MergeFrom(from._internal_numberofneighbors());
  }
  switch (from.ClassLabels_case()) {
    case kStringClassLabels: {
      _internal_mutable_stringclasslabels()->::CoreML::Specification::StringVector::MergeFrom(from._internal_stringclasslabels());
      break;
    }
    case kInt64ClassLabels: {
      _internal_mutable_int64classlabels()->::CoreML::Specification::Int64Vector::MergeFrom(from._internal_int64classlabels());
      break;
    }
    case CLASSLABELS_NOT_SET: {
      break;
    }
  }
  switch (from.DefaultClassLabel_case()) {
    case kDefaultStringLabel: {
      _internal_set_defaultstringlabel(from._internal_defaultstringlabel());
      break;
    }
    case kDefaultInt64Label: {
      _internal_set_defaultint64label(from._internal_defaultint64label());
      break;
    }
    case DEFAULTCLASSLABEL_NOT_SET: {
      break;
    }
  }
  switch (from.WeightingScheme_case()) {
    case kUniformWeighting: {
      _internal_mutable_uniformweighting()->::CoreML::Specification::UniformWeighting::MergeFrom(from._internal_uniformweighting());
      break;
    }
    case kInverseDistanceWeighting: {
      _internal_mutable_inversedistanceweighting()->::CoreML::Specification::InverseDistanceWeighting::MergeFrom(from._internal_inversedistanceweighting());
      break;
    }
    case WEIGHTINGSCHEME_NOT_SET: {
      break;
    }
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void KNearestNeighborsClassifier::InternalSwap(KNearestNeighborsClassifier* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(KNearestNeighborsClassifier, numberofneighbors_)
      + sizeof(KNearestNeighborsClassifier::numberofneighbors_)
      - PROTOBUF_FIELD_OFFSET(KNearestNeighborsClassifier, nearestneighborsindex_)>(
          reinterpret_cast<char*>(&nearestneighborsindex_),
          reinterpret_cast<char*>(&other->nearestneighborsindex_));
  swap(ClassLabels_, other->ClassLabels_);
  swap(DefaultClassLabel_, other->DefaultClassLabel_);
  swap(WeightingScheme_, other->WeightingScheme_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
  swap(_oneof_case_[1], other->_oneof_case_[1]);
  swap(_oneof_case_[2], other->_oneof_case_[2]);
}

std::string KNearestNeighborsClassifier::GetTypeName() const {
  return "CoreML.Specification.KNearestNeighborsClassifier";
}


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

class NearestNeighborsIndex::_Internal {
 public:
  static const ::CoreML::Specification::LinearIndex& linearindex(const NearestNeighborsIndex* msg);
  static const ::CoreML::Specification::SingleKdTreeIndex& singlekdtreeindex(const NearestNeighborsIndex* msg);
  static const ::CoreML::Specification::SquaredEuclideanDistance& squaredeuclideandistance(const NearestNeighborsIndex* msg);
};

const ::CoreML::Specification::LinearIndex&
NearestNeighborsIndex::_Internal::linearindex(const NearestNeighborsIndex* msg) {
  return *msg->IndexType_.linearindex_;
}
const ::CoreML::Specification::SingleKdTreeIndex&
NearestNeighborsIndex::_Internal::singlekdtreeindex(const NearestNeighborsIndex* msg) {
  return *msg->IndexType_.singlekdtreeindex_;
}
const ::CoreML::Specification::SquaredEuclideanDistance&
NearestNeighborsIndex::_Internal::squaredeuclideandistance(const NearestNeighborsIndex* msg) {
  return *msg->DistanceFunction_.squaredeuclideandistance_;
}
void NearestNeighborsIndex::clear_floatsamples() {
  floatsamples_.Clear();
}
void NearestNeighborsIndex::set_allocated_linearindex(::CoreML::Specification::LinearIndex* linearindex) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_IndexType();
  if (linearindex) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::CoreML::Specification::LinearIndex>::GetOwningArena(linearindex);
    if (message_arena != submessage_arena) {
      linearindex = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, linearindex, submessage_arena);
    }
    set_has_linearindex();
    IndexType_.linearindex_ = linearindex;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.NearestNeighborsIndex.linearIndex)
}
void NearestNeighborsIndex::set_allocated_singlekdtreeindex(::CoreML::Specification::SingleKdTreeIndex* singlekdtreeindex) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_IndexType();
  if (singlekdtreeindex) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::CoreML::Specification::SingleKdTreeIndex>::GetOwningArena(singlekdtreeindex);
    if (message_arena != submessage_arena) {
      singlekdtreeindex = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, singlekdtreeindex, submessage_arena);
    }
    set_has_singlekdtreeindex();
    IndexType_.singlekdtreeindex_ = singlekdtreeindex;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.NearestNeighborsIndex.singleKdTreeIndex)
}
void NearestNeighborsIndex::set_allocated_squaredeuclideandistance(::CoreML::Specification::SquaredEuclideanDistance* squaredeuclideandistance) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_DistanceFunction();
  if (squaredeuclideandistance) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::CoreML::Specification::SquaredEuclideanDistance>::GetOwningArena(squaredeuclideandistance);
    if (message_arena != submessage_arena) {
      squaredeuclideandistance = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, squaredeuclideandistance, submessage_arena);
    }
    set_has_squaredeuclideandistance();
    DistanceFunction_.squaredeuclideandistance_ = squaredeuclideandistance;
  }
  // @@protoc_insertion_point(field_set_allocated:CoreML.Specification.NearestNeighborsIndex.squaredEuclideanDistance)
}
NearestNeighborsIndex::NearestNeighborsIndex(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  floatsamples_(arena) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.NearestNeighborsIndex)
}
NearestNeighborsIndex::NearestNeighborsIndex(const NearestNeighborsIndex& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      floatsamples_(from.floatsamples_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  numberofdimensions_ = from.numberofdimensions_;
  clear_has_IndexType();
  switch (from.IndexType_case()) {
    case kLinearIndex: {
      _internal_mutable_linearindex()->::CoreML::Specification::LinearIndex::MergeFrom(from._internal_linearindex());
      break;
    }
    case kSingleKdTreeIndex: {
      _internal_mutable_singlekdtreeindex()->::CoreML::Specification::SingleKdTreeIndex::MergeFrom(from._internal_singlekdtreeindex());
      break;
    }
    case INDEXTYPE_NOT_SET: {
      break;
    }
  }
  clear_has_DistanceFunction();
  switch (from.DistanceFunction_case()) {
    case kSquaredEuclideanDistance: {
      _internal_mutable_squaredeuclideandistance()->::CoreML::Specification::SquaredEuclideanDistance::MergeFrom(from._internal_squaredeuclideandistance());
      break;
    }
    case DISTANCEFUNCTION_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.NearestNeighborsIndex)
}

inline void NearestNeighborsIndex::SharedCtor() {
numberofdimensions_ = 0;
clear_has_IndexType();
clear_has_DistanceFunction();
}

NearestNeighborsIndex::~NearestNeighborsIndex() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.NearestNeighborsIndex)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void NearestNeighborsIndex::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (has_IndexType()) {
    clear_IndexType();
  }
  if (has_DistanceFunction()) {
    clear_DistanceFunction();
  }
}

void NearestNeighborsIndex::ArenaDtor(void* object) {
  NearestNeighborsIndex* _this = reinterpret_cast< NearestNeighborsIndex* >(object);
  (void)_this;
}
void NearestNeighborsIndex::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void NearestNeighborsIndex::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void NearestNeighborsIndex::clear_IndexType() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.NearestNeighborsIndex)
  switch (IndexType_case()) {
    case kLinearIndex: {
      if (GetArenaForAllocation() == nullptr) {
        delete IndexType_.linearindex_;
      }
      break;
    }
    case kSingleKdTreeIndex: {
      if (GetArenaForAllocation() == nullptr) {
        delete IndexType_.singlekdtreeindex_;
      }
      break;
    }
    case INDEXTYPE_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = INDEXTYPE_NOT_SET;
}

void NearestNeighborsIndex::clear_DistanceFunction() {
// @@protoc_insertion_point(one_of_clear_start:CoreML.Specification.NearestNeighborsIndex)
  switch (DistanceFunction_case()) {
    case kSquaredEuclideanDistance: {
      if (GetArenaForAllocation() == nullptr) {
        delete DistanceFunction_.squaredeuclideandistance_;
      }
      break;
    }
    case DISTANCEFUNCTION_NOT_SET: {
      break;
    }
  }
  _oneof_case_[1] = DISTANCEFUNCTION_NOT_SET;
}


void NearestNeighborsIndex::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.NearestNeighborsIndex)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  floatsamples_.Clear();
  numberofdimensions_ = 0;
  clear_IndexType();
  clear_DistanceFunction();
  _internal_metadata_.Clear<std::string>();
}

const char* NearestNeighborsIndex::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // int32 numberOfDimensions = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          numberofdimensions_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // repeated .CoreML.Specification.FloatVector floatSamples = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_floatsamples(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.LinearIndex linearIndex = 100;
      case 100:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_linearindex(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.SingleKdTreeIndex singleKdTreeIndex = 110;
      case 110:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 114)) {
          ptr = ctx->ParseMessage(_internal_mutable_singlekdtreeindex(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .CoreML.Specification.SquaredEuclideanDistance squaredEuclideanDistance = 200;
      case 200:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
          ptr = ctx->ParseMessage(_internal_mutable_squaredeuclideandistance(), 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<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  // int32 numberOfDimensions = 1;
  if (this->_internal_numberofdimensions() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_numberofdimensions(), target);
  }

  // repeated .CoreML.Specification.FloatVector floatSamples = 2;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_floatsamples_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, this->_internal_floatsamples(i), target, stream);
  }

  // .CoreML.Specification.LinearIndex linearIndex = 100;
  if (_internal_has_linearindex()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        100, _Internal::linearindex(this), target, stream);
  }

  // .CoreML.Specification.SingleKdTreeIndex singleKdTreeIndex = 110;
  if (_internal_has_singlekdtreeindex()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        110, _Internal::singlekdtreeindex(this), target, stream);
  }

  // .CoreML.Specification.SquaredEuclideanDistance squaredEuclideanDistance = 200;
  if (_internal_has_squaredeuclideandistance()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        200, _Internal::squaredeuclideandistance(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.NearestNeighborsIndex)
  return target;
}

size_t NearestNeighborsIndex::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.NearestNeighborsIndex)
  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 .CoreML.Specification.FloatVector floatSamples = 2;
  total_size += 1UL * this->_internal_floatsamples_size();
  for (const auto& msg : this->floatsamples_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // int32 numberOfDimensions = 1;
  if (this->_internal_numberofdimensions() != 0) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_numberofdimensions());
  }

  switch (IndexType_case()) {
    // .CoreML.Specification.LinearIndex linearIndex = 100;
    case kLinearIndex: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *IndexType_.linearindex_);
      break;
    }
    // .CoreML.Specification.SingleKdTreeIndex singleKdTreeIndex = 110;
    case kSingleKdTreeIndex: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *IndexType_.singlekdtreeindex_);
      break;
    }
    case INDEXTYPE_NOT_SET: {
      break;
    }
  }
  switch (DistanceFunction_case()) {
    // .CoreML.Specification.SquaredEuclideanDistance squaredEuclideanDistance = 200;
    case kSquaredEuclideanDistance: {
      total_size += 2 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *DistanceFunction_.squaredeuclideandistance_);
      break;
    }
    case DISTANCEFUNCTION_NOT_SET: {
      break;
    }
  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void NearestNeighborsIndex::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const NearestNeighborsIndex*>(
      &from));
}

void NearestNeighborsIndex::MergeFrom(const NearestNeighborsIndex& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.NearestNeighborsIndex)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  floatsamples_.MergeFrom(from.floatsamples_);
  if (from._internal_numberofdimensions() != 0) {
    _internal_set_numberofdimensions(from._internal_numberofdimensions());
  }
  switch (from.IndexType_case()) {
    case kLinearIndex: {
      _internal_mutable_linearindex()->::CoreML::Specification::LinearIndex::MergeFrom(from._internal_linearindex());
      break;
    }
    case kSingleKdTreeIndex: {
      _internal_mutable_singlekdtreeindex()->::CoreML::Specification::SingleKdTreeIndex::MergeFrom(from._internal_singlekdtreeindex());
      break;
    }
    case INDEXTYPE_NOT_SET: {
      break;
    }
  }
  switch (from.DistanceFunction_case()) {
    case kSquaredEuclideanDistance: {
      _internal_mutable_squaredeuclideandistance()->::CoreML::Specification::SquaredEuclideanDistance::MergeFrom(from._internal_squaredeuclideandistance());
      break;
    }
    case DISTANCEFUNCTION_NOT_SET: {
      break;
    }
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void NearestNeighborsIndex::InternalSwap(NearestNeighborsIndex* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  floatsamples_.InternalSwap(&other->floatsamples_);
  swap(numberofdimensions_, other->numberofdimensions_);
  swap(IndexType_, other->IndexType_);
  swap(DistanceFunction_, other->DistanceFunction_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
  swap(_oneof_case_[1], other->_oneof_case_[1]);
}

std::string NearestNeighborsIndex::GetTypeName() const {
  return "CoreML.Specification.NearestNeighborsIndex";
}


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

class UniformWeighting::_Internal {
 public:
};

UniformWeighting::UniformWeighting(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.UniformWeighting)
}
UniformWeighting::UniformWeighting(const UniformWeighting& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.UniformWeighting)
}

inline void UniformWeighting::SharedCtor() {
}

UniformWeighting::~UniformWeighting() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.UniformWeighting)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void UniformWeighting::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void UniformWeighting::ArenaDtor(void* object) {
  UniformWeighting* _this = reinterpret_cast< UniformWeighting* >(object);
  (void)_this;
}
void UniformWeighting::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void UniformWeighting::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void UniformWeighting::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.UniformWeighting)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _internal_metadata_.Clear<std::string>();
}

const char* UniformWeighting::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.UniformWeighting)
  return target;
}

size_t UniformWeighting::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.UniformWeighting)
  size_t total_size = 0;

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void UniformWeighting::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const UniformWeighting*>(
      &from));
}

void UniformWeighting::MergeFrom(const UniformWeighting& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.UniformWeighting)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void UniformWeighting::InternalSwap(UniformWeighting* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
}

std::string UniformWeighting::GetTypeName() const {
  return "CoreML.Specification.UniformWeighting";
}


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

class InverseDistanceWeighting::_Internal {
 public:
};

InverseDistanceWeighting::InverseDistanceWeighting(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.InverseDistanceWeighting)
}
InverseDistanceWeighting::InverseDistanceWeighting(const InverseDistanceWeighting& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.InverseDistanceWeighting)
}

inline void InverseDistanceWeighting::SharedCtor() {
}

InverseDistanceWeighting::~InverseDistanceWeighting() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.InverseDistanceWeighting)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void InverseDistanceWeighting::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void InverseDistanceWeighting::ArenaDtor(void* object) {
  InverseDistanceWeighting* _this = reinterpret_cast< InverseDistanceWeighting* >(object);
  (void)_this;
}
void InverseDistanceWeighting::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void InverseDistanceWeighting::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void InverseDistanceWeighting::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.InverseDistanceWeighting)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _internal_metadata_.Clear<std::string>();
}

const char* InverseDistanceWeighting::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.InverseDistanceWeighting)
  return target;
}

size_t InverseDistanceWeighting::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.InverseDistanceWeighting)
  size_t total_size = 0;

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void InverseDistanceWeighting::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const InverseDistanceWeighting*>(
      &from));
}

void InverseDistanceWeighting::MergeFrom(const InverseDistanceWeighting& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.InverseDistanceWeighting)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void InverseDistanceWeighting::InternalSwap(InverseDistanceWeighting* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
}

std::string InverseDistanceWeighting::GetTypeName() const {
  return "CoreML.Specification.InverseDistanceWeighting";
}


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

class LinearIndex::_Internal {
 public:
};

LinearIndex::LinearIndex(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.LinearIndex)
}
LinearIndex::LinearIndex(const LinearIndex& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.LinearIndex)
}

inline void LinearIndex::SharedCtor() {
}

LinearIndex::~LinearIndex() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.LinearIndex)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void LinearIndex::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void LinearIndex::ArenaDtor(void* object) {
  LinearIndex* _this = reinterpret_cast< LinearIndex* >(object);
  (void)_this;
}
void LinearIndex::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void LinearIndex::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void LinearIndex::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.LinearIndex)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _internal_metadata_.Clear<std::string>();
}

const char* LinearIndex::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.LinearIndex)
  return target;
}

size_t LinearIndex::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.LinearIndex)
  size_t total_size = 0;

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void LinearIndex::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const LinearIndex*>(
      &from));
}

void LinearIndex::MergeFrom(const LinearIndex& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.LinearIndex)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void LinearIndex::InternalSwap(LinearIndex* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
}

std::string LinearIndex::GetTypeName() const {
  return "CoreML.Specification.LinearIndex";
}


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

class SingleKdTreeIndex::_Internal {
 public:
};

SingleKdTreeIndex::SingleKdTreeIndex(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.SingleKdTreeIndex)
}
SingleKdTreeIndex::SingleKdTreeIndex(const SingleKdTreeIndex& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  leafsize_ = from.leafsize_;
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.SingleKdTreeIndex)
}

inline void SingleKdTreeIndex::SharedCtor() {
leafsize_ = 0;
}

SingleKdTreeIndex::~SingleKdTreeIndex() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.SingleKdTreeIndex)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void SingleKdTreeIndex::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void SingleKdTreeIndex::ArenaDtor(void* object) {
  SingleKdTreeIndex* _this = reinterpret_cast< SingleKdTreeIndex* >(object);
  (void)_this;
}
void SingleKdTreeIndex::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void SingleKdTreeIndex::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void SingleKdTreeIndex::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.SingleKdTreeIndex)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  leafsize_ = 0;
  _internal_metadata_.Clear<std::string>();
}

const char* SingleKdTreeIndex::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // int32 leafSize = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          leafsize_ = ::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<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  // int32 leafSize = 1;
  if (this->_internal_leafsize() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_leafsize(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.SingleKdTreeIndex)
  return target;
}

size_t SingleKdTreeIndex::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.SingleKdTreeIndex)
  size_t total_size = 0;

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

  // int32 leafSize = 1;
  if (this->_internal_leafsize() != 0) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_leafsize());
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void SingleKdTreeIndex::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const SingleKdTreeIndex*>(
      &from));
}

void SingleKdTreeIndex::MergeFrom(const SingleKdTreeIndex& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.SingleKdTreeIndex)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (from._internal_leafsize() != 0) {
    _internal_set_leafsize(from._internal_leafsize());
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void SingleKdTreeIndex::InternalSwap(SingleKdTreeIndex* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(leafsize_, other->leafsize_);
}

std::string SingleKdTreeIndex::GetTypeName() const {
  return "CoreML.Specification.SingleKdTreeIndex";
}


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

class SquaredEuclideanDistance::_Internal {
 public:
};

SquaredEuclideanDistance::SquaredEuclideanDistance(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  if (!is_message_owned) {
    RegisterArenaDtor(arena);
  }
  // @@protoc_insertion_point(arena_constructor:CoreML.Specification.SquaredEuclideanDistance)
}
SquaredEuclideanDistance::SquaredEuclideanDistance(const SquaredEuclideanDistance& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:CoreML.Specification.SquaredEuclideanDistance)
}

inline void SquaredEuclideanDistance::SharedCtor() {
}

SquaredEuclideanDistance::~SquaredEuclideanDistance() {
  // @@protoc_insertion_point(destructor:CoreML.Specification.SquaredEuclideanDistance)
  if (GetArenaForAllocation() != nullptr) return;
  SharedDtor();
  _internal_metadata_.Delete<std::string>();
}

inline void SquaredEuclideanDistance::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void SquaredEuclideanDistance::ArenaDtor(void* object) {
  SquaredEuclideanDistance* _this = reinterpret_cast< SquaredEuclideanDistance* >(object);
  (void)_this;
}
void SquaredEuclideanDistance::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void SquaredEuclideanDistance::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void SquaredEuclideanDistance::Clear() {
// @@protoc_insertion_point(message_clear_start:CoreML.Specification.SquaredEuclideanDistance)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _internal_metadata_.Clear<std::string>();
}

const char* SquaredEuclideanDistance::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:CoreML.Specification.SquaredEuclideanDistance)
  return target;
}

size_t SquaredEuclideanDistance::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:CoreML.Specification.SquaredEuclideanDistance)
  size_t total_size = 0;

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

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void SquaredEuclideanDistance::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast<const SquaredEuclideanDistance*>(
      &from));
}

void SquaredEuclideanDistance::MergeFrom(const SquaredEuclideanDistance& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:CoreML.Specification.SquaredEuclideanDistance)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

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

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

void SquaredEuclideanDistance::InternalSwap(SquaredEuclideanDistance* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
}

std::string SquaredEuclideanDistance::GetTypeName() const {
  return "CoreML.Specification.SquaredEuclideanDistance";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace Specification
}  // namespace CoreML
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::CoreML::Specification::KNearestNeighborsClassifier* Arena::CreateMaybeMessage< ::CoreML::Specification::KNearestNeighborsClassifier >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::KNearestNeighborsClassifier >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::NearestNeighborsIndex* Arena::CreateMaybeMessage< ::CoreML::Specification::NearestNeighborsIndex >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::NearestNeighborsIndex >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::UniformWeighting* Arena::CreateMaybeMessage< ::CoreML::Specification::UniformWeighting >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::UniformWeighting >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::InverseDistanceWeighting* Arena::CreateMaybeMessage< ::CoreML::Specification::InverseDistanceWeighting >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::InverseDistanceWeighting >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::LinearIndex* Arena::CreateMaybeMessage< ::CoreML::Specification::LinearIndex >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::LinearIndex >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::SingleKdTreeIndex* Arena::CreateMaybeMessage< ::CoreML::Specification::SingleKdTreeIndex >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::SingleKdTreeIndex >(arena);
}
template<> PROTOBUF_NOINLINE ::CoreML::Specification::SquaredEuclideanDistance* Arena::CreateMaybeMessage< ::CoreML::Specification::SquaredEuclideanDistance >(Arena* arena) {
  return Arena::CreateMessageInternal< ::CoreML::Specification::SquaredEuclideanDistance >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

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