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

#include "caffe2/proto/torch.pb.h"

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)

namespace protobuf_caffe2_2fproto_2fcaffe2_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_caffe2_2fproto_2fcaffe2_2eproto ::google::protobuf::internal::SCCInfo<3> scc_info_Argument;
}  // namespace protobuf_caffe2_2fproto_2fcaffe2_2eproto
namespace protobuf_caffe2_2fproto_2ftorch_2eproto {
extern PROTOBUF_INTERNAL_EXPORT_protobuf_caffe2_2fproto_2ftorch_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_AttributeDef;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_caffe2_2fproto_2ftorch_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_ParameterDef;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_caffe2_2fproto_2ftorch_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_RecordRef;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_caffe2_2fproto_2ftorch_2eproto ::google::protobuf::internal::SCCInfo<1> scc_info_TensorDef;
extern PROTOBUF_INTERNAL_EXPORT_protobuf_caffe2_2fproto_2ftorch_2eproto ::google::protobuf::internal::SCCInfo<4> scc_info_ModuleDef;
}  // namespace protobuf_caffe2_2fproto_2ftorch_2eproto
namespace torch {
class RecordRefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<RecordRef>
      _instance;
} _RecordRef_default_instance_;
class TensorDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<TensorDef>
      _instance;
} _TensorDef_default_instance_;
class AttributeDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<AttributeDef>
      _instance;
} _AttributeDef_default_instance_;
class ParameterDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<ParameterDef>
      _instance;
} _ParameterDef_default_instance_;
class ModuleDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<ModuleDef>
      _instance;
} _ModuleDef_default_instance_;
class LibDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<LibDef>
      _instance;
} _LibDef_default_instance_;
class ModelDefDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<ModelDef>
      _instance;
} _ModelDef_default_instance_;
}  // namespace torch
namespace protobuf_caffe2_2fproto_2ftorch_2eproto {
static void InitDefaultsRecordRef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_RecordRef_default_instance_;
    new (ptr) ::torch::RecordRef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::RecordRef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<0> scc_info_RecordRef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsRecordRef}, {}};

static void InitDefaultsTensorDef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_TensorDef_default_instance_;
    new (ptr) ::torch::TensorDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::TensorDef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<1> scc_info_TensorDef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTensorDef}, {
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_RecordRef.base,}};

static void InitDefaultsAttributeDef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_AttributeDef_default_instance_;
    new (ptr) ::torch::AttributeDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::AttributeDef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<0> scc_info_AttributeDef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsAttributeDef}, {}};

static void InitDefaultsParameterDef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_ParameterDef_default_instance_;
    new (ptr) ::torch::ParameterDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::ParameterDef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<0> scc_info_ParameterDef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsParameterDef}, {}};

static void InitDefaultsModuleDef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_ModuleDef_default_instance_;
    new (ptr) ::torch::ModuleDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::ModuleDef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<4> scc_info_ModuleDef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 4, InitDefaultsModuleDef}, {
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_RecordRef.base,
      &protobuf_caffe2_2fproto_2fcaffe2_2eproto::scc_info_Argument.base,
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ParameterDef.base,
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_AttributeDef.base,}};

static void InitDefaultsLibDef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_LibDef_default_instance_;
    new (ptr) ::torch::LibDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::LibDef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<1> scc_info_LibDef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsLibDef}, {
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_RecordRef.base,}};

static void InitDefaultsModelDef() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::torch::_ModelDef_default_instance_;
    new (ptr) ::torch::ModelDef();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::torch::ModelDef::InitAsDefaultInstance();
}

CAFFE2_API ::google::protobuf::internal::SCCInfo<2> scc_info_ModelDef =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsModelDef}, {
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ModuleDef.base,
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_TensorDef.base,}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_RecordRef.base);
  ::google::protobuf::internal::InitSCC(&scc_info_TensorDef.base);
  ::google::protobuf::internal::InitSCC(&scc_info_AttributeDef.base);
  ::google::protobuf::internal::InitSCC(&scc_info_ParameterDef.base);
  ::google::protobuf::internal::InitSCC(&scc_info_ModuleDef.base);
  ::google::protobuf::internal::InitSCC(&scc_info_LibDef.base);
  ::google::protobuf::internal::InitSCC(&scc_info_ModelDef.base);
}

::google::protobuf::Metadata file_level_metadata[7];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::RecordRef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::RecordRef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::RecordRef, key_),
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, dims_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, offset_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, strides_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, requires_grad_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, data_type_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, data_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, device_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, is_quantized_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, scale_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::TensorDef, zero_point_),
  ~0u,
  2,
  ~0u,
  4,
  3,
  1,
  0,
  5,
  6,
  7,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::AttributeDef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::AttributeDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::AttributeDef, type_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::AttributeDef, name_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::AttributeDef, id_),
  0,
  1,
  2,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ParameterDef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ParameterDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ParameterDef, is_buffer_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ParameterDef, tensor_id_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ParameterDef, name_),
  2,
  1,
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, submodules_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, torchscript_arena_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, caffe2_nets_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, pickle_arena_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, cpp_arena_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, parameters_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, name_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, optimize_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, attributes_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, get_state_attribute_id_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModuleDef, torchscript_debug_arena_),
  ~0u,
  1,
  ~0u,
  2,
  3,
  ~0u,
  0,
  6,
  ~0u,
  5,
  4,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::LibDef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::LibDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::LibDef, torchscript_arena_),
  0,
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, proto_version_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, main_module_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, producer_name_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, producer_version_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::torch::ModelDef, tensors_),
  3,
  2,
  0,
  1,
  ~0u,
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 6, sizeof(::torch::RecordRef)},
  { 7, 22, sizeof(::torch::TensorDef)},
  { 32, 40, sizeof(::torch::AttributeDef)},
  { 43, 51, sizeof(::torch::ParameterDef)},
  { 54, 70, sizeof(::torch::ModuleDef)},
  { 81, 87, sizeof(::torch::LibDef)},
  { 88, 98, sizeof(::torch::ModelDef)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_RecordRef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_TensorDef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_AttributeDef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_ParameterDef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_ModuleDef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_LibDef_default_instance_),
  reinterpret_cast<const ::google::protobuf::Message*>(&::torch::_ModelDef_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "caffe2/proto/torch.proto", schemas, file_default_instances, TableStruct::offsets,
      file_level_metadata, file_level_enum_descriptors, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
}

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

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n\030caffe2/proto/torch.proto\022\005torch\032\031caffe"
      "2/proto/caffe2.proto\"\030\n\tRecordRef\022\013\n\003key"
      "\030\001 \001(\t\"\353\001\n\tTensorDef\022\014\n\004dims\030\001 \003(\003\022\016\n\006of"
      "fset\030\002 \001(\003\022\017\n\007strides\030\003 \003(\003\022\025\n\rrequires_"
      "grad\030\004 \001(\010\022/\n\tdata_type\030\005 \001(\0162\034.caffe2.T"
      "ensorProto.DataType\022\036\n\004data\030\006 \001(\0132\020.torc"
      "h.RecordRef\022\016\n\006device\030\007 \001(\t\022\024\n\014is_quanti"
      "zed\030\010 \001(\010\022\r\n\005scale\030\t \001(\001\022\022\n\nzero_point\030\n"
      " \001(\003\"6\n\014AttributeDef\022\014\n\004type\030\001 \002(\t\022\014\n\004na"
      "me\030\002 \002(\t\022\n\n\002id\030\003 \002(\003\"B\n\014ParameterDef\022\021\n\t"
      "is_buffer\030\001 \001(\010\022\021\n\ttensor_id\030\002 \001(\003\022\014\n\004na"
      "me\030\003 \001(\t\"\225\003\n\tModuleDef\022$\n\nsubmodules\030\001 \003"
      "(\0132\020.torch.ModuleDef\022+\n\021torchscript_aren"
      "a\030\002 \001(\0132\020.torch.RecordRef\022#\n\013caffe2_nets"
      "\030\003 \003(\0132\016.caffe2.NetDef\022&\n\014pickle_arena\030\004"
      " \001(\0132\020.torch.RecordRef\022#\n\tcpp_arena\030\005 \001("
      "\0132\020.torch.RecordRef\022\'\n\nparameters\030\006 \003(\0132"
      "\023.torch.ParameterDef\022\014\n\004name\030\007 \001(\t\022\020\n\010op"
      "timize\030\010 \001(\010\022\'\n\nattributes\030\t \003(\0132\023.torch"
      ".AttributeDef\022\036\n\026get_state_attribute_id\030"
      "\n \001(\003\0221\n\027torchscript_debug_arena\030\013 \001(\0132\020"
      ".torch.RecordRef\"5\n\006LibDef\022+\n\021torchscrip"
      "t_arena\030\001 \001(\0132\020.torch.RecordRef\"\250\001\n\010Mode"
      "lDef\022\025\n\rproto_version\030\001 \001(\003\022%\n\013main_modu"
      "le\030\002 \001(\0132\020.torch.ModuleDef\022\025\n\rproducer_n"
      "ame\030\003 \001(\t\022\030\n\020producer_version\030\004 \001(\t\022!\n\007t"
      "ensors\030\005 \003(\0132\020.torch.TensorDefJ\004\010\t\020\nR\004li"
      "bs*(\n\014ProtoVersion\022\030\n\024PROTO_VERSION_NEWE"
      "ST\020\006"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 1124);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "caffe2/proto/torch.proto", &protobuf_RegisterTypes);
  ::protobuf_caffe2_2fproto_2fcaffe2_2eproto::AddDescriptors();
}

void AddDescriptors() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_caffe2_2fproto_2ftorch_2eproto
namespace torch {
const ::google::protobuf::EnumDescriptor* ProtoVersion_descriptor() {
  protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_enum_descriptors[0];
}
bool ProtoVersion_IsValid(int value) {
  switch (value) {
    case 6:
      return true;
    default:
      return false;
  }
}


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

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

RecordRef::RecordRef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_RecordRef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.RecordRef)
}
RecordRef::RecordRef(const RecordRef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  key_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_key()) {
    key_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.key_);
  }
  // @@protoc_insertion_point(copy_constructor:torch.RecordRef)
}

void RecordRef::SharedCtor() {
  key_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

RecordRef::~RecordRef() {
  // @@protoc_insertion_point(destructor:torch.RecordRef)
  SharedDtor();
}

void RecordRef::SharedDtor() {
  key_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void RecordRef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* RecordRef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const RecordRef& RecordRef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_RecordRef.base);
  return *internal_default_instance();
}


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

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    key_.ClearNonDefaultToEmptyNoArena();
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool RecordRef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.RecordRef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional string key = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_key()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->key().data(), static_cast<int>(this->key().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.RecordRef.key");
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  cached_has_bits = _has_bits_[0];
  // optional string key = 1;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->key().data(), static_cast<int>(this->key().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.RecordRef.key");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      1, this->key(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.RecordRef)
}

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

  cached_has_bits = _has_bits_[0];
  // optional string key = 1;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->key().data(), static_cast<int>(this->key().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.RecordRef.key");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        1, this->key(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.RecordRef)
  return target;
}

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

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // optional string key = 1;
  if (has_key()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->key());
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void RecordRef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.RecordRef)
  GOOGLE_DCHECK_NE(&from, this);
  const RecordRef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const RecordRef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.RecordRef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.RecordRef)
    MergeFrom(*source);
  }
}

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

  if (from.has_key()) {
    set_has_key();
    key_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.key_);
  }
}

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

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

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

void RecordRef::Swap(RecordRef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void RecordRef::InternalSwap(RecordRef* other) {
  using std::swap;
  key_.Swap(&other->key_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


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

void TensorDef::InitAsDefaultInstance() {
  ::torch::_TensorDef_default_instance_._instance.get_mutable()->data_ = const_cast< ::torch::RecordRef*>(
      ::torch::RecordRef::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TensorDef::kDimsFieldNumber;
const int TensorDef::kOffsetFieldNumber;
const int TensorDef::kStridesFieldNumber;
const int TensorDef::kRequiresGradFieldNumber;
const int TensorDef::kDataTypeFieldNumber;
const int TensorDef::kDataFieldNumber;
const int TensorDef::kDeviceFieldNumber;
const int TensorDef::kIsQuantizedFieldNumber;
const int TensorDef::kScaleFieldNumber;
const int TensorDef::kZeroPointFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

TensorDef::TensorDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_TensorDef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.TensorDef)
}
TensorDef::TensorDef(const TensorDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      dims_(from.dims_),
      strides_(from.strides_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  device_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_device()) {
    device_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.device_);
  }
  if (from.has_data()) {
    data_ = new ::torch::RecordRef(*from.data_);
  } else {
    data_ = NULL;
  }
  ::memcpy(&offset_, &from.offset_,
    static_cast<size_t>(reinterpret_cast<char*>(&zero_point_) -
    reinterpret_cast<char*>(&offset_)) + sizeof(zero_point_));
  // @@protoc_insertion_point(copy_constructor:torch.TensorDef)
}

void TensorDef::SharedCtor() {
  device_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&data_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&zero_point_) -
      reinterpret_cast<char*>(&data_)) + sizeof(zero_point_));
}

TensorDef::~TensorDef() {
  // @@protoc_insertion_point(destructor:torch.TensorDef)
  SharedDtor();
}

void TensorDef::SharedDtor() {
  device_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete data_;
}

void TensorDef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* TensorDef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const TensorDef& TensorDef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_TensorDef.base);
  return *internal_default_instance();
}


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

  dims_.Clear();
  strides_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 3u) {
    if (cached_has_bits & 0x00000001u) {
      device_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      GOOGLE_DCHECK(data_ != NULL);
      data_->Clear();
    }
  }
  if (cached_has_bits & 252u) {
    ::memset(&offset_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&zero_point_) -
        reinterpret_cast<char*>(&offset_)) + sizeof(zero_point_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool TensorDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.TensorDef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // repeated int64 dims = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 1, 8u, input, this->mutable_dims())));
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, this->mutable_dims())));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int64 offset = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          set_has_offset();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, &offset_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated int64 strides = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 1, 24u, input, this->mutable_strides())));
        } else if (
            static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, this->mutable_strides())));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional bool requires_grad = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
          set_has_requires_grad();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &requires_grad_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .caffe2.TensorProto.DataType data_type = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          if (::caffe2::TensorProto_DataType_IsValid(value)) {
            set_data_type(static_cast< ::caffe2::TensorProto_DataType >(value));
          } else {
            mutable_unknown_fields()->AddVarint(
                5, static_cast< ::google::protobuf::uint64>(value));
          }
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .torch.RecordRef data = 6;
      case 6: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_data()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string device = 7;
      case 7: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_device()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->device().data(), static_cast<int>(this->device().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.TensorDef.device");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional bool is_quantized = 8;
      case 8: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(64u /* 64 & 0xFF */)) {
          set_has_is_quantized();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &is_quantized_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional double scale = 9;
      case 9: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(73u /* 73 & 0xFF */)) {
          set_has_scale();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
                 input, &scale_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int64 zero_point = 10;
      case 10: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(80u /* 80 & 0xFF */)) {
          set_has_zero_point();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, &zero_point_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  // repeated int64 dims = 1;
  for (int i = 0, n = this->dims_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(
      1, this->dims(i), output);
  }

  cached_has_bits = _has_bits_[0];
  // optional int64 offset = 2;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->offset(), output);
  }

  // repeated int64 strides = 3;
  for (int i = 0, n = this->strides_size(); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(
      3, this->strides(i), output);
  }

  // optional bool requires_grad = 4;
  if (cached_has_bits & 0x00000010u) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->requires_grad(), output);
  }

  // optional .caffe2.TensorProto.DataType data_type = 5;
  if (cached_has_bits & 0x00000008u) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      5, this->data_type(), output);
  }

  // optional .torch.RecordRef data = 6;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      6, this->_internal_data(), output);
  }

  // optional string device = 7;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->device().data(), static_cast<int>(this->device().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.TensorDef.device");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      7, this->device(), output);
  }

  // optional bool is_quantized = 8;
  if (cached_has_bits & 0x00000020u) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(8, this->is_quantized(), output);
  }

  // optional double scale = 9;
  if (cached_has_bits & 0x00000040u) {
    ::google::protobuf::internal::WireFormatLite::WriteDouble(9, this->scale(), output);
  }

  // optional int64 zero_point = 10;
  if (cached_has_bits & 0x00000080u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(10, this->zero_point(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.TensorDef)
}

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

  // repeated int64 dims = 1;
  target = ::google::protobuf::internal::WireFormatLite::
    WriteInt64ToArray(1, this->dims_, target);

  cached_has_bits = _has_bits_[0];
  // optional int64 offset = 2;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->offset(), target);
  }

  // repeated int64 strides = 3;
  target = ::google::protobuf::internal::WireFormatLite::
    WriteInt64ToArray(3, this->strides_, target);

  // optional bool requires_grad = 4;
  if (cached_has_bits & 0x00000010u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->requires_grad(), target);
  }

  // optional .caffe2.TensorProto.DataType data_type = 5;
  if (cached_has_bits & 0x00000008u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      5, this->data_type(), target);
  }

  // optional .torch.RecordRef data = 6;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        6, this->_internal_data(), deterministic, target);
  }

  // optional string device = 7;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->device().data(), static_cast<int>(this->device().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.TensorDef.device");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        7, this->device(), target);
  }

  // optional bool is_quantized = 8;
  if (cached_has_bits & 0x00000020u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(8, this->is_quantized(), target);
  }

  // optional double scale = 9;
  if (cached_has_bits & 0x00000040u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(9, this->scale(), target);
  }

  // optional int64 zero_point = 10;
  if (cached_has_bits & 0x00000080u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(10, this->zero_point(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.TensorDef)
  return target;
}

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

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated int64 dims = 1;
  {
    size_t data_size = ::google::protobuf::internal::WireFormatLite::
      Int64Size(this->dims_);
    total_size += 1 *
                  ::google::protobuf::internal::FromIntSize(this->dims_size());
    total_size += data_size;
  }

  // repeated int64 strides = 3;
  {
    size_t data_size = ::google::protobuf::internal::WireFormatLite::
      Int64Size(this->strides_);
    total_size += 1 *
                  ::google::protobuf::internal::FromIntSize(this->strides_size());
    total_size += data_size;
  }

  if (_has_bits_[0 / 32] & 255u) {
    // optional string device = 7;
    if (has_device()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->device());
    }

    // optional .torch.RecordRef data = 6;
    if (has_data()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *data_);
    }

    // optional int64 offset = 2;
    if (has_offset()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->offset());
    }

    // optional .caffe2.TensorProto.DataType data_type = 5;
    if (has_data_type()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->data_type());
    }

    // optional bool requires_grad = 4;
    if (has_requires_grad()) {
      total_size += 1 + 1;
    }

    // optional bool is_quantized = 8;
    if (has_is_quantized()) {
      total_size += 1 + 1;
    }

    // optional double scale = 9;
    if (has_scale()) {
      total_size += 1 + 8;
    }

    // optional int64 zero_point = 10;
    if (has_zero_point()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->zero_point());
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TensorDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.TensorDef)
  GOOGLE_DCHECK_NE(&from, this);
  const TensorDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const TensorDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.TensorDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.TensorDef)
    MergeFrom(*source);
  }
}

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

  dims_.MergeFrom(from.dims_);
  strides_.MergeFrom(from.strides_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 255u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_device();
      device_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.device_);
    }
    if (cached_has_bits & 0x00000002u) {
      mutable_data()->::torch::RecordRef::MergeFrom(from.data());
    }
    if (cached_has_bits & 0x00000004u) {
      offset_ = from.offset_;
    }
    if (cached_has_bits & 0x00000008u) {
      data_type_ = from.data_type_;
    }
    if (cached_has_bits & 0x00000010u) {
      requires_grad_ = from.requires_grad_;
    }
    if (cached_has_bits & 0x00000020u) {
      is_quantized_ = from.is_quantized_;
    }
    if (cached_has_bits & 0x00000040u) {
      scale_ = from.scale_;
    }
    if (cached_has_bits & 0x00000080u) {
      zero_point_ = from.zero_point_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

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

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

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

void TensorDef::Swap(TensorDef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void TensorDef::InternalSwap(TensorDef* other) {
  using std::swap;
  dims_.InternalSwap(&other->dims_);
  strides_.InternalSwap(&other->strides_);
  device_.Swap(&other->device_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(data_, other->data_);
  swap(offset_, other->offset_);
  swap(data_type_, other->data_type_);
  swap(requires_grad_, other->requires_grad_);
  swap(is_quantized_, other->is_quantized_);
  swap(scale_, other->scale_);
  swap(zero_point_, other->zero_point_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


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

void AttributeDef::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AttributeDef::kTypeFieldNumber;
const int AttributeDef::kNameFieldNumber;
const int AttributeDef::kIdFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

AttributeDef::AttributeDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_AttributeDef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.AttributeDef)
}
AttributeDef::AttributeDef(const AttributeDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_type()) {
    type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_);
  }
  name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_name()) {
    name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  id_ = from.id_;
  // @@protoc_insertion_point(copy_constructor:torch.AttributeDef)
}

void AttributeDef::SharedCtor() {
  type_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  id_ = GOOGLE_LONGLONG(0);
}

AttributeDef::~AttributeDef() {
  // @@protoc_insertion_point(destructor:torch.AttributeDef)
  SharedDtor();
}

void AttributeDef::SharedDtor() {
  type_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void AttributeDef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* AttributeDef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const AttributeDef& AttributeDef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_AttributeDef.base);
  return *internal_default_instance();
}


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

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 3u) {
    if (cached_has_bits & 0x00000001u) {
      type_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      name_.ClearNonDefaultToEmptyNoArena();
    }
  }
  id_ = GOOGLE_LONGLONG(0);
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool AttributeDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.AttributeDef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // required string type = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_type()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->type().data(), static_cast<int>(this->type().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.AttributeDef.type");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // required string name = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_name()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->name().data(), static_cast<int>(this->name().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.AttributeDef.name");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // required int64 id = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
          set_has_id();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, &id_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  cached_has_bits = _has_bits_[0];
  // required string type = 1;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->type().data(), static_cast<int>(this->type().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.AttributeDef.type");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      1, this->type(), output);
  }

  // required string name = 2;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), static_cast<int>(this->name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.AttributeDef.name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      2, this->name(), output);
  }

  // required int64 id = 3;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->id(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.AttributeDef)
}

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

  cached_has_bits = _has_bits_[0];
  // required string type = 1;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->type().data(), static_cast<int>(this->type().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.AttributeDef.type");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        1, this->type(), target);
  }

  // required string name = 2;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), static_cast<int>(this->name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.AttributeDef.name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        2, this->name(), target);
  }

  // required int64 id = 3;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(3, this->id(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.AttributeDef)
  return target;
}

size_t AttributeDef::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:torch.AttributeDef)
  size_t total_size = 0;

  if (has_type()) {
    // required string type = 1;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->type());
  }

  if (has_name()) {
    // required string name = 2;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->name());
  }

  if (has_id()) {
    // required int64 id = 3;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::Int64Size(
        this->id());
  }

  return total_size;
}
size_t AttributeDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:torch.AttributeDef)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  if (((_has_bits_[0] & 0x00000007) ^ 0x00000007) == 0) {  // All required fields are present.
    // required string type = 1;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->type());

    // required string name = 2;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->name());

    // required int64 id = 3;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::Int64Size(
        this->id());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void AttributeDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.AttributeDef)
  GOOGLE_DCHECK_NE(&from, this);
  const AttributeDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const AttributeDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.AttributeDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.AttributeDef)
    MergeFrom(*source);
  }
}

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

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 7u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_type();
      type_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_);
    }
    if (cached_has_bits & 0x00000002u) {
      set_has_name();
      name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
    }
    if (cached_has_bits & 0x00000004u) {
      id_ = from.id_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

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

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

bool AttributeDef::IsInitialized() const {
  if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false;
  return true;
}

void AttributeDef::Swap(AttributeDef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void AttributeDef::InternalSwap(AttributeDef* other) {
  using std::swap;
  type_.Swap(&other->type_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(id_, other->id_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


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

void ParameterDef::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ParameterDef::kIsBufferFieldNumber;
const int ParameterDef::kTensorIdFieldNumber;
const int ParameterDef::kNameFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

ParameterDef::ParameterDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ParameterDef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.ParameterDef)
}
ParameterDef::ParameterDef(const ParameterDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_name()) {
    name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  ::memcpy(&tensor_id_, &from.tensor_id_,
    static_cast<size_t>(reinterpret_cast<char*>(&is_buffer_) -
    reinterpret_cast<char*>(&tensor_id_)) + sizeof(is_buffer_));
  // @@protoc_insertion_point(copy_constructor:torch.ParameterDef)
}

void ParameterDef::SharedCtor() {
  name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&tensor_id_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&is_buffer_) -
      reinterpret_cast<char*>(&tensor_id_)) + sizeof(is_buffer_));
}

ParameterDef::~ParameterDef() {
  // @@protoc_insertion_point(destructor:torch.ParameterDef)
  SharedDtor();
}

void ParameterDef::SharedDtor() {
  name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void ParameterDef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* ParameterDef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const ParameterDef& ParameterDef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ParameterDef.base);
  return *internal_default_instance();
}


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

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    name_.ClearNonDefaultToEmptyNoArena();
  }
  if (cached_has_bits & 6u) {
    ::memset(&tensor_id_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&is_buffer_) -
        reinterpret_cast<char*>(&tensor_id_)) + sizeof(is_buffer_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool ParameterDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.ParameterDef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional bool is_buffer = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          set_has_is_buffer();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &is_buffer_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int64 tensor_id = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          set_has_tensor_id();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, &tensor_id_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string name = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_name()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->name().data(), static_cast<int>(this->name().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.ParameterDef.name");
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  cached_has_bits = _has_bits_[0];
  // optional bool is_buffer = 1;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->is_buffer(), output);
  }

  // optional int64 tensor_id = 2;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->tensor_id(), output);
  }

  // optional string name = 3;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), static_cast<int>(this->name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ParameterDef.name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      3, this->name(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.ParameterDef)
}

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

  cached_has_bits = _has_bits_[0];
  // optional bool is_buffer = 1;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->is_buffer(), target);
  }

  // optional int64 tensor_id = 2;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->tensor_id(), target);
  }

  // optional string name = 3;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), static_cast<int>(this->name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ParameterDef.name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        3, this->name(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.ParameterDef)
  return target;
}

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

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  if (_has_bits_[0 / 32] & 7u) {
    // optional string name = 3;
    if (has_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->name());
    }

    // optional int64 tensor_id = 2;
    if (has_tensor_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->tensor_id());
    }

    // optional bool is_buffer = 1;
    if (has_is_buffer()) {
      total_size += 1 + 1;
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void ParameterDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.ParameterDef)
  GOOGLE_DCHECK_NE(&from, this);
  const ParameterDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const ParameterDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.ParameterDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.ParameterDef)
    MergeFrom(*source);
  }
}

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

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 7u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_name();
      name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
    }
    if (cached_has_bits & 0x00000002u) {
      tensor_id_ = from.tensor_id_;
    }
    if (cached_has_bits & 0x00000004u) {
      is_buffer_ = from.is_buffer_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

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

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

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

void ParameterDef::Swap(ParameterDef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void ParameterDef::InternalSwap(ParameterDef* other) {
  using std::swap;
  name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(tensor_id_, other->tensor_id_);
  swap(is_buffer_, other->is_buffer_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


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

void ModuleDef::InitAsDefaultInstance() {
  ::torch::_ModuleDef_default_instance_._instance.get_mutable()->torchscript_arena_ = const_cast< ::torch::RecordRef*>(
      ::torch::RecordRef::internal_default_instance());
  ::torch::_ModuleDef_default_instance_._instance.get_mutable()->pickle_arena_ = const_cast< ::torch::RecordRef*>(
      ::torch::RecordRef::internal_default_instance());
  ::torch::_ModuleDef_default_instance_._instance.get_mutable()->cpp_arena_ = const_cast< ::torch::RecordRef*>(
      ::torch::RecordRef::internal_default_instance());
  ::torch::_ModuleDef_default_instance_._instance.get_mutable()->torchscript_debug_arena_ = const_cast< ::torch::RecordRef*>(
      ::torch::RecordRef::internal_default_instance());
}
void ModuleDef::clear_caffe2_nets() {
  caffe2_nets_.Clear();
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ModuleDef::kSubmodulesFieldNumber;
const int ModuleDef::kTorchscriptArenaFieldNumber;
const int ModuleDef::kCaffe2NetsFieldNumber;
const int ModuleDef::kPickleArenaFieldNumber;
const int ModuleDef::kCppArenaFieldNumber;
const int ModuleDef::kParametersFieldNumber;
const int ModuleDef::kNameFieldNumber;
const int ModuleDef::kOptimizeFieldNumber;
const int ModuleDef::kAttributesFieldNumber;
const int ModuleDef::kGetStateAttributeIdFieldNumber;
const int ModuleDef::kTorchscriptDebugArenaFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

ModuleDef::ModuleDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ModuleDef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.ModuleDef)
}
ModuleDef::ModuleDef(const ModuleDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      submodules_(from.submodules_),
      caffe2_nets_(from.caffe2_nets_),
      parameters_(from.parameters_),
      attributes_(from.attributes_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_name()) {
    name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  if (from.has_torchscript_arena()) {
    torchscript_arena_ = new ::torch::RecordRef(*from.torchscript_arena_);
  } else {
    torchscript_arena_ = NULL;
  }
  if (from.has_pickle_arena()) {
    pickle_arena_ = new ::torch::RecordRef(*from.pickle_arena_);
  } else {
    pickle_arena_ = NULL;
  }
  if (from.has_cpp_arena()) {
    cpp_arena_ = new ::torch::RecordRef(*from.cpp_arena_);
  } else {
    cpp_arena_ = NULL;
  }
  if (from.has_torchscript_debug_arena()) {
    torchscript_debug_arena_ = new ::torch::RecordRef(*from.torchscript_debug_arena_);
  } else {
    torchscript_debug_arena_ = NULL;
  }
  ::memcpy(&get_state_attribute_id_, &from.get_state_attribute_id_,
    static_cast<size_t>(reinterpret_cast<char*>(&optimize_) -
    reinterpret_cast<char*>(&get_state_attribute_id_)) + sizeof(optimize_));
  // @@protoc_insertion_point(copy_constructor:torch.ModuleDef)
}

void ModuleDef::SharedCtor() {
  name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&torchscript_arena_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&optimize_) -
      reinterpret_cast<char*>(&torchscript_arena_)) + sizeof(optimize_));
}

ModuleDef::~ModuleDef() {
  // @@protoc_insertion_point(destructor:torch.ModuleDef)
  SharedDtor();
}

void ModuleDef::SharedDtor() {
  name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete torchscript_arena_;
  if (this != internal_default_instance()) delete pickle_arena_;
  if (this != internal_default_instance()) delete cpp_arena_;
  if (this != internal_default_instance()) delete torchscript_debug_arena_;
}

void ModuleDef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* ModuleDef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const ModuleDef& ModuleDef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ModuleDef.base);
  return *internal_default_instance();
}


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

  submodules_.Clear();
  caffe2_nets_.Clear();
  parameters_.Clear();
  attributes_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 31u) {
    if (cached_has_bits & 0x00000001u) {
      name_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      GOOGLE_DCHECK(torchscript_arena_ != NULL);
      torchscript_arena_->Clear();
    }
    if (cached_has_bits & 0x00000004u) {
      GOOGLE_DCHECK(pickle_arena_ != NULL);
      pickle_arena_->Clear();
    }
    if (cached_has_bits & 0x00000008u) {
      GOOGLE_DCHECK(cpp_arena_ != NULL);
      cpp_arena_->Clear();
    }
    if (cached_has_bits & 0x00000010u) {
      GOOGLE_DCHECK(torchscript_debug_arena_ != NULL);
      torchscript_debug_arena_->Clear();
    }
  }
  if (cached_has_bits & 96u) {
    ::memset(&get_state_attribute_id_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&optimize_) -
        reinterpret_cast<char*>(&get_state_attribute_id_)) + sizeof(optimize_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool ModuleDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.ModuleDef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // repeated .torch.ModuleDef submodules = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_submodules()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .torch.RecordRef torchscript_arena = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_torchscript_arena()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .caffe2.NetDef caffe2_nets = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_caffe2_nets()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .torch.RecordRef pickle_arena = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_pickle_arena()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .torch.RecordRef cpp_arena = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_cpp_arena()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .torch.ParameterDef parameters = 6;
      case 6: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_parameters()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string name = 7;
      case 7: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(58u /* 58 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_name()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->name().data(), static_cast<int>(this->name().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.ModuleDef.name");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional bool optimize = 8;
      case 8: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(64u /* 64 & 0xFF */)) {
          set_has_optimize();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &optimize_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .torch.AttributeDef attributes = 9;
      case 9: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_attributes()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional int64 get_state_attribute_id = 10;
      case 10: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(80u /* 80 & 0xFF */)) {
          set_has_get_state_attribute_id();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, &get_state_attribute_id_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .torch.RecordRef torchscript_debug_arena = 11;
      case 11: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(90u /* 90 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_torchscript_debug_arena()));
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  // repeated .torch.ModuleDef submodules = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->submodules_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1,
      this->submodules(static_cast<int>(i)),
      output);
  }

  cached_has_bits = _has_bits_[0];
  // optional .torch.RecordRef torchscript_arena = 2;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->_internal_torchscript_arena(), output);
  }

  // repeated .caffe2.NetDef caffe2_nets = 3;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->caffe2_nets_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      3,
      this->caffe2_nets(static_cast<int>(i)),
      output);
  }

  // optional .torch.RecordRef pickle_arena = 4;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      4, this->_internal_pickle_arena(), output);
  }

  // optional .torch.RecordRef cpp_arena = 5;
  if (cached_has_bits & 0x00000008u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      5, this->_internal_cpp_arena(), output);
  }

  // repeated .torch.ParameterDef parameters = 6;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->parameters_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      6,
      this->parameters(static_cast<int>(i)),
      output);
  }

  // optional string name = 7;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), static_cast<int>(this->name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ModuleDef.name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      7, this->name(), output);
  }

  // optional bool optimize = 8;
  if (cached_has_bits & 0x00000040u) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(8, this->optimize(), output);
  }

  // repeated .torch.AttributeDef attributes = 9;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->attributes_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      9,
      this->attributes(static_cast<int>(i)),
      output);
  }

  // optional int64 get_state_attribute_id = 10;
  if (cached_has_bits & 0x00000020u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(10, this->get_state_attribute_id(), output);
  }

  // optional .torch.RecordRef torchscript_debug_arena = 11;
  if (cached_has_bits & 0x00000010u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      11, this->_internal_torchscript_debug_arena(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.ModuleDef)
}

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

  // repeated .torch.ModuleDef submodules = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->submodules_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->submodules(static_cast<int>(i)), deterministic, target);
  }

  cached_has_bits = _has_bits_[0];
  // optional .torch.RecordRef torchscript_arena = 2;
  if (cached_has_bits & 0x00000002u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->_internal_torchscript_arena(), deterministic, target);
  }

  // repeated .caffe2.NetDef caffe2_nets = 3;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->caffe2_nets_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        3, this->caffe2_nets(static_cast<int>(i)), deterministic, target);
  }

  // optional .torch.RecordRef pickle_arena = 4;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        4, this->_internal_pickle_arena(), deterministic, target);
  }

  // optional .torch.RecordRef cpp_arena = 5;
  if (cached_has_bits & 0x00000008u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        5, this->_internal_cpp_arena(), deterministic, target);
  }

  // repeated .torch.ParameterDef parameters = 6;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->parameters_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        6, this->parameters(static_cast<int>(i)), deterministic, target);
  }

  // optional string name = 7;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), static_cast<int>(this->name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ModuleDef.name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        7, this->name(), target);
  }

  // optional bool optimize = 8;
  if (cached_has_bits & 0x00000040u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(8, this->optimize(), target);
  }

  // repeated .torch.AttributeDef attributes = 9;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->attributes_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        9, this->attributes(static_cast<int>(i)), deterministic, target);
  }

  // optional int64 get_state_attribute_id = 10;
  if (cached_has_bits & 0x00000020u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(10, this->get_state_attribute_id(), target);
  }

  // optional .torch.RecordRef torchscript_debug_arena = 11;
  if (cached_has_bits & 0x00000010u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        11, this->_internal_torchscript_debug_arena(), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.ModuleDef)
  return target;
}

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

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated .torch.ModuleDef submodules = 1;
  {
    unsigned int count = static_cast<unsigned int>(this->submodules_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->submodules(static_cast<int>(i)));
    }
  }

  // repeated .caffe2.NetDef caffe2_nets = 3;
  {
    unsigned int count = static_cast<unsigned int>(this->caffe2_nets_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->caffe2_nets(static_cast<int>(i)));
    }
  }

  // repeated .torch.ParameterDef parameters = 6;
  {
    unsigned int count = static_cast<unsigned int>(this->parameters_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->parameters(static_cast<int>(i)));
    }
  }

  // repeated .torch.AttributeDef attributes = 9;
  {
    unsigned int count = static_cast<unsigned int>(this->attributes_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->attributes(static_cast<int>(i)));
    }
  }

  if (_has_bits_[0 / 32] & 127u) {
    // optional string name = 7;
    if (has_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->name());
    }

    // optional .torch.RecordRef torchscript_arena = 2;
    if (has_torchscript_arena()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *torchscript_arena_);
    }

    // optional .torch.RecordRef pickle_arena = 4;
    if (has_pickle_arena()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *pickle_arena_);
    }

    // optional .torch.RecordRef cpp_arena = 5;
    if (has_cpp_arena()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *cpp_arena_);
    }

    // optional .torch.RecordRef torchscript_debug_arena = 11;
    if (has_torchscript_debug_arena()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *torchscript_debug_arena_);
    }

    // optional int64 get_state_attribute_id = 10;
    if (has_get_state_attribute_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->get_state_attribute_id());
    }

    // optional bool optimize = 8;
    if (has_optimize()) {
      total_size += 1 + 1;
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void ModuleDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.ModuleDef)
  GOOGLE_DCHECK_NE(&from, this);
  const ModuleDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const ModuleDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.ModuleDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.ModuleDef)
    MergeFrom(*source);
  }
}

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

  submodules_.MergeFrom(from.submodules_);
  caffe2_nets_.MergeFrom(from.caffe2_nets_);
  parameters_.MergeFrom(from.parameters_);
  attributes_.MergeFrom(from.attributes_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 127u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_name();
      name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_);
    }
    if (cached_has_bits & 0x00000002u) {
      mutable_torchscript_arena()->::torch::RecordRef::MergeFrom(from.torchscript_arena());
    }
    if (cached_has_bits & 0x00000004u) {
      mutable_pickle_arena()->::torch::RecordRef::MergeFrom(from.pickle_arena());
    }
    if (cached_has_bits & 0x00000008u) {
      mutable_cpp_arena()->::torch::RecordRef::MergeFrom(from.cpp_arena());
    }
    if (cached_has_bits & 0x00000010u) {
      mutable_torchscript_debug_arena()->::torch::RecordRef::MergeFrom(from.torchscript_debug_arena());
    }
    if (cached_has_bits & 0x00000020u) {
      get_state_attribute_id_ = from.get_state_attribute_id_;
    }
    if (cached_has_bits & 0x00000040u) {
      optimize_ = from.optimize_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

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

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

bool ModuleDef::IsInitialized() const {
  if (!::google::protobuf::internal::AllAreInitialized(this->submodules())) return false;
  if (!::google::protobuf::internal::AllAreInitialized(this->caffe2_nets())) return false;
  if (!::google::protobuf::internal::AllAreInitialized(this->attributes())) return false;
  return true;
}

void ModuleDef::Swap(ModuleDef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void ModuleDef::InternalSwap(ModuleDef* other) {
  using std::swap;
  CastToBase(&submodules_)->InternalSwap(CastToBase(&other->submodules_));
  CastToBase(&caffe2_nets_)->InternalSwap(CastToBase(&other->caffe2_nets_));
  CastToBase(&parameters_)->InternalSwap(CastToBase(&other->parameters_));
  CastToBase(&attributes_)->InternalSwap(CastToBase(&other->attributes_));
  name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(torchscript_arena_, other->torchscript_arena_);
  swap(pickle_arena_, other->pickle_arena_);
  swap(cpp_arena_, other->cpp_arena_);
  swap(torchscript_debug_arena_, other->torchscript_debug_arena_);
  swap(get_state_attribute_id_, other->get_state_attribute_id_);
  swap(optimize_, other->optimize_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


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

void LibDef::InitAsDefaultInstance() {
  ::torch::_LibDef_default_instance_._instance.get_mutable()->torchscript_arena_ = const_cast< ::torch::RecordRef*>(
      ::torch::RecordRef::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int LibDef::kTorchscriptArenaFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

LibDef::LibDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_LibDef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.LibDef)
}
LibDef::LibDef(const LibDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  if (from.has_torchscript_arena()) {
    torchscript_arena_ = new ::torch::RecordRef(*from.torchscript_arena_);
  } else {
    torchscript_arena_ = NULL;
  }
  // @@protoc_insertion_point(copy_constructor:torch.LibDef)
}

void LibDef::SharedCtor() {
  torchscript_arena_ = NULL;
}

LibDef::~LibDef() {
  // @@protoc_insertion_point(destructor:torch.LibDef)
  SharedDtor();
}

void LibDef::SharedDtor() {
  if (this != internal_default_instance()) delete torchscript_arena_;
}

void LibDef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* LibDef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const LibDef& LibDef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_LibDef.base);
  return *internal_default_instance();
}


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

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    GOOGLE_DCHECK(torchscript_arena_ != NULL);
    torchscript_arena_->Clear();
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool LibDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.LibDef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional .torch.RecordRef torchscript_arena = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_torchscript_arena()));
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  cached_has_bits = _has_bits_[0];
  // optional .torch.RecordRef torchscript_arena = 1;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->_internal_torchscript_arena(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.LibDef)
}

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

  cached_has_bits = _has_bits_[0];
  // optional .torch.RecordRef torchscript_arena = 1;
  if (cached_has_bits & 0x00000001u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        1, this->_internal_torchscript_arena(), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.LibDef)
  return target;
}

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

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // optional .torch.RecordRef torchscript_arena = 1;
  if (has_torchscript_arena()) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::MessageSize(
        *torchscript_arena_);
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void LibDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.LibDef)
  GOOGLE_DCHECK_NE(&from, this);
  const LibDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const LibDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.LibDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.LibDef)
    MergeFrom(*source);
  }
}

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

  if (from.has_torchscript_arena()) {
    mutable_torchscript_arena()->::torch::RecordRef::MergeFrom(from.torchscript_arena());
  }
}

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

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

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

void LibDef::Swap(LibDef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void LibDef::InternalSwap(LibDef* other) {
  using std::swap;
  swap(torchscript_arena_, other->torchscript_arena_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


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

void ModelDef::InitAsDefaultInstance() {
  ::torch::_ModelDef_default_instance_._instance.get_mutable()->main_module_ = const_cast< ::torch::ModuleDef*>(
      ::torch::ModuleDef::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ModelDef::kProtoVersionFieldNumber;
const int ModelDef::kMainModuleFieldNumber;
const int ModelDef::kProducerNameFieldNumber;
const int ModelDef::kProducerVersionFieldNumber;
const int ModelDef::kTensorsFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

ModelDef::ModelDef()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ModelDef.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:torch.ModelDef)
}
ModelDef::ModelDef(const ModelDef& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_),
      tensors_(from.tensors_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  producer_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_producer_name()) {
    producer_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.producer_name_);
  }
  producer_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_producer_version()) {
    producer_version_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.producer_version_);
  }
  if (from.has_main_module()) {
    main_module_ = new ::torch::ModuleDef(*from.main_module_);
  } else {
    main_module_ = NULL;
  }
  proto_version_ = from.proto_version_;
  // @@protoc_insertion_point(copy_constructor:torch.ModelDef)
}

void ModelDef::SharedCtor() {
  producer_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  producer_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&main_module_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&proto_version_) -
      reinterpret_cast<char*>(&main_module_)) + sizeof(proto_version_));
}

ModelDef::~ModelDef() {
  // @@protoc_insertion_point(destructor:torch.ModelDef)
  SharedDtor();
}

void ModelDef::SharedDtor() {
  producer_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  producer_version_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete main_module_;
}

void ModelDef::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* ModelDef::descriptor() {
  ::protobuf_caffe2_2fproto_2ftorch_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_caffe2_2fproto_2ftorch_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const ModelDef& ModelDef::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_caffe2_2fproto_2ftorch_2eproto::scc_info_ModelDef.base);
  return *internal_default_instance();
}


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

  tensors_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 7u) {
    if (cached_has_bits & 0x00000001u) {
      producer_name_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      producer_version_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000004u) {
      GOOGLE_DCHECK(main_module_ != NULL);
      main_module_->Clear();
    }
  }
  proto_version_ = GOOGLE_LONGLONG(0);
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool ModelDef::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:torch.ModelDef)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // optional int64 proto_version = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          set_has_proto_version();
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
                 input, &proto_version_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional .torch.ModuleDef main_module = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
               input, mutable_main_module()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string producer_name = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_producer_name()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->producer_name().data(), static_cast<int>(this->producer_name().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.ModelDef.producer_name");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // optional string producer_version = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_producer_version()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->producer_version().data(), static_cast<int>(this->producer_version().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "torch.ModelDef.producer_version");
        } else {
          goto handle_unusual;
        }
        break;
      }

      // repeated .torch.TensorDef tensors = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
                input, add_tensors()));
        } else {
          goto handle_unusual;
        }
        break;
      }

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

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

  cached_has_bits = _has_bits_[0];
  // optional int64 proto_version = 1;
  if (cached_has_bits & 0x00000008u) {
    ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->proto_version(), output);
  }

  // optional .torch.ModuleDef main_module = 2;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->_internal_main_module(), output);
  }

  // optional string producer_name = 3;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->producer_name().data(), static_cast<int>(this->producer_name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ModelDef.producer_name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      3, this->producer_name(), output);
  }

  // optional string producer_version = 4;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->producer_version().data(), static_cast<int>(this->producer_version().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ModelDef.producer_version");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      4, this->producer_version(), output);
  }

  // repeated .torch.TensorDef tensors = 5;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->tensors_size()); i < n; i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      5,
      this->tensors(static_cast<int>(i)),
      output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:torch.ModelDef)
}

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

  cached_has_bits = _has_bits_[0];
  // optional int64 proto_version = 1;
  if (cached_has_bits & 0x00000008u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->proto_version(), target);
  }

  // optional .torch.ModuleDef main_module = 2;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        2, this->_internal_main_module(), deterministic, target);
  }

  // optional string producer_name = 3;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->producer_name().data(), static_cast<int>(this->producer_name().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ModelDef.producer_name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        3, this->producer_name(), target);
  }

  // optional string producer_version = 4;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->producer_version().data(), static_cast<int>(this->producer_version().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "torch.ModelDef.producer_version");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        4, this->producer_version(), target);
  }

  // repeated .torch.TensorDef tensors = 5;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->tensors_size()); i < n; i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      InternalWriteMessageToArray(
        5, this->tensors(static_cast<int>(i)), deterministic, target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:torch.ModelDef)
  return target;
}

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

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  // repeated .torch.TensorDef tensors = 5;
  {
    unsigned int count = static_cast<unsigned int>(this->tensors_size());
    total_size += 1UL * count;
    for (unsigned int i = 0; i < count; i++) {
      total_size +=
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          this->tensors(static_cast<int>(i)));
    }
  }

  if (_has_bits_[0 / 32] & 15u) {
    // optional string producer_name = 3;
    if (has_producer_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->producer_name());
    }

    // optional string producer_version = 4;
    if (has_producer_version()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->producer_version());
    }

    // optional .torch.ModuleDef main_module = 2;
    if (has_main_module()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSize(
          *main_module_);
    }

    // optional int64 proto_version = 1;
    if (has_proto_version()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int64Size(
          this->proto_version());
    }

  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void ModelDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:torch.ModelDef)
  GOOGLE_DCHECK_NE(&from, this);
  const ModelDef* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const ModelDef>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.ModelDef)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.ModelDef)
    MergeFrom(*source);
  }
}

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

  tensors_.MergeFrom(from.tensors_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 15u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_producer_name();
      producer_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.producer_name_);
    }
    if (cached_has_bits & 0x00000002u) {
      set_has_producer_version();
      producer_version_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.producer_version_);
    }
    if (cached_has_bits & 0x00000004u) {
      mutable_main_module()->::torch::ModuleDef::MergeFrom(from.main_module());
    }
    if (cached_has_bits & 0x00000008u) {
      proto_version_ = from.proto_version_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

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

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

bool ModelDef::IsInitialized() const {
  if (has_main_module()) {
    if (!this->main_module_->IsInitialized()) return false;
  }
  return true;
}

void ModelDef::Swap(ModelDef* other) {
  if (other == this) return;
  InternalSwap(other);
}
void ModelDef::InternalSwap(ModelDef* other) {
  using std::swap;
  CastToBase(&tensors_)->InternalSwap(CastToBase(&other->tensors_));
  producer_name_.Swap(&other->producer_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  producer_version_.Swap(&other->producer_version_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(main_module_, other->main_module_);
  swap(proto_version_, other->proto_version_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

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


// @@protoc_insertion_point(namespace_scope)
}  // namespace torch
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::RecordRef* Arena::CreateMaybeMessage< ::torch::RecordRef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::RecordRef >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::TensorDef* Arena::CreateMaybeMessage< ::torch::TensorDef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::TensorDef >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::AttributeDef* Arena::CreateMaybeMessage< ::torch::AttributeDef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::AttributeDef >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::ParameterDef* Arena::CreateMaybeMessage< ::torch::ParameterDef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::ParameterDef >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::ModuleDef* Arena::CreateMaybeMessage< ::torch::ModuleDef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::ModuleDef >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::LibDef* Arena::CreateMaybeMessage< ::torch::LibDef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::LibDef >(arena);
}
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::torch::ModelDef* Arena::CreateMaybeMessage< ::torch::ModelDef >(Arena* arena) {
  return Arena::CreateInternal< ::torch::ModelDef >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)
