1 | // Generated by the protocol buffer compiler. DO NOT EDIT! |
2 | // source: caffe2/proto/torch.proto |
3 | |
4 | #include "caffe2/proto/torch.pb.h" |
5 | |
6 | #include <algorithm> |
7 | |
8 | #include <google/protobuf/io/coded_stream.h> |
9 | #include <google/protobuf/extension_set.h> |
10 | #include <google/protobuf/wire_format_lite.h> |
11 | #include <google/protobuf/descriptor.h> |
12 | #include <google/protobuf/generated_message_reflection.h> |
13 | #include <google/protobuf/reflection_ops.h> |
14 | #include <google/protobuf/wire_format.h> |
15 | // @@protoc_insertion_point(includes) |
16 | #include <google/protobuf/port_def.inc> |
17 | extern PROTOBUF_INTERNAL_EXPORT_caffe2_2fproto_2fcaffe2_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_Argument_caffe2_2fproto_2fcaffe2_2eproto; |
18 | extern PROTOBUF_INTERNAL_EXPORT_caffe2_2fproto_2ftorch_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto; |
19 | extern PROTOBUF_INTERNAL_EXPORT_caffe2_2fproto_2ftorch_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto; |
20 | extern PROTOBUF_INTERNAL_EXPORT_caffe2_2fproto_2ftorch_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto; |
21 | extern PROTOBUF_INTERNAL_EXPORT_caffe2_2fproto_2ftorch_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto; |
22 | extern PROTOBUF_INTERNAL_EXPORT_caffe2_2fproto_2ftorch_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto; |
23 | namespace torch { |
24 | class RecordRefDefaultTypeInternal { |
25 | public: |
26 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<RecordRef> _instance; |
27 | } _RecordRef_default_instance_; |
28 | class TensorDefDefaultTypeInternal { |
29 | public: |
30 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<TensorDef> _instance; |
31 | } _TensorDef_default_instance_; |
32 | class AttributeDefDefaultTypeInternal { |
33 | public: |
34 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<AttributeDef> _instance; |
35 | } _AttributeDef_default_instance_; |
36 | class ParameterDefDefaultTypeInternal { |
37 | public: |
38 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ParameterDef> _instance; |
39 | } _ParameterDef_default_instance_; |
40 | class ModuleDefDefaultTypeInternal { |
41 | public: |
42 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ModuleDef> _instance; |
43 | } _ModuleDef_default_instance_; |
44 | class LibDefDefaultTypeInternal { |
45 | public: |
46 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LibDef> _instance; |
47 | } _LibDef_default_instance_; |
48 | class ModelDefDefaultTypeInternal { |
49 | public: |
50 | ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ModelDef> _instance; |
51 | } _ModelDef_default_instance_; |
52 | } // namespace torch |
53 | static void InitDefaultsscc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto() { |
54 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
55 | |
56 | { |
57 | void* ptr = &::torch::_AttributeDef_default_instance_; |
58 | new (ptr) ::torch::AttributeDef(); |
59 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
60 | } |
61 | ::torch::AttributeDef::InitAsDefaultInstance(); |
62 | } |
63 | |
64 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto = |
65 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto}, {}}; |
66 | |
67 | static void InitDefaultsscc_info_LibDef_caffe2_2fproto_2ftorch_2eproto() { |
68 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
69 | |
70 | { |
71 | void* ptr = &::torch::_LibDef_default_instance_; |
72 | new (ptr) ::torch::LibDef(); |
73 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
74 | } |
75 | ::torch::LibDef::InitAsDefaultInstance(); |
76 | } |
77 | |
78 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_LibDef_caffe2_2fproto_2ftorch_2eproto = |
79 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_LibDef_caffe2_2fproto_2ftorch_2eproto}, { |
80 | &scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto.base,}}; |
81 | |
82 | static void InitDefaultsscc_info_ModelDef_caffe2_2fproto_2ftorch_2eproto() { |
83 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
84 | |
85 | { |
86 | void* ptr = &::torch::_ModelDef_default_instance_; |
87 | new (ptr) ::torch::ModelDef(); |
88 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
89 | } |
90 | ::torch::ModelDef::InitAsDefaultInstance(); |
91 | } |
92 | |
93 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_ModelDef_caffe2_2fproto_2ftorch_2eproto = |
94 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_ModelDef_caffe2_2fproto_2ftorch_2eproto}, { |
95 | &scc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto.base, |
96 | &scc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto.base,}}; |
97 | |
98 | static void InitDefaultsscc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto() { |
99 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
100 | |
101 | { |
102 | void* ptr = &::torch::_ModuleDef_default_instance_; |
103 | new (ptr) ::torch::ModuleDef(); |
104 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
105 | } |
106 | ::torch::ModuleDef::InitAsDefaultInstance(); |
107 | } |
108 | |
109 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto = |
110 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 4, 0, InitDefaultsscc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto}, { |
111 | &scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto.base, |
112 | &scc_info_Argument_caffe2_2fproto_2fcaffe2_2eproto.base, |
113 | &scc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto.base, |
114 | &scc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto.base,}}; |
115 | |
116 | static void InitDefaultsscc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto() { |
117 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
118 | |
119 | { |
120 | void* ptr = &::torch::_ParameterDef_default_instance_; |
121 | new (ptr) ::torch::ParameterDef(); |
122 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
123 | } |
124 | ::torch::ParameterDef::InitAsDefaultInstance(); |
125 | } |
126 | |
127 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto = |
128 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto}, {}}; |
129 | |
130 | static void InitDefaultsscc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto() { |
131 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
132 | |
133 | { |
134 | void* ptr = &::torch::_RecordRef_default_instance_; |
135 | new (ptr) ::torch::RecordRef(); |
136 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
137 | } |
138 | ::torch::RecordRef::InitAsDefaultInstance(); |
139 | } |
140 | |
141 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto = |
142 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto}, {}}; |
143 | |
144 | static void InitDefaultsscc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto() { |
145 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
146 | |
147 | { |
148 | void* ptr = &::torch::_TensorDef_default_instance_; |
149 | new (ptr) ::torch::TensorDef(); |
150 | ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); |
151 | } |
152 | ::torch::TensorDef::InitAsDefaultInstance(); |
153 | } |
154 | |
155 | TORCH_API ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto = |
156 | {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto}, { |
157 | &scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto.base,}}; |
158 | |
159 | static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_caffe2_2fproto_2ftorch_2eproto[7]; |
160 | static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_caffe2_2fproto_2ftorch_2eproto[1]; |
161 | static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_caffe2_2fproto_2ftorch_2eproto = nullptr; |
162 | |
163 | const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_caffe2_2fproto_2ftorch_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { |
164 | PROTOBUF_FIELD_OFFSET(::torch::RecordRef, _has_bits_), |
165 | PROTOBUF_FIELD_OFFSET(::torch::RecordRef, _internal_metadata_), |
166 | ~0u, // no _extensions_ |
167 | ~0u, // no _oneof_case_ |
168 | ~0u, // no _weak_field_map_ |
169 | PROTOBUF_FIELD_OFFSET(::torch::RecordRef, key_), |
170 | 0, |
171 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, _has_bits_), |
172 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, _internal_metadata_), |
173 | ~0u, // no _extensions_ |
174 | ~0u, // no _oneof_case_ |
175 | ~0u, // no _weak_field_map_ |
176 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, dims_), |
177 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, offset_), |
178 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, strides_), |
179 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, requires_grad_), |
180 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, data_type_), |
181 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, data_), |
182 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, device_), |
183 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, is_quantized_), |
184 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, scale_), |
185 | PROTOBUF_FIELD_OFFSET(::torch::TensorDef, zero_point_), |
186 | ~0u, |
187 | 2, |
188 | ~0u, |
189 | 4, |
190 | 3, |
191 | 1, |
192 | 0, |
193 | 5, |
194 | 6, |
195 | 7, |
196 | PROTOBUF_FIELD_OFFSET(::torch::AttributeDef, _has_bits_), |
197 | PROTOBUF_FIELD_OFFSET(::torch::AttributeDef, _internal_metadata_), |
198 | ~0u, // no _extensions_ |
199 | ~0u, // no _oneof_case_ |
200 | ~0u, // no _weak_field_map_ |
201 | PROTOBUF_FIELD_OFFSET(::torch::AttributeDef, type_), |
202 | PROTOBUF_FIELD_OFFSET(::torch::AttributeDef, name_), |
203 | PROTOBUF_FIELD_OFFSET(::torch::AttributeDef, id_), |
204 | 0, |
205 | 1, |
206 | 2, |
207 | PROTOBUF_FIELD_OFFSET(::torch::ParameterDef, _has_bits_), |
208 | PROTOBUF_FIELD_OFFSET(::torch::ParameterDef, _internal_metadata_), |
209 | ~0u, // no _extensions_ |
210 | ~0u, // no _oneof_case_ |
211 | ~0u, // no _weak_field_map_ |
212 | PROTOBUF_FIELD_OFFSET(::torch::ParameterDef, is_buffer_), |
213 | PROTOBUF_FIELD_OFFSET(::torch::ParameterDef, tensor_id_), |
214 | PROTOBUF_FIELD_OFFSET(::torch::ParameterDef, name_), |
215 | 2, |
216 | 1, |
217 | 0, |
218 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, _has_bits_), |
219 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, _internal_metadata_), |
220 | ~0u, // no _extensions_ |
221 | ~0u, // no _oneof_case_ |
222 | ~0u, // no _weak_field_map_ |
223 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, submodules_), |
224 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, torchscript_arena_), |
225 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, caffe2_nets_), |
226 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, pickle_arena_), |
227 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, cpp_arena_), |
228 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, parameters_), |
229 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, name_), |
230 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, optimize_), |
231 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, attributes_), |
232 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, get_state_attribute_id_), |
233 | PROTOBUF_FIELD_OFFSET(::torch::ModuleDef, torchscript_debug_arena_), |
234 | ~0u, |
235 | 1, |
236 | ~0u, |
237 | 2, |
238 | 3, |
239 | ~0u, |
240 | 0, |
241 | 6, |
242 | ~0u, |
243 | 5, |
244 | 4, |
245 | PROTOBUF_FIELD_OFFSET(::torch::LibDef, _has_bits_), |
246 | PROTOBUF_FIELD_OFFSET(::torch::LibDef, _internal_metadata_), |
247 | ~0u, // no _extensions_ |
248 | ~0u, // no _oneof_case_ |
249 | ~0u, // no _weak_field_map_ |
250 | PROTOBUF_FIELD_OFFSET(::torch::LibDef, torchscript_arena_), |
251 | 0, |
252 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, _has_bits_), |
253 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, _internal_metadata_), |
254 | ~0u, // no _extensions_ |
255 | ~0u, // no _oneof_case_ |
256 | ~0u, // no _weak_field_map_ |
257 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, proto_version_), |
258 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, main_module_), |
259 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, producer_name_), |
260 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, producer_version_), |
261 | PROTOBUF_FIELD_OFFSET(::torch::ModelDef, tensors_), |
262 | 3, |
263 | 2, |
264 | 0, |
265 | 1, |
266 | ~0u, |
267 | }; |
268 | static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { |
269 | { 0, 6, sizeof(::torch::RecordRef)}, |
270 | { 7, 22, sizeof(::torch::TensorDef)}, |
271 | { 32, 40, sizeof(::torch::AttributeDef)}, |
272 | { 43, 51, sizeof(::torch::ParameterDef)}, |
273 | { 54, 70, sizeof(::torch::ModuleDef)}, |
274 | { 81, 87, sizeof(::torch::LibDef)}, |
275 | { 88, 98, sizeof(::torch::ModelDef)}, |
276 | }; |
277 | |
278 | static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { |
279 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_RecordRef_default_instance_), |
280 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_TensorDef_default_instance_), |
281 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_AttributeDef_default_instance_), |
282 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_ParameterDef_default_instance_), |
283 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_ModuleDef_default_instance_), |
284 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_LibDef_default_instance_), |
285 | reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::torch::_ModelDef_default_instance_), |
286 | }; |
287 | |
288 | const char descriptor_table_protodef_caffe2_2fproto_2ftorch_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = |
289 | "\n\030caffe2/proto/torch.proto\022\005torch\032\031caffe" |
290 | "2/proto/caffe2.proto\"\030\n\tRecordRef\022\013\n\003key" |
291 | "\030\001 \001(\t\"\353\001\n\tTensorDef\022\014\n\004dims\030\001 \003(\003\022\016\n\006of" |
292 | "fset\030\002 \001(\003\022\017\n\007strides\030\003 \003(\003\022\025\n\rrequires_" |
293 | "grad\030\004 \001(\010\022/\n\tdata_type\030\005 \001(\0162\034.caffe2.T" |
294 | "ensorProto.DataType\022\036\n\004data\030\006 \001(\0132\020.torc" |
295 | "h.RecordRef\022\016\n\006device\030\007 \001(\t\022\024\n\014is_quanti" |
296 | "zed\030\010 \001(\010\022\r\n\005scale\030\t \001(\001\022\022\n\nzero_point\030\n" |
297 | " \001(\003\"6\n\014AttributeDef\022\014\n\004type\030\001 \002(\t\022\014\n\004na" |
298 | "me\030\002 \002(\t\022\n\n\002id\030\003 \002(\003\"B\n\014ParameterDef\022\021\n\t" |
299 | "is_buffer\030\001 \001(\010\022\021\n\ttensor_id\030\002 \001(\003\022\014\n\004na" |
300 | "me\030\003 \001(\t\"\225\003\n\tModuleDef\022$\n\nsubmodules\030\001 \003" |
301 | "(\0132\020.torch.ModuleDef\022+\n\021torchscript_aren" |
302 | "a\030\002 \001(\0132\020.torch.RecordRef\022#\n\013caffe2_nets" |
303 | "\030\003 \003(\0132\016.caffe2.NetDef\022&\n\014pickle_arena\030\004" |
304 | " \001(\0132\020.torch.RecordRef\022#\n\tcpp_arena\030\005 \001(" |
305 | "\0132\020.torch.RecordRef\022\'\n\nparameters\030\006 \003(\0132" |
306 | "\023.torch.ParameterDef\022\014\n\004name\030\007 \001(\t\022\020\n\010op" |
307 | "timize\030\010 \001(\010\022\'\n\nattributes\030\t \003(\0132\023.torch" |
308 | ".AttributeDef\022\036\n\026get_state_attribute_id\030" |
309 | "\n \001(\003\0221\n\027torchscript_debug_arena\030\013 \001(\0132\020" |
310 | ".torch.RecordRef\"5\n\006LibDef\022+\n\021torchscrip" |
311 | "t_arena\030\001 \001(\0132\020.torch.RecordRef\"\250\001\n\010Mode" |
312 | "lDef\022\025\n\rproto_version\030\001 \001(\003\022%\n\013main_modu" |
313 | "le\030\002 \001(\0132\020.torch.ModuleDef\022\025\n\rproducer_n" |
314 | "ame\030\003 \001(\t\022\030\n\020producer_version\030\004 \001(\t\022!\n\007t" |
315 | "ensors\030\005 \003(\0132\020.torch.TensorDefJ\004\010\t\020\nR\004li" |
316 | "bs*(\n\014ProtoVersion\022\030\n\024PROTO_VERSION_NEWE" |
317 | "ST\020\006" |
318 | ; |
319 | static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_caffe2_2fproto_2ftorch_2eproto_deps[1] = { |
320 | &::descriptor_table_caffe2_2fproto_2fcaffe2_2eproto, |
321 | }; |
322 | static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_caffe2_2fproto_2ftorch_2eproto_sccs[7] = { |
323 | &scc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto.base, |
324 | &scc_info_LibDef_caffe2_2fproto_2ftorch_2eproto.base, |
325 | &scc_info_ModelDef_caffe2_2fproto_2ftorch_2eproto.base, |
326 | &scc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto.base, |
327 | &scc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto.base, |
328 | &scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto.base, |
329 | &scc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto.base, |
330 | }; |
331 | static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_caffe2_2fproto_2ftorch_2eproto_once; |
332 | const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_caffe2_2fproto_2ftorch_2eproto = { |
333 | false, false, descriptor_table_protodef_caffe2_2fproto_2ftorch_2eproto, "caffe2/proto/torch.proto" , 1124, |
334 | &descriptor_table_caffe2_2fproto_2ftorch_2eproto_once, descriptor_table_caffe2_2fproto_2ftorch_2eproto_sccs, descriptor_table_caffe2_2fproto_2ftorch_2eproto_deps, 7, 1, |
335 | schemas, file_default_instances, TableStruct_caffe2_2fproto_2ftorch_2eproto::offsets, |
336 | file_level_metadata_caffe2_2fproto_2ftorch_2eproto, 7, file_level_enum_descriptors_caffe2_2fproto_2ftorch_2eproto, file_level_service_descriptors_caffe2_2fproto_2ftorch_2eproto, |
337 | }; |
338 | |
339 | // Force running AddDescriptors() at dynamic initialization time. |
340 | static bool dynamic_init_dummy_caffe2_2fproto_2ftorch_2eproto = (static_cast<void>(::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_caffe2_2fproto_2ftorch_2eproto)), true); |
341 | namespace torch { |
342 | const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ProtoVersion_descriptor() { |
343 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_caffe2_2fproto_2ftorch_2eproto); |
344 | return file_level_enum_descriptors_caffe2_2fproto_2ftorch_2eproto[0]; |
345 | } |
346 | bool ProtoVersion_IsValid(int value) { |
347 | switch (value) { |
348 | case 6: |
349 | return true; |
350 | default: |
351 | return false; |
352 | } |
353 | } |
354 | |
355 | |
356 | // =================================================================== |
357 | |
358 | void RecordRef::InitAsDefaultInstance() { |
359 | } |
360 | class RecordRef::_Internal { |
361 | public: |
362 | using HasBits = decltype(std::declval<RecordRef>()._has_bits_); |
363 | static void set_has_key(HasBits* has_bits) { |
364 | (*has_bits)[0] |= 1u; |
365 | } |
366 | }; |
367 | |
368 | RecordRef::RecordRef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
369 | : ::PROTOBUF_NAMESPACE_ID::Message(arena) { |
370 | SharedCtor(); |
371 | RegisterArenaDtor(arena); |
372 | // @@protoc_insertion_point(arena_constructor:torch.RecordRef) |
373 | } |
374 | RecordRef::RecordRef(const RecordRef& from) |
375 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
376 | _has_bits_(from._has_bits_) { |
377 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
378 | key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
379 | if (from._internal_has_key()) { |
380 | key_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_key(), |
381 | GetArena()); |
382 | } |
383 | // @@protoc_insertion_point(copy_constructor:torch.RecordRef) |
384 | } |
385 | |
386 | void RecordRef::SharedCtor() { |
387 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto.base); |
388 | key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
389 | } |
390 | |
391 | RecordRef::~RecordRef() { |
392 | // @@protoc_insertion_point(destructor:torch.RecordRef) |
393 | SharedDtor(); |
394 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
395 | } |
396 | |
397 | void RecordRef::SharedDtor() { |
398 | GOOGLE_DCHECK(GetArena() == nullptr); |
399 | key_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
400 | } |
401 | |
402 | void RecordRef::ArenaDtor(void* object) { |
403 | RecordRef* _this = reinterpret_cast< RecordRef* >(object); |
404 | (void)_this; |
405 | } |
406 | void RecordRef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
407 | } |
408 | void RecordRef::SetCachedSize(int size) const { |
409 | _cached_size_.Set(size); |
410 | } |
411 | const RecordRef& RecordRef::default_instance() { |
412 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_RecordRef_caffe2_2fproto_2ftorch_2eproto.base); |
413 | return *internal_default_instance(); |
414 | } |
415 | |
416 | |
417 | void RecordRef::Clear() { |
418 | // @@protoc_insertion_point(message_clear_start:torch.RecordRef) |
419 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
420 | // Prevent compiler warnings about cached_has_bits being unused |
421 | (void) cached_has_bits; |
422 | |
423 | cached_has_bits = _has_bits_[0]; |
424 | if (cached_has_bits & 0x00000001u) { |
425 | key_.ClearNonDefaultToEmpty(); |
426 | } |
427 | _has_bits_.Clear(); |
428 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
429 | } |
430 | |
431 | const char* RecordRef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
432 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
433 | _Internal::HasBits has_bits{}; |
434 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
435 | while (!ctx->Done(&ptr)) { |
436 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
437 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
438 | CHK_(ptr); |
439 | switch (tag >> 3) { |
440 | // optional string key = 1; |
441 | case 1: |
442 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
443 | auto str = _internal_mutable_key(); |
444 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
445 | #ifndef NDEBUG |
446 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.RecordRef.key" ); |
447 | #endif // !NDEBUG |
448 | CHK_(ptr); |
449 | } else goto handle_unusual; |
450 | continue; |
451 | default: { |
452 | handle_unusual: |
453 | if ((tag & 7) == 4 || tag == 0) { |
454 | ctx->SetLastTag(tag); |
455 | goto success; |
456 | } |
457 | ptr = UnknownFieldParse(tag, |
458 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
459 | ptr, ctx); |
460 | CHK_(ptr != nullptr); |
461 | continue; |
462 | } |
463 | } // switch |
464 | } // while |
465 | success: |
466 | _has_bits_.Or(has_bits); |
467 | return ptr; |
468 | failure: |
469 | ptr = nullptr; |
470 | goto success; |
471 | #undef CHK_ |
472 | } |
473 | |
474 | ::PROTOBUF_NAMESPACE_ID::uint8* RecordRef::_InternalSerialize( |
475 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
476 | // @@protoc_insertion_point(serialize_to_array_start:torch.RecordRef) |
477 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
478 | (void) cached_has_bits; |
479 | |
480 | cached_has_bits = _has_bits_[0]; |
481 | // optional string key = 1; |
482 | if (cached_has_bits & 0x00000001u) { |
483 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
484 | this->_internal_key().data(), static_cast<int>(this->_internal_key().length()), |
485 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
486 | "torch.RecordRef.key" ); |
487 | target = stream->WriteStringMaybeAliased( |
488 | 1, this->_internal_key(), target); |
489 | } |
490 | |
491 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
492 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
493 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
494 | } |
495 | // @@protoc_insertion_point(serialize_to_array_end:torch.RecordRef) |
496 | return target; |
497 | } |
498 | |
499 | size_t RecordRef::ByteSizeLong() const { |
500 | // @@protoc_insertion_point(message_byte_size_start:torch.RecordRef) |
501 | size_t total_size = 0; |
502 | |
503 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
504 | // Prevent compiler warnings about cached_has_bits being unused |
505 | (void) cached_has_bits; |
506 | |
507 | // optional string key = 1; |
508 | cached_has_bits = _has_bits_[0]; |
509 | if (cached_has_bits & 0x00000001u) { |
510 | total_size += 1 + |
511 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
512 | this->_internal_key()); |
513 | } |
514 | |
515 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
516 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
517 | _internal_metadata_, total_size, &_cached_size_); |
518 | } |
519 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
520 | SetCachedSize(cached_size); |
521 | return total_size; |
522 | } |
523 | |
524 | void RecordRef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
525 | // @@protoc_insertion_point(generalized_merge_from_start:torch.RecordRef) |
526 | GOOGLE_DCHECK_NE(&from, this); |
527 | const RecordRef* source = |
528 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<RecordRef>( |
529 | &from); |
530 | if (source == nullptr) { |
531 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.RecordRef) |
532 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
533 | } else { |
534 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.RecordRef) |
535 | MergeFrom(*source); |
536 | } |
537 | } |
538 | |
539 | void RecordRef::MergeFrom(const RecordRef& from) { |
540 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.RecordRef) |
541 | GOOGLE_DCHECK_NE(&from, this); |
542 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
543 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
544 | (void) cached_has_bits; |
545 | |
546 | if (from._internal_has_key()) { |
547 | _internal_set_key(from._internal_key()); |
548 | } |
549 | } |
550 | |
551 | void RecordRef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
552 | // @@protoc_insertion_point(generalized_copy_from_start:torch.RecordRef) |
553 | if (&from == this) return; |
554 | Clear(); |
555 | MergeFrom(from); |
556 | } |
557 | |
558 | void RecordRef::CopyFrom(const RecordRef& from) { |
559 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.RecordRef) |
560 | if (&from == this) return; |
561 | Clear(); |
562 | MergeFrom(from); |
563 | } |
564 | |
565 | bool RecordRef::IsInitialized() const { |
566 | return true; |
567 | } |
568 | |
569 | void RecordRef::InternalSwap(RecordRef* other) { |
570 | using std::swap; |
571 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
572 | swap(_has_bits_[0], other->_has_bits_[0]); |
573 | key_.Swap(&other->key_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
574 | } |
575 | |
576 | ::PROTOBUF_NAMESPACE_ID::Metadata RecordRef::GetMetadata() const { |
577 | return GetMetadataStatic(); |
578 | } |
579 | |
580 | |
581 | // =================================================================== |
582 | |
583 | void TensorDef::InitAsDefaultInstance() { |
584 | ::torch::_TensorDef_default_instance_._instance.get_mutable()->data_ = const_cast< ::torch::RecordRef*>( |
585 | ::torch::RecordRef::internal_default_instance()); |
586 | } |
587 | class TensorDef::_Internal { |
588 | public: |
589 | using HasBits = decltype(std::declval<TensorDef>()._has_bits_); |
590 | static void set_has_offset(HasBits* has_bits) { |
591 | (*has_bits)[0] |= 4u; |
592 | } |
593 | static void set_has_requires_grad(HasBits* has_bits) { |
594 | (*has_bits)[0] |= 16u; |
595 | } |
596 | static void set_has_data_type(HasBits* has_bits) { |
597 | (*has_bits)[0] |= 8u; |
598 | } |
599 | static const ::torch::RecordRef& data(const TensorDef* msg); |
600 | static void set_has_data(HasBits* has_bits) { |
601 | (*has_bits)[0] |= 2u; |
602 | } |
603 | static void set_has_device(HasBits* has_bits) { |
604 | (*has_bits)[0] |= 1u; |
605 | } |
606 | static void set_has_is_quantized(HasBits* has_bits) { |
607 | (*has_bits)[0] |= 32u; |
608 | } |
609 | static void set_has_scale(HasBits* has_bits) { |
610 | (*has_bits)[0] |= 64u; |
611 | } |
612 | static void set_has_zero_point(HasBits* has_bits) { |
613 | (*has_bits)[0] |= 128u; |
614 | } |
615 | }; |
616 | |
617 | const ::torch::RecordRef& |
618 | TensorDef::_Internal::data(const TensorDef* msg) { |
619 | return *msg->data_; |
620 | } |
621 | TensorDef::TensorDef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
622 | : ::PROTOBUF_NAMESPACE_ID::Message(arena), |
623 | dims_(arena), |
624 | strides_(arena) { |
625 | SharedCtor(); |
626 | RegisterArenaDtor(arena); |
627 | // @@protoc_insertion_point(arena_constructor:torch.TensorDef) |
628 | } |
629 | TensorDef::TensorDef(const TensorDef& from) |
630 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
631 | _has_bits_(from._has_bits_), |
632 | dims_(from.dims_), |
633 | strides_(from.strides_) { |
634 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
635 | device_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
636 | if (from._internal_has_device()) { |
637 | device_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_device(), |
638 | GetArena()); |
639 | } |
640 | if (from._internal_has_data()) { |
641 | data_ = new ::torch::RecordRef(*from.data_); |
642 | } else { |
643 | data_ = nullptr; |
644 | } |
645 | ::memcpy(&offset_, &from.offset_, |
646 | static_cast<size_t>(reinterpret_cast<char*>(&zero_point_) - |
647 | reinterpret_cast<char*>(&offset_)) + sizeof(zero_point_)); |
648 | // @@protoc_insertion_point(copy_constructor:torch.TensorDef) |
649 | } |
650 | |
651 | void TensorDef::SharedCtor() { |
652 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto.base); |
653 | device_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
654 | ::memset(&data_, 0, static_cast<size_t>( |
655 | reinterpret_cast<char*>(&zero_point_) - |
656 | reinterpret_cast<char*>(&data_)) + sizeof(zero_point_)); |
657 | } |
658 | |
659 | TensorDef::~TensorDef() { |
660 | // @@protoc_insertion_point(destructor:torch.TensorDef) |
661 | SharedDtor(); |
662 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
663 | } |
664 | |
665 | void TensorDef::SharedDtor() { |
666 | GOOGLE_DCHECK(GetArena() == nullptr); |
667 | device_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
668 | if (this != internal_default_instance()) delete data_; |
669 | } |
670 | |
671 | void TensorDef::ArenaDtor(void* object) { |
672 | TensorDef* _this = reinterpret_cast< TensorDef* >(object); |
673 | (void)_this; |
674 | } |
675 | void TensorDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
676 | } |
677 | void TensorDef::SetCachedSize(int size) const { |
678 | _cached_size_.Set(size); |
679 | } |
680 | const TensorDef& TensorDef::default_instance() { |
681 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_TensorDef_caffe2_2fproto_2ftorch_2eproto.base); |
682 | return *internal_default_instance(); |
683 | } |
684 | |
685 | |
686 | void TensorDef::Clear() { |
687 | // @@protoc_insertion_point(message_clear_start:torch.TensorDef) |
688 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
689 | // Prevent compiler warnings about cached_has_bits being unused |
690 | (void) cached_has_bits; |
691 | |
692 | dims_.Clear(); |
693 | strides_.Clear(); |
694 | cached_has_bits = _has_bits_[0]; |
695 | if (cached_has_bits & 0x00000003u) { |
696 | if (cached_has_bits & 0x00000001u) { |
697 | device_.ClearNonDefaultToEmpty(); |
698 | } |
699 | if (cached_has_bits & 0x00000002u) { |
700 | GOOGLE_DCHECK(data_ != nullptr); |
701 | data_->Clear(); |
702 | } |
703 | } |
704 | if (cached_has_bits & 0x000000fcu) { |
705 | ::memset(&offset_, 0, static_cast<size_t>( |
706 | reinterpret_cast<char*>(&zero_point_) - |
707 | reinterpret_cast<char*>(&offset_)) + sizeof(zero_point_)); |
708 | } |
709 | _has_bits_.Clear(); |
710 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
711 | } |
712 | |
713 | const char* TensorDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
714 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
715 | _Internal::HasBits has_bits{}; |
716 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
717 | while (!ctx->Done(&ptr)) { |
718 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
719 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
720 | CHK_(ptr); |
721 | switch (tag >> 3) { |
722 | // repeated int64 dims = 1; |
723 | case 1: |
724 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { |
725 | ptr -= 1; |
726 | do { |
727 | ptr += 1; |
728 | _internal_add_dims(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); |
729 | CHK_(ptr); |
730 | if (!ctx->DataAvailable(ptr)) break; |
731 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<8>(ptr)); |
732 | } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10) { |
733 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(_internal_mutable_dims(), ptr, ctx); |
734 | CHK_(ptr); |
735 | } else goto handle_unusual; |
736 | continue; |
737 | // optional int64 offset = 2; |
738 | case 2: |
739 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { |
740 | _Internal::set_has_offset(&has_bits); |
741 | offset_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
742 | CHK_(ptr); |
743 | } else goto handle_unusual; |
744 | continue; |
745 | // repeated int64 strides = 3; |
746 | case 3: |
747 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { |
748 | ptr -= 1; |
749 | do { |
750 | ptr += 1; |
751 | _internal_add_strides(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr)); |
752 | CHK_(ptr); |
753 | if (!ctx->DataAvailable(ptr)) break; |
754 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<24>(ptr)); |
755 | } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26) { |
756 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(_internal_mutable_strides(), ptr, ctx); |
757 | CHK_(ptr); |
758 | } else goto handle_unusual; |
759 | continue; |
760 | // optional bool requires_grad = 4; |
761 | case 4: |
762 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { |
763 | _Internal::set_has_requires_grad(&has_bits); |
764 | requires_grad_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
765 | CHK_(ptr); |
766 | } else goto handle_unusual; |
767 | continue; |
768 | // optional .caffe2.TensorProto.DataType data_type = 5; |
769 | case 5: |
770 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { |
771 | ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
772 | CHK_(ptr); |
773 | if (PROTOBUF_PREDICT_TRUE(::caffe2::TensorProto_DataType_IsValid(val))) { |
774 | _internal_set_data_type(static_cast<::caffe2::TensorProto_DataType>(val)); |
775 | } else { |
776 | ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(5, val, mutable_unknown_fields()); |
777 | } |
778 | } else goto handle_unusual; |
779 | continue; |
780 | // optional .torch.RecordRef data = 6; |
781 | case 6: |
782 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { |
783 | ptr = ctx->ParseMessage(_internal_mutable_data(), ptr); |
784 | CHK_(ptr); |
785 | } else goto handle_unusual; |
786 | continue; |
787 | // optional string device = 7; |
788 | case 7: |
789 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { |
790 | auto str = _internal_mutable_device(); |
791 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
792 | #ifndef NDEBUG |
793 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.TensorDef.device" ); |
794 | #endif // !NDEBUG |
795 | CHK_(ptr); |
796 | } else goto handle_unusual; |
797 | continue; |
798 | // optional bool is_quantized = 8; |
799 | case 8: |
800 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { |
801 | _Internal::set_has_is_quantized(&has_bits); |
802 | is_quantized_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
803 | CHK_(ptr); |
804 | } else goto handle_unusual; |
805 | continue; |
806 | // optional double scale = 9; |
807 | case 9: |
808 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 73)) { |
809 | _Internal::set_has_scale(&has_bits); |
810 | scale_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); |
811 | ptr += sizeof(double); |
812 | } else goto handle_unusual; |
813 | continue; |
814 | // optional int64 zero_point = 10; |
815 | case 10: |
816 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) { |
817 | _Internal::set_has_zero_point(&has_bits); |
818 | zero_point_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
819 | CHK_(ptr); |
820 | } else goto handle_unusual; |
821 | continue; |
822 | default: { |
823 | handle_unusual: |
824 | if ((tag & 7) == 4 || tag == 0) { |
825 | ctx->SetLastTag(tag); |
826 | goto success; |
827 | } |
828 | ptr = UnknownFieldParse(tag, |
829 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
830 | ptr, ctx); |
831 | CHK_(ptr != nullptr); |
832 | continue; |
833 | } |
834 | } // switch |
835 | } // while |
836 | success: |
837 | _has_bits_.Or(has_bits); |
838 | return ptr; |
839 | failure: |
840 | ptr = nullptr; |
841 | goto success; |
842 | #undef CHK_ |
843 | } |
844 | |
845 | ::PROTOBUF_NAMESPACE_ID::uint8* TensorDef::_InternalSerialize( |
846 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
847 | // @@protoc_insertion_point(serialize_to_array_start:torch.TensorDef) |
848 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
849 | (void) cached_has_bits; |
850 | |
851 | // repeated int64 dims = 1; |
852 | for (int i = 0, n = this->_internal_dims_size(); i < n; i++) { |
853 | target = stream->EnsureSpace(target); |
854 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_dims(i), target); |
855 | } |
856 | |
857 | cached_has_bits = _has_bits_[0]; |
858 | // optional int64 offset = 2; |
859 | if (cached_has_bits & 0x00000004u) { |
860 | target = stream->EnsureSpace(target); |
861 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_offset(), target); |
862 | } |
863 | |
864 | // repeated int64 strides = 3; |
865 | for (int i = 0, n = this->_internal_strides_size(); i < n; i++) { |
866 | target = stream->EnsureSpace(target); |
867 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_strides(i), target); |
868 | } |
869 | |
870 | // optional bool requires_grad = 4; |
871 | if (cached_has_bits & 0x00000010u) { |
872 | target = stream->EnsureSpace(target); |
873 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_requires_grad(), target); |
874 | } |
875 | |
876 | // optional .caffe2.TensorProto.DataType data_type = 5; |
877 | if (cached_has_bits & 0x00000008u) { |
878 | target = stream->EnsureSpace(target); |
879 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( |
880 | 5, this->_internal_data_type(), target); |
881 | } |
882 | |
883 | // optional .torch.RecordRef data = 6; |
884 | if (cached_has_bits & 0x00000002u) { |
885 | target = stream->EnsureSpace(target); |
886 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
887 | InternalWriteMessage( |
888 | 6, _Internal::data(this), target, stream); |
889 | } |
890 | |
891 | // optional string device = 7; |
892 | if (cached_has_bits & 0x00000001u) { |
893 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
894 | this->_internal_device().data(), static_cast<int>(this->_internal_device().length()), |
895 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
896 | "torch.TensorDef.device" ); |
897 | target = stream->WriteStringMaybeAliased( |
898 | 7, this->_internal_device(), target); |
899 | } |
900 | |
901 | // optional bool is_quantized = 8; |
902 | if (cached_has_bits & 0x00000020u) { |
903 | target = stream->EnsureSpace(target); |
904 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_is_quantized(), target); |
905 | } |
906 | |
907 | // optional double scale = 9; |
908 | if (cached_has_bits & 0x00000040u) { |
909 | target = stream->EnsureSpace(target); |
910 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(9, this->_internal_scale(), target); |
911 | } |
912 | |
913 | // optional int64 zero_point = 10; |
914 | if (cached_has_bits & 0x00000080u) { |
915 | target = stream->EnsureSpace(target); |
916 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(10, this->_internal_zero_point(), target); |
917 | } |
918 | |
919 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
920 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
921 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
922 | } |
923 | // @@protoc_insertion_point(serialize_to_array_end:torch.TensorDef) |
924 | return target; |
925 | } |
926 | |
927 | size_t TensorDef::ByteSizeLong() const { |
928 | // @@protoc_insertion_point(message_byte_size_start:torch.TensorDef) |
929 | size_t total_size = 0; |
930 | |
931 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
932 | // Prevent compiler warnings about cached_has_bits being unused |
933 | (void) cached_has_bits; |
934 | |
935 | // repeated int64 dims = 1; |
936 | { |
937 | size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
938 | Int64Size(this->dims_); |
939 | total_size += 1 * |
940 | ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_dims_size()); |
941 | total_size += data_size; |
942 | } |
943 | |
944 | // repeated int64 strides = 3; |
945 | { |
946 | size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
947 | Int64Size(this->strides_); |
948 | total_size += 1 * |
949 | ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_strides_size()); |
950 | total_size += data_size; |
951 | } |
952 | |
953 | cached_has_bits = _has_bits_[0]; |
954 | if (cached_has_bits & 0x000000ffu) { |
955 | // optional string device = 7; |
956 | if (cached_has_bits & 0x00000001u) { |
957 | total_size += 1 + |
958 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
959 | this->_internal_device()); |
960 | } |
961 | |
962 | // optional .torch.RecordRef data = 6; |
963 | if (cached_has_bits & 0x00000002u) { |
964 | total_size += 1 + |
965 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
966 | *data_); |
967 | } |
968 | |
969 | // optional int64 offset = 2; |
970 | if (cached_has_bits & 0x00000004u) { |
971 | total_size += 1 + |
972 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
973 | this->_internal_offset()); |
974 | } |
975 | |
976 | // optional .caffe2.TensorProto.DataType data_type = 5; |
977 | if (cached_has_bits & 0x00000008u) { |
978 | total_size += 1 + |
979 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_data_type()); |
980 | } |
981 | |
982 | // optional bool requires_grad = 4; |
983 | if (cached_has_bits & 0x00000010u) { |
984 | total_size += 1 + 1; |
985 | } |
986 | |
987 | // optional bool is_quantized = 8; |
988 | if (cached_has_bits & 0x00000020u) { |
989 | total_size += 1 + 1; |
990 | } |
991 | |
992 | // optional double scale = 9; |
993 | if (cached_has_bits & 0x00000040u) { |
994 | total_size += 1 + 8; |
995 | } |
996 | |
997 | // optional int64 zero_point = 10; |
998 | if (cached_has_bits & 0x00000080u) { |
999 | total_size += 1 + |
1000 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
1001 | this->_internal_zero_point()); |
1002 | } |
1003 | |
1004 | } |
1005 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1006 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
1007 | _internal_metadata_, total_size, &_cached_size_); |
1008 | } |
1009 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
1010 | SetCachedSize(cached_size); |
1011 | return total_size; |
1012 | } |
1013 | |
1014 | void TensorDef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
1015 | // @@protoc_insertion_point(generalized_merge_from_start:torch.TensorDef) |
1016 | GOOGLE_DCHECK_NE(&from, this); |
1017 | const TensorDef* source = |
1018 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TensorDef>( |
1019 | &from); |
1020 | if (source == nullptr) { |
1021 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.TensorDef) |
1022 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
1023 | } else { |
1024 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.TensorDef) |
1025 | MergeFrom(*source); |
1026 | } |
1027 | } |
1028 | |
1029 | void TensorDef::MergeFrom(const TensorDef& from) { |
1030 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.TensorDef) |
1031 | GOOGLE_DCHECK_NE(&from, this); |
1032 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1033 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1034 | (void) cached_has_bits; |
1035 | |
1036 | dims_.MergeFrom(from.dims_); |
1037 | strides_.MergeFrom(from.strides_); |
1038 | cached_has_bits = from._has_bits_[0]; |
1039 | if (cached_has_bits & 0x000000ffu) { |
1040 | if (cached_has_bits & 0x00000001u) { |
1041 | _internal_set_device(from._internal_device()); |
1042 | } |
1043 | if (cached_has_bits & 0x00000002u) { |
1044 | _internal_mutable_data()->::torch::RecordRef::MergeFrom(from._internal_data()); |
1045 | } |
1046 | if (cached_has_bits & 0x00000004u) { |
1047 | offset_ = from.offset_; |
1048 | } |
1049 | if (cached_has_bits & 0x00000008u) { |
1050 | data_type_ = from.data_type_; |
1051 | } |
1052 | if (cached_has_bits & 0x00000010u) { |
1053 | requires_grad_ = from.requires_grad_; |
1054 | } |
1055 | if (cached_has_bits & 0x00000020u) { |
1056 | is_quantized_ = from.is_quantized_; |
1057 | } |
1058 | if (cached_has_bits & 0x00000040u) { |
1059 | scale_ = from.scale_; |
1060 | } |
1061 | if (cached_has_bits & 0x00000080u) { |
1062 | zero_point_ = from.zero_point_; |
1063 | } |
1064 | _has_bits_[0] |= cached_has_bits; |
1065 | } |
1066 | } |
1067 | |
1068 | void TensorDef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
1069 | // @@protoc_insertion_point(generalized_copy_from_start:torch.TensorDef) |
1070 | if (&from == this) return; |
1071 | Clear(); |
1072 | MergeFrom(from); |
1073 | } |
1074 | |
1075 | void TensorDef::CopyFrom(const TensorDef& from) { |
1076 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.TensorDef) |
1077 | if (&from == this) return; |
1078 | Clear(); |
1079 | MergeFrom(from); |
1080 | } |
1081 | |
1082 | bool TensorDef::IsInitialized() const { |
1083 | return true; |
1084 | } |
1085 | |
1086 | void TensorDef::InternalSwap(TensorDef* other) { |
1087 | using std::swap; |
1088 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
1089 | swap(_has_bits_[0], other->_has_bits_[0]); |
1090 | dims_.InternalSwap(&other->dims_); |
1091 | strides_.InternalSwap(&other->strides_); |
1092 | device_.Swap(&other->device_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
1093 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
1094 | PROTOBUF_FIELD_OFFSET(TensorDef, zero_point_) |
1095 | + sizeof(TensorDef::zero_point_) |
1096 | - PROTOBUF_FIELD_OFFSET(TensorDef, data_)>( |
1097 | reinterpret_cast<char*>(&data_), |
1098 | reinterpret_cast<char*>(&other->data_)); |
1099 | } |
1100 | |
1101 | ::PROTOBUF_NAMESPACE_ID::Metadata TensorDef::GetMetadata() const { |
1102 | return GetMetadataStatic(); |
1103 | } |
1104 | |
1105 | |
1106 | // =================================================================== |
1107 | |
1108 | void AttributeDef::InitAsDefaultInstance() { |
1109 | } |
1110 | class AttributeDef::_Internal { |
1111 | public: |
1112 | using HasBits = decltype(std::declval<AttributeDef>()._has_bits_); |
1113 | static void set_has_type(HasBits* has_bits) { |
1114 | (*has_bits)[0] |= 1u; |
1115 | } |
1116 | static void set_has_name(HasBits* has_bits) { |
1117 | (*has_bits)[0] |= 2u; |
1118 | } |
1119 | static void set_has_id(HasBits* has_bits) { |
1120 | (*has_bits)[0] |= 4u; |
1121 | } |
1122 | static bool MissingRequiredFields(const HasBits& has_bits) { |
1123 | return ((has_bits[0] & 0x00000007) ^ 0x00000007) != 0; |
1124 | } |
1125 | }; |
1126 | |
1127 | AttributeDef::AttributeDef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
1128 | : ::PROTOBUF_NAMESPACE_ID::Message(arena) { |
1129 | SharedCtor(); |
1130 | RegisterArenaDtor(arena); |
1131 | // @@protoc_insertion_point(arena_constructor:torch.AttributeDef) |
1132 | } |
1133 | AttributeDef::AttributeDef(const AttributeDef& from) |
1134 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
1135 | _has_bits_(from._has_bits_) { |
1136 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1137 | type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1138 | if (from._internal_has_type()) { |
1139 | type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_type(), |
1140 | GetArena()); |
1141 | } |
1142 | name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1143 | if (from._internal_has_name()) { |
1144 | name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), |
1145 | GetArena()); |
1146 | } |
1147 | id_ = from.id_; |
1148 | // @@protoc_insertion_point(copy_constructor:torch.AttributeDef) |
1149 | } |
1150 | |
1151 | void AttributeDef::SharedCtor() { |
1152 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto.base); |
1153 | type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1154 | name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1155 | id_ = PROTOBUF_LONGLONG(0); |
1156 | } |
1157 | |
1158 | AttributeDef::~AttributeDef() { |
1159 | // @@protoc_insertion_point(destructor:torch.AttributeDef) |
1160 | SharedDtor(); |
1161 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1162 | } |
1163 | |
1164 | void AttributeDef::SharedDtor() { |
1165 | GOOGLE_DCHECK(GetArena() == nullptr); |
1166 | type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1167 | name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1168 | } |
1169 | |
1170 | void AttributeDef::ArenaDtor(void* object) { |
1171 | AttributeDef* _this = reinterpret_cast< AttributeDef* >(object); |
1172 | (void)_this; |
1173 | } |
1174 | void AttributeDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
1175 | } |
1176 | void AttributeDef::SetCachedSize(int size) const { |
1177 | _cached_size_.Set(size); |
1178 | } |
1179 | const AttributeDef& AttributeDef::default_instance() { |
1180 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_AttributeDef_caffe2_2fproto_2ftorch_2eproto.base); |
1181 | return *internal_default_instance(); |
1182 | } |
1183 | |
1184 | |
1185 | void AttributeDef::Clear() { |
1186 | // @@protoc_insertion_point(message_clear_start:torch.AttributeDef) |
1187 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1188 | // Prevent compiler warnings about cached_has_bits being unused |
1189 | (void) cached_has_bits; |
1190 | |
1191 | cached_has_bits = _has_bits_[0]; |
1192 | if (cached_has_bits & 0x00000003u) { |
1193 | if (cached_has_bits & 0x00000001u) { |
1194 | type_.ClearNonDefaultToEmpty(); |
1195 | } |
1196 | if (cached_has_bits & 0x00000002u) { |
1197 | name_.ClearNonDefaultToEmpty(); |
1198 | } |
1199 | } |
1200 | id_ = PROTOBUF_LONGLONG(0); |
1201 | _has_bits_.Clear(); |
1202 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1203 | } |
1204 | |
1205 | const char* AttributeDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
1206 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
1207 | _Internal::HasBits has_bits{}; |
1208 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
1209 | while (!ctx->Done(&ptr)) { |
1210 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
1211 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
1212 | CHK_(ptr); |
1213 | switch (tag >> 3) { |
1214 | // required string type = 1; |
1215 | case 1: |
1216 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
1217 | auto str = _internal_mutable_type(); |
1218 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
1219 | #ifndef NDEBUG |
1220 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.AttributeDef.type" ); |
1221 | #endif // !NDEBUG |
1222 | CHK_(ptr); |
1223 | } else goto handle_unusual; |
1224 | continue; |
1225 | // required string name = 2; |
1226 | case 2: |
1227 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { |
1228 | auto str = _internal_mutable_name(); |
1229 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
1230 | #ifndef NDEBUG |
1231 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.AttributeDef.name" ); |
1232 | #endif // !NDEBUG |
1233 | CHK_(ptr); |
1234 | } else goto handle_unusual; |
1235 | continue; |
1236 | // required int64 id = 3; |
1237 | case 3: |
1238 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) { |
1239 | _Internal::set_has_id(&has_bits); |
1240 | id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
1241 | CHK_(ptr); |
1242 | } else goto handle_unusual; |
1243 | continue; |
1244 | default: { |
1245 | handle_unusual: |
1246 | if ((tag & 7) == 4 || tag == 0) { |
1247 | ctx->SetLastTag(tag); |
1248 | goto success; |
1249 | } |
1250 | ptr = UnknownFieldParse(tag, |
1251 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
1252 | ptr, ctx); |
1253 | CHK_(ptr != nullptr); |
1254 | continue; |
1255 | } |
1256 | } // switch |
1257 | } // while |
1258 | success: |
1259 | _has_bits_.Or(has_bits); |
1260 | return ptr; |
1261 | failure: |
1262 | ptr = nullptr; |
1263 | goto success; |
1264 | #undef CHK_ |
1265 | } |
1266 | |
1267 | ::PROTOBUF_NAMESPACE_ID::uint8* AttributeDef::_InternalSerialize( |
1268 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
1269 | // @@protoc_insertion_point(serialize_to_array_start:torch.AttributeDef) |
1270 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1271 | (void) cached_has_bits; |
1272 | |
1273 | cached_has_bits = _has_bits_[0]; |
1274 | // required string type = 1; |
1275 | if (cached_has_bits & 0x00000001u) { |
1276 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
1277 | this->_internal_type().data(), static_cast<int>(this->_internal_type().length()), |
1278 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
1279 | "torch.AttributeDef.type" ); |
1280 | target = stream->WriteStringMaybeAliased( |
1281 | 1, this->_internal_type(), target); |
1282 | } |
1283 | |
1284 | // required string name = 2; |
1285 | if (cached_has_bits & 0x00000002u) { |
1286 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
1287 | this->_internal_name().data(), static_cast<int>(this->_internal_name().length()), |
1288 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
1289 | "torch.AttributeDef.name" ); |
1290 | target = stream->WriteStringMaybeAliased( |
1291 | 2, this->_internal_name(), target); |
1292 | } |
1293 | |
1294 | // required int64 id = 3; |
1295 | if (cached_has_bits & 0x00000004u) { |
1296 | target = stream->EnsureSpace(target); |
1297 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_id(), target); |
1298 | } |
1299 | |
1300 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1301 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
1302 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
1303 | } |
1304 | // @@protoc_insertion_point(serialize_to_array_end:torch.AttributeDef) |
1305 | return target; |
1306 | } |
1307 | |
1308 | size_t AttributeDef::RequiredFieldsByteSizeFallback() const { |
1309 | // @@protoc_insertion_point(required_fields_byte_size_fallback_start:torch.AttributeDef) |
1310 | size_t total_size = 0; |
1311 | |
1312 | if (_internal_has_type()) { |
1313 | // required string type = 1; |
1314 | total_size += 1 + |
1315 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1316 | this->_internal_type()); |
1317 | } |
1318 | |
1319 | if (_internal_has_name()) { |
1320 | // required string name = 2; |
1321 | total_size += 1 + |
1322 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1323 | this->_internal_name()); |
1324 | } |
1325 | |
1326 | if (_internal_has_id()) { |
1327 | // required int64 id = 3; |
1328 | total_size += 1 + |
1329 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
1330 | this->_internal_id()); |
1331 | } |
1332 | |
1333 | return total_size; |
1334 | } |
1335 | size_t AttributeDef::ByteSizeLong() const { |
1336 | // @@protoc_insertion_point(message_byte_size_start:torch.AttributeDef) |
1337 | size_t total_size = 0; |
1338 | |
1339 | if (((_has_bits_[0] & 0x00000007) ^ 0x00000007) == 0) { // All required fields are present. |
1340 | // required string type = 1; |
1341 | total_size += 1 + |
1342 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1343 | this->_internal_type()); |
1344 | |
1345 | // required string name = 2; |
1346 | total_size += 1 + |
1347 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1348 | this->_internal_name()); |
1349 | |
1350 | // required int64 id = 3; |
1351 | total_size += 1 + |
1352 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
1353 | this->_internal_id()); |
1354 | |
1355 | } else { |
1356 | total_size += RequiredFieldsByteSizeFallback(); |
1357 | } |
1358 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1359 | // Prevent compiler warnings about cached_has_bits being unused |
1360 | (void) cached_has_bits; |
1361 | |
1362 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1363 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
1364 | _internal_metadata_, total_size, &_cached_size_); |
1365 | } |
1366 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
1367 | SetCachedSize(cached_size); |
1368 | return total_size; |
1369 | } |
1370 | |
1371 | void AttributeDef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
1372 | // @@protoc_insertion_point(generalized_merge_from_start:torch.AttributeDef) |
1373 | GOOGLE_DCHECK_NE(&from, this); |
1374 | const AttributeDef* source = |
1375 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<AttributeDef>( |
1376 | &from); |
1377 | if (source == nullptr) { |
1378 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.AttributeDef) |
1379 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
1380 | } else { |
1381 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.AttributeDef) |
1382 | MergeFrom(*source); |
1383 | } |
1384 | } |
1385 | |
1386 | void AttributeDef::MergeFrom(const AttributeDef& from) { |
1387 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.AttributeDef) |
1388 | GOOGLE_DCHECK_NE(&from, this); |
1389 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1390 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1391 | (void) cached_has_bits; |
1392 | |
1393 | cached_has_bits = from._has_bits_[0]; |
1394 | if (cached_has_bits & 0x00000007u) { |
1395 | if (cached_has_bits & 0x00000001u) { |
1396 | _internal_set_type(from._internal_type()); |
1397 | } |
1398 | if (cached_has_bits & 0x00000002u) { |
1399 | _internal_set_name(from._internal_name()); |
1400 | } |
1401 | if (cached_has_bits & 0x00000004u) { |
1402 | id_ = from.id_; |
1403 | } |
1404 | _has_bits_[0] |= cached_has_bits; |
1405 | } |
1406 | } |
1407 | |
1408 | void AttributeDef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
1409 | // @@protoc_insertion_point(generalized_copy_from_start:torch.AttributeDef) |
1410 | if (&from == this) return; |
1411 | Clear(); |
1412 | MergeFrom(from); |
1413 | } |
1414 | |
1415 | void AttributeDef::CopyFrom(const AttributeDef& from) { |
1416 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.AttributeDef) |
1417 | if (&from == this) return; |
1418 | Clear(); |
1419 | MergeFrom(from); |
1420 | } |
1421 | |
1422 | bool AttributeDef::IsInitialized() const { |
1423 | if (_Internal::MissingRequiredFields(_has_bits_)) return false; |
1424 | return true; |
1425 | } |
1426 | |
1427 | void AttributeDef::InternalSwap(AttributeDef* other) { |
1428 | using std::swap; |
1429 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
1430 | swap(_has_bits_[0], other->_has_bits_[0]); |
1431 | type_.Swap(&other->type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
1432 | name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
1433 | swap(id_, other->id_); |
1434 | } |
1435 | |
1436 | ::PROTOBUF_NAMESPACE_ID::Metadata AttributeDef::GetMetadata() const { |
1437 | return GetMetadataStatic(); |
1438 | } |
1439 | |
1440 | |
1441 | // =================================================================== |
1442 | |
1443 | void ParameterDef::InitAsDefaultInstance() { |
1444 | } |
1445 | class ParameterDef::_Internal { |
1446 | public: |
1447 | using HasBits = decltype(std::declval<ParameterDef>()._has_bits_); |
1448 | static void set_has_is_buffer(HasBits* has_bits) { |
1449 | (*has_bits)[0] |= 4u; |
1450 | } |
1451 | static void set_has_tensor_id(HasBits* has_bits) { |
1452 | (*has_bits)[0] |= 2u; |
1453 | } |
1454 | static void set_has_name(HasBits* has_bits) { |
1455 | (*has_bits)[0] |= 1u; |
1456 | } |
1457 | }; |
1458 | |
1459 | ParameterDef::ParameterDef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
1460 | : ::PROTOBUF_NAMESPACE_ID::Message(arena) { |
1461 | SharedCtor(); |
1462 | RegisterArenaDtor(arena); |
1463 | // @@protoc_insertion_point(arena_constructor:torch.ParameterDef) |
1464 | } |
1465 | ParameterDef::ParameterDef(const ParameterDef& from) |
1466 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
1467 | _has_bits_(from._has_bits_) { |
1468 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1469 | name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1470 | if (from._internal_has_name()) { |
1471 | name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), |
1472 | GetArena()); |
1473 | } |
1474 | ::memcpy(&tensor_id_, &from.tensor_id_, |
1475 | static_cast<size_t>(reinterpret_cast<char*>(&is_buffer_) - |
1476 | reinterpret_cast<char*>(&tensor_id_)) + sizeof(is_buffer_)); |
1477 | // @@protoc_insertion_point(copy_constructor:torch.ParameterDef) |
1478 | } |
1479 | |
1480 | void ParameterDef::SharedCtor() { |
1481 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto.base); |
1482 | name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1483 | ::memset(&tensor_id_, 0, static_cast<size_t>( |
1484 | reinterpret_cast<char*>(&is_buffer_) - |
1485 | reinterpret_cast<char*>(&tensor_id_)) + sizeof(is_buffer_)); |
1486 | } |
1487 | |
1488 | ParameterDef::~ParameterDef() { |
1489 | // @@protoc_insertion_point(destructor:torch.ParameterDef) |
1490 | SharedDtor(); |
1491 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1492 | } |
1493 | |
1494 | void ParameterDef::SharedDtor() { |
1495 | GOOGLE_DCHECK(GetArena() == nullptr); |
1496 | name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1497 | } |
1498 | |
1499 | void ParameterDef::ArenaDtor(void* object) { |
1500 | ParameterDef* _this = reinterpret_cast< ParameterDef* >(object); |
1501 | (void)_this; |
1502 | } |
1503 | void ParameterDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
1504 | } |
1505 | void ParameterDef::SetCachedSize(int size) const { |
1506 | _cached_size_.Set(size); |
1507 | } |
1508 | const ParameterDef& ParameterDef::default_instance() { |
1509 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ParameterDef_caffe2_2fproto_2ftorch_2eproto.base); |
1510 | return *internal_default_instance(); |
1511 | } |
1512 | |
1513 | |
1514 | void ParameterDef::Clear() { |
1515 | // @@protoc_insertion_point(message_clear_start:torch.ParameterDef) |
1516 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1517 | // Prevent compiler warnings about cached_has_bits being unused |
1518 | (void) cached_has_bits; |
1519 | |
1520 | cached_has_bits = _has_bits_[0]; |
1521 | if (cached_has_bits & 0x00000001u) { |
1522 | name_.ClearNonDefaultToEmpty(); |
1523 | } |
1524 | if (cached_has_bits & 0x00000006u) { |
1525 | ::memset(&tensor_id_, 0, static_cast<size_t>( |
1526 | reinterpret_cast<char*>(&is_buffer_) - |
1527 | reinterpret_cast<char*>(&tensor_id_)) + sizeof(is_buffer_)); |
1528 | } |
1529 | _has_bits_.Clear(); |
1530 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1531 | } |
1532 | |
1533 | const char* ParameterDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
1534 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
1535 | _Internal::HasBits has_bits{}; |
1536 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
1537 | while (!ctx->Done(&ptr)) { |
1538 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
1539 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
1540 | CHK_(ptr); |
1541 | switch (tag >> 3) { |
1542 | // optional bool is_buffer = 1; |
1543 | case 1: |
1544 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { |
1545 | _Internal::set_has_is_buffer(&has_bits); |
1546 | is_buffer_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
1547 | CHK_(ptr); |
1548 | } else goto handle_unusual; |
1549 | continue; |
1550 | // optional int64 tensor_id = 2; |
1551 | case 2: |
1552 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { |
1553 | _Internal::set_has_tensor_id(&has_bits); |
1554 | tensor_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
1555 | CHK_(ptr); |
1556 | } else goto handle_unusual; |
1557 | continue; |
1558 | // optional string name = 3; |
1559 | case 3: |
1560 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { |
1561 | auto str = _internal_mutable_name(); |
1562 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
1563 | #ifndef NDEBUG |
1564 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.ParameterDef.name" ); |
1565 | #endif // !NDEBUG |
1566 | CHK_(ptr); |
1567 | } else goto handle_unusual; |
1568 | continue; |
1569 | default: { |
1570 | handle_unusual: |
1571 | if ((tag & 7) == 4 || tag == 0) { |
1572 | ctx->SetLastTag(tag); |
1573 | goto success; |
1574 | } |
1575 | ptr = UnknownFieldParse(tag, |
1576 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
1577 | ptr, ctx); |
1578 | CHK_(ptr != nullptr); |
1579 | continue; |
1580 | } |
1581 | } // switch |
1582 | } // while |
1583 | success: |
1584 | _has_bits_.Or(has_bits); |
1585 | return ptr; |
1586 | failure: |
1587 | ptr = nullptr; |
1588 | goto success; |
1589 | #undef CHK_ |
1590 | } |
1591 | |
1592 | ::PROTOBUF_NAMESPACE_ID::uint8* ParameterDef::_InternalSerialize( |
1593 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
1594 | // @@protoc_insertion_point(serialize_to_array_start:torch.ParameterDef) |
1595 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1596 | (void) cached_has_bits; |
1597 | |
1598 | cached_has_bits = _has_bits_[0]; |
1599 | // optional bool is_buffer = 1; |
1600 | if (cached_has_bits & 0x00000004u) { |
1601 | target = stream->EnsureSpace(target); |
1602 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_is_buffer(), target); |
1603 | } |
1604 | |
1605 | // optional int64 tensor_id = 2; |
1606 | if (cached_has_bits & 0x00000002u) { |
1607 | target = stream->EnsureSpace(target); |
1608 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_tensor_id(), target); |
1609 | } |
1610 | |
1611 | // optional string name = 3; |
1612 | if (cached_has_bits & 0x00000001u) { |
1613 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
1614 | this->_internal_name().data(), static_cast<int>(this->_internal_name().length()), |
1615 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
1616 | "torch.ParameterDef.name" ); |
1617 | target = stream->WriteStringMaybeAliased( |
1618 | 3, this->_internal_name(), target); |
1619 | } |
1620 | |
1621 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1622 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
1623 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
1624 | } |
1625 | // @@protoc_insertion_point(serialize_to_array_end:torch.ParameterDef) |
1626 | return target; |
1627 | } |
1628 | |
1629 | size_t ParameterDef::ByteSizeLong() const { |
1630 | // @@protoc_insertion_point(message_byte_size_start:torch.ParameterDef) |
1631 | size_t total_size = 0; |
1632 | |
1633 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1634 | // Prevent compiler warnings about cached_has_bits being unused |
1635 | (void) cached_has_bits; |
1636 | |
1637 | cached_has_bits = _has_bits_[0]; |
1638 | if (cached_has_bits & 0x00000007u) { |
1639 | // optional string name = 3; |
1640 | if (cached_has_bits & 0x00000001u) { |
1641 | total_size += 1 + |
1642 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
1643 | this->_internal_name()); |
1644 | } |
1645 | |
1646 | // optional int64 tensor_id = 2; |
1647 | if (cached_has_bits & 0x00000002u) { |
1648 | total_size += 1 + |
1649 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
1650 | this->_internal_tensor_id()); |
1651 | } |
1652 | |
1653 | // optional bool is_buffer = 1; |
1654 | if (cached_has_bits & 0x00000004u) { |
1655 | total_size += 1 + 1; |
1656 | } |
1657 | |
1658 | } |
1659 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
1660 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
1661 | _internal_metadata_, total_size, &_cached_size_); |
1662 | } |
1663 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
1664 | SetCachedSize(cached_size); |
1665 | return total_size; |
1666 | } |
1667 | |
1668 | void ParameterDef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
1669 | // @@protoc_insertion_point(generalized_merge_from_start:torch.ParameterDef) |
1670 | GOOGLE_DCHECK_NE(&from, this); |
1671 | const ParameterDef* source = |
1672 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ParameterDef>( |
1673 | &from); |
1674 | if (source == nullptr) { |
1675 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.ParameterDef) |
1676 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
1677 | } else { |
1678 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.ParameterDef) |
1679 | MergeFrom(*source); |
1680 | } |
1681 | } |
1682 | |
1683 | void ParameterDef::MergeFrom(const ParameterDef& from) { |
1684 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.ParameterDef) |
1685 | GOOGLE_DCHECK_NE(&from, this); |
1686 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1687 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1688 | (void) cached_has_bits; |
1689 | |
1690 | cached_has_bits = from._has_bits_[0]; |
1691 | if (cached_has_bits & 0x00000007u) { |
1692 | if (cached_has_bits & 0x00000001u) { |
1693 | _internal_set_name(from._internal_name()); |
1694 | } |
1695 | if (cached_has_bits & 0x00000002u) { |
1696 | tensor_id_ = from.tensor_id_; |
1697 | } |
1698 | if (cached_has_bits & 0x00000004u) { |
1699 | is_buffer_ = from.is_buffer_; |
1700 | } |
1701 | _has_bits_[0] |= cached_has_bits; |
1702 | } |
1703 | } |
1704 | |
1705 | void ParameterDef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
1706 | // @@protoc_insertion_point(generalized_copy_from_start:torch.ParameterDef) |
1707 | if (&from == this) return; |
1708 | Clear(); |
1709 | MergeFrom(from); |
1710 | } |
1711 | |
1712 | void ParameterDef::CopyFrom(const ParameterDef& from) { |
1713 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.ParameterDef) |
1714 | if (&from == this) return; |
1715 | Clear(); |
1716 | MergeFrom(from); |
1717 | } |
1718 | |
1719 | bool ParameterDef::IsInitialized() const { |
1720 | return true; |
1721 | } |
1722 | |
1723 | void ParameterDef::InternalSwap(ParameterDef* other) { |
1724 | using std::swap; |
1725 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
1726 | swap(_has_bits_[0], other->_has_bits_[0]); |
1727 | name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
1728 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
1729 | PROTOBUF_FIELD_OFFSET(ParameterDef, is_buffer_) |
1730 | + sizeof(ParameterDef::is_buffer_) |
1731 | - PROTOBUF_FIELD_OFFSET(ParameterDef, tensor_id_)>( |
1732 | reinterpret_cast<char*>(&tensor_id_), |
1733 | reinterpret_cast<char*>(&other->tensor_id_)); |
1734 | } |
1735 | |
1736 | ::PROTOBUF_NAMESPACE_ID::Metadata ParameterDef::GetMetadata() const { |
1737 | return GetMetadataStatic(); |
1738 | } |
1739 | |
1740 | |
1741 | // =================================================================== |
1742 | |
1743 | void ModuleDef::InitAsDefaultInstance() { |
1744 | ::torch::_ModuleDef_default_instance_._instance.get_mutable()->torchscript_arena_ = const_cast< ::torch::RecordRef*>( |
1745 | ::torch::RecordRef::internal_default_instance()); |
1746 | ::torch::_ModuleDef_default_instance_._instance.get_mutable()->pickle_arena_ = const_cast< ::torch::RecordRef*>( |
1747 | ::torch::RecordRef::internal_default_instance()); |
1748 | ::torch::_ModuleDef_default_instance_._instance.get_mutable()->cpp_arena_ = const_cast< ::torch::RecordRef*>( |
1749 | ::torch::RecordRef::internal_default_instance()); |
1750 | ::torch::_ModuleDef_default_instance_._instance.get_mutable()->torchscript_debug_arena_ = const_cast< ::torch::RecordRef*>( |
1751 | ::torch::RecordRef::internal_default_instance()); |
1752 | } |
1753 | class ModuleDef::_Internal { |
1754 | public: |
1755 | using HasBits = decltype(std::declval<ModuleDef>()._has_bits_); |
1756 | static const ::torch::RecordRef& torchscript_arena(const ModuleDef* msg); |
1757 | static void set_has_torchscript_arena(HasBits* has_bits) { |
1758 | (*has_bits)[0] |= 2u; |
1759 | } |
1760 | static const ::torch::RecordRef& pickle_arena(const ModuleDef* msg); |
1761 | static void set_has_pickle_arena(HasBits* has_bits) { |
1762 | (*has_bits)[0] |= 4u; |
1763 | } |
1764 | static const ::torch::RecordRef& cpp_arena(const ModuleDef* msg); |
1765 | static void set_has_cpp_arena(HasBits* has_bits) { |
1766 | (*has_bits)[0] |= 8u; |
1767 | } |
1768 | static void set_has_name(HasBits* has_bits) { |
1769 | (*has_bits)[0] |= 1u; |
1770 | } |
1771 | static void set_has_optimize(HasBits* has_bits) { |
1772 | (*has_bits)[0] |= 64u; |
1773 | } |
1774 | static void set_has_get_state_attribute_id(HasBits* has_bits) { |
1775 | (*has_bits)[0] |= 32u; |
1776 | } |
1777 | static const ::torch::RecordRef& torchscript_debug_arena(const ModuleDef* msg); |
1778 | static void set_has_torchscript_debug_arena(HasBits* has_bits) { |
1779 | (*has_bits)[0] |= 16u; |
1780 | } |
1781 | }; |
1782 | |
1783 | const ::torch::RecordRef& |
1784 | ModuleDef::_Internal::torchscript_arena(const ModuleDef* msg) { |
1785 | return *msg->torchscript_arena_; |
1786 | } |
1787 | const ::torch::RecordRef& |
1788 | ModuleDef::_Internal::pickle_arena(const ModuleDef* msg) { |
1789 | return *msg->pickle_arena_; |
1790 | } |
1791 | const ::torch::RecordRef& |
1792 | ModuleDef::_Internal::cpp_arena(const ModuleDef* msg) { |
1793 | return *msg->cpp_arena_; |
1794 | } |
1795 | const ::torch::RecordRef& |
1796 | ModuleDef::_Internal::torchscript_debug_arena(const ModuleDef* msg) { |
1797 | return *msg->torchscript_debug_arena_; |
1798 | } |
1799 | void ModuleDef::clear_caffe2_nets() { |
1800 | caffe2_nets_.Clear(); |
1801 | } |
1802 | ModuleDef::ModuleDef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
1803 | : ::PROTOBUF_NAMESPACE_ID::Message(arena), |
1804 | submodules_(arena), |
1805 | caffe2_nets_(arena), |
1806 | parameters_(arena), |
1807 | attributes_(arena) { |
1808 | SharedCtor(); |
1809 | RegisterArenaDtor(arena); |
1810 | // @@protoc_insertion_point(arena_constructor:torch.ModuleDef) |
1811 | } |
1812 | ModuleDef::ModuleDef(const ModuleDef& from) |
1813 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
1814 | _has_bits_(from._has_bits_), |
1815 | submodules_(from.submodules_), |
1816 | caffe2_nets_(from.caffe2_nets_), |
1817 | parameters_(from.parameters_), |
1818 | attributes_(from.attributes_) { |
1819 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
1820 | name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1821 | if (from._internal_has_name()) { |
1822 | name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(), |
1823 | GetArena()); |
1824 | } |
1825 | if (from._internal_has_torchscript_arena()) { |
1826 | torchscript_arena_ = new ::torch::RecordRef(*from.torchscript_arena_); |
1827 | } else { |
1828 | torchscript_arena_ = nullptr; |
1829 | } |
1830 | if (from._internal_has_pickle_arena()) { |
1831 | pickle_arena_ = new ::torch::RecordRef(*from.pickle_arena_); |
1832 | } else { |
1833 | pickle_arena_ = nullptr; |
1834 | } |
1835 | if (from._internal_has_cpp_arena()) { |
1836 | cpp_arena_ = new ::torch::RecordRef(*from.cpp_arena_); |
1837 | } else { |
1838 | cpp_arena_ = nullptr; |
1839 | } |
1840 | if (from._internal_has_torchscript_debug_arena()) { |
1841 | torchscript_debug_arena_ = new ::torch::RecordRef(*from.torchscript_debug_arena_); |
1842 | } else { |
1843 | torchscript_debug_arena_ = nullptr; |
1844 | } |
1845 | ::memcpy(&get_state_attribute_id_, &from.get_state_attribute_id_, |
1846 | static_cast<size_t>(reinterpret_cast<char*>(&optimize_) - |
1847 | reinterpret_cast<char*>(&get_state_attribute_id_)) + sizeof(optimize_)); |
1848 | // @@protoc_insertion_point(copy_constructor:torch.ModuleDef) |
1849 | } |
1850 | |
1851 | void ModuleDef::SharedCtor() { |
1852 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto.base); |
1853 | name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1854 | ::memset(&torchscript_arena_, 0, static_cast<size_t>( |
1855 | reinterpret_cast<char*>(&optimize_) - |
1856 | reinterpret_cast<char*>(&torchscript_arena_)) + sizeof(optimize_)); |
1857 | } |
1858 | |
1859 | ModuleDef::~ModuleDef() { |
1860 | // @@protoc_insertion_point(destructor:torch.ModuleDef) |
1861 | SharedDtor(); |
1862 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1863 | } |
1864 | |
1865 | void ModuleDef::SharedDtor() { |
1866 | GOOGLE_DCHECK(GetArena() == nullptr); |
1867 | name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
1868 | if (this != internal_default_instance()) delete torchscript_arena_; |
1869 | if (this != internal_default_instance()) delete pickle_arena_; |
1870 | if (this != internal_default_instance()) delete cpp_arena_; |
1871 | if (this != internal_default_instance()) delete torchscript_debug_arena_; |
1872 | } |
1873 | |
1874 | void ModuleDef::ArenaDtor(void* object) { |
1875 | ModuleDef* _this = reinterpret_cast< ModuleDef* >(object); |
1876 | (void)_this; |
1877 | } |
1878 | void ModuleDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
1879 | } |
1880 | void ModuleDef::SetCachedSize(int size) const { |
1881 | _cached_size_.Set(size); |
1882 | } |
1883 | const ModuleDef& ModuleDef::default_instance() { |
1884 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ModuleDef_caffe2_2fproto_2ftorch_2eproto.base); |
1885 | return *internal_default_instance(); |
1886 | } |
1887 | |
1888 | |
1889 | void ModuleDef::Clear() { |
1890 | // @@protoc_insertion_point(message_clear_start:torch.ModuleDef) |
1891 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
1892 | // Prevent compiler warnings about cached_has_bits being unused |
1893 | (void) cached_has_bits; |
1894 | |
1895 | submodules_.Clear(); |
1896 | caffe2_nets_.Clear(); |
1897 | parameters_.Clear(); |
1898 | attributes_.Clear(); |
1899 | cached_has_bits = _has_bits_[0]; |
1900 | if (cached_has_bits & 0x0000001fu) { |
1901 | if (cached_has_bits & 0x00000001u) { |
1902 | name_.ClearNonDefaultToEmpty(); |
1903 | } |
1904 | if (cached_has_bits & 0x00000002u) { |
1905 | GOOGLE_DCHECK(torchscript_arena_ != nullptr); |
1906 | torchscript_arena_->Clear(); |
1907 | } |
1908 | if (cached_has_bits & 0x00000004u) { |
1909 | GOOGLE_DCHECK(pickle_arena_ != nullptr); |
1910 | pickle_arena_->Clear(); |
1911 | } |
1912 | if (cached_has_bits & 0x00000008u) { |
1913 | GOOGLE_DCHECK(cpp_arena_ != nullptr); |
1914 | cpp_arena_->Clear(); |
1915 | } |
1916 | if (cached_has_bits & 0x00000010u) { |
1917 | GOOGLE_DCHECK(torchscript_debug_arena_ != nullptr); |
1918 | torchscript_debug_arena_->Clear(); |
1919 | } |
1920 | } |
1921 | if (cached_has_bits & 0x00000060u) { |
1922 | ::memset(&get_state_attribute_id_, 0, static_cast<size_t>( |
1923 | reinterpret_cast<char*>(&optimize_) - |
1924 | reinterpret_cast<char*>(&get_state_attribute_id_)) + sizeof(optimize_)); |
1925 | } |
1926 | _has_bits_.Clear(); |
1927 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
1928 | } |
1929 | |
1930 | const char* ModuleDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
1931 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
1932 | _Internal::HasBits has_bits{}; |
1933 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
1934 | while (!ctx->Done(&ptr)) { |
1935 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
1936 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
1937 | CHK_(ptr); |
1938 | switch (tag >> 3) { |
1939 | // repeated .torch.ModuleDef submodules = 1; |
1940 | case 1: |
1941 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
1942 | ptr -= 1; |
1943 | do { |
1944 | ptr += 1; |
1945 | ptr = ctx->ParseMessage(_internal_add_submodules(), ptr); |
1946 | CHK_(ptr); |
1947 | if (!ctx->DataAvailable(ptr)) break; |
1948 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); |
1949 | } else goto handle_unusual; |
1950 | continue; |
1951 | // optional .torch.RecordRef torchscript_arena = 2; |
1952 | case 2: |
1953 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { |
1954 | ptr = ctx->ParseMessage(_internal_mutable_torchscript_arena(), ptr); |
1955 | CHK_(ptr); |
1956 | } else goto handle_unusual; |
1957 | continue; |
1958 | // repeated .caffe2.NetDef caffe2_nets = 3; |
1959 | case 3: |
1960 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { |
1961 | ptr -= 1; |
1962 | do { |
1963 | ptr += 1; |
1964 | ptr = ctx->ParseMessage(_internal_add_caffe2_nets(), ptr); |
1965 | CHK_(ptr); |
1966 | if (!ctx->DataAvailable(ptr)) break; |
1967 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr)); |
1968 | } else goto handle_unusual; |
1969 | continue; |
1970 | // optional .torch.RecordRef pickle_arena = 4; |
1971 | case 4: |
1972 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { |
1973 | ptr = ctx->ParseMessage(_internal_mutable_pickle_arena(), ptr); |
1974 | CHK_(ptr); |
1975 | } else goto handle_unusual; |
1976 | continue; |
1977 | // optional .torch.RecordRef cpp_arena = 5; |
1978 | case 5: |
1979 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { |
1980 | ptr = ctx->ParseMessage(_internal_mutable_cpp_arena(), ptr); |
1981 | CHK_(ptr); |
1982 | } else goto handle_unusual; |
1983 | continue; |
1984 | // repeated .torch.ParameterDef parameters = 6; |
1985 | case 6: |
1986 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) { |
1987 | ptr -= 1; |
1988 | do { |
1989 | ptr += 1; |
1990 | ptr = ctx->ParseMessage(_internal_add_parameters(), ptr); |
1991 | CHK_(ptr); |
1992 | if (!ctx->DataAvailable(ptr)) break; |
1993 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); |
1994 | } else goto handle_unusual; |
1995 | continue; |
1996 | // optional string name = 7; |
1997 | case 7: |
1998 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) { |
1999 | auto str = _internal_mutable_name(); |
2000 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
2001 | #ifndef NDEBUG |
2002 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.ModuleDef.name" ); |
2003 | #endif // !NDEBUG |
2004 | CHK_(ptr); |
2005 | } else goto handle_unusual; |
2006 | continue; |
2007 | // optional bool optimize = 8; |
2008 | case 8: |
2009 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) { |
2010 | _Internal::set_has_optimize(&has_bits); |
2011 | optimize_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
2012 | CHK_(ptr); |
2013 | } else goto handle_unusual; |
2014 | continue; |
2015 | // repeated .torch.AttributeDef attributes = 9; |
2016 | case 9: |
2017 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { |
2018 | ptr -= 1; |
2019 | do { |
2020 | ptr += 1; |
2021 | ptr = ctx->ParseMessage(_internal_add_attributes(), ptr); |
2022 | CHK_(ptr); |
2023 | if (!ctx->DataAvailable(ptr)) break; |
2024 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr)); |
2025 | } else goto handle_unusual; |
2026 | continue; |
2027 | // optional int64 get_state_attribute_id = 10; |
2028 | case 10: |
2029 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) { |
2030 | _Internal::set_has_get_state_attribute_id(&has_bits); |
2031 | get_state_attribute_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
2032 | CHK_(ptr); |
2033 | } else goto handle_unusual; |
2034 | continue; |
2035 | // optional .torch.RecordRef torchscript_debug_arena = 11; |
2036 | case 11: |
2037 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) { |
2038 | ptr = ctx->ParseMessage(_internal_mutable_torchscript_debug_arena(), ptr); |
2039 | CHK_(ptr); |
2040 | } else goto handle_unusual; |
2041 | continue; |
2042 | default: { |
2043 | handle_unusual: |
2044 | if ((tag & 7) == 4 || tag == 0) { |
2045 | ctx->SetLastTag(tag); |
2046 | goto success; |
2047 | } |
2048 | ptr = UnknownFieldParse(tag, |
2049 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
2050 | ptr, ctx); |
2051 | CHK_(ptr != nullptr); |
2052 | continue; |
2053 | } |
2054 | } // switch |
2055 | } // while |
2056 | success: |
2057 | _has_bits_.Or(has_bits); |
2058 | return ptr; |
2059 | failure: |
2060 | ptr = nullptr; |
2061 | goto success; |
2062 | #undef CHK_ |
2063 | } |
2064 | |
2065 | ::PROTOBUF_NAMESPACE_ID::uint8* ModuleDef::_InternalSerialize( |
2066 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
2067 | // @@protoc_insertion_point(serialize_to_array_start:torch.ModuleDef) |
2068 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2069 | (void) cached_has_bits; |
2070 | |
2071 | // repeated .torch.ModuleDef submodules = 1; |
2072 | for (unsigned int i = 0, |
2073 | n = static_cast<unsigned int>(this->_internal_submodules_size()); i < n; i++) { |
2074 | target = stream->EnsureSpace(target); |
2075 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2076 | InternalWriteMessage(1, this->_internal_submodules(i), target, stream); |
2077 | } |
2078 | |
2079 | cached_has_bits = _has_bits_[0]; |
2080 | // optional .torch.RecordRef torchscript_arena = 2; |
2081 | if (cached_has_bits & 0x00000002u) { |
2082 | target = stream->EnsureSpace(target); |
2083 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2084 | InternalWriteMessage( |
2085 | 2, _Internal::torchscript_arena(this), target, stream); |
2086 | } |
2087 | |
2088 | // repeated .caffe2.NetDef caffe2_nets = 3; |
2089 | for (unsigned int i = 0, |
2090 | n = static_cast<unsigned int>(this->_internal_caffe2_nets_size()); i < n; i++) { |
2091 | target = stream->EnsureSpace(target); |
2092 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2093 | InternalWriteMessage(3, this->_internal_caffe2_nets(i), target, stream); |
2094 | } |
2095 | |
2096 | // optional .torch.RecordRef pickle_arena = 4; |
2097 | if (cached_has_bits & 0x00000004u) { |
2098 | target = stream->EnsureSpace(target); |
2099 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2100 | InternalWriteMessage( |
2101 | 4, _Internal::pickle_arena(this), target, stream); |
2102 | } |
2103 | |
2104 | // optional .torch.RecordRef cpp_arena = 5; |
2105 | if (cached_has_bits & 0x00000008u) { |
2106 | target = stream->EnsureSpace(target); |
2107 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2108 | InternalWriteMessage( |
2109 | 5, _Internal::cpp_arena(this), target, stream); |
2110 | } |
2111 | |
2112 | // repeated .torch.ParameterDef parameters = 6; |
2113 | for (unsigned int i = 0, |
2114 | n = static_cast<unsigned int>(this->_internal_parameters_size()); i < n; i++) { |
2115 | target = stream->EnsureSpace(target); |
2116 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2117 | InternalWriteMessage(6, this->_internal_parameters(i), target, stream); |
2118 | } |
2119 | |
2120 | // optional string name = 7; |
2121 | if (cached_has_bits & 0x00000001u) { |
2122 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
2123 | this->_internal_name().data(), static_cast<int>(this->_internal_name().length()), |
2124 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
2125 | "torch.ModuleDef.name" ); |
2126 | target = stream->WriteStringMaybeAliased( |
2127 | 7, this->_internal_name(), target); |
2128 | } |
2129 | |
2130 | // optional bool optimize = 8; |
2131 | if (cached_has_bits & 0x00000040u) { |
2132 | target = stream->EnsureSpace(target); |
2133 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_optimize(), target); |
2134 | } |
2135 | |
2136 | // repeated .torch.AttributeDef attributes = 9; |
2137 | for (unsigned int i = 0, |
2138 | n = static_cast<unsigned int>(this->_internal_attributes_size()); i < n; i++) { |
2139 | target = stream->EnsureSpace(target); |
2140 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2141 | InternalWriteMessage(9, this->_internal_attributes(i), target, stream); |
2142 | } |
2143 | |
2144 | // optional int64 get_state_attribute_id = 10; |
2145 | if (cached_has_bits & 0x00000020u) { |
2146 | target = stream->EnsureSpace(target); |
2147 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(10, this->_internal_get_state_attribute_id(), target); |
2148 | } |
2149 | |
2150 | // optional .torch.RecordRef torchscript_debug_arena = 11; |
2151 | if (cached_has_bits & 0x00000010u) { |
2152 | target = stream->EnsureSpace(target); |
2153 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2154 | InternalWriteMessage( |
2155 | 11, _Internal::torchscript_debug_arena(this), target, stream); |
2156 | } |
2157 | |
2158 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
2159 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
2160 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
2161 | } |
2162 | // @@protoc_insertion_point(serialize_to_array_end:torch.ModuleDef) |
2163 | return target; |
2164 | } |
2165 | |
2166 | size_t ModuleDef::ByteSizeLong() const { |
2167 | // @@protoc_insertion_point(message_byte_size_start:torch.ModuleDef) |
2168 | size_t total_size = 0; |
2169 | |
2170 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2171 | // Prevent compiler warnings about cached_has_bits being unused |
2172 | (void) cached_has_bits; |
2173 | |
2174 | // repeated .torch.ModuleDef submodules = 1; |
2175 | total_size += 1UL * this->_internal_submodules_size(); |
2176 | for (const auto& msg : this->submodules_) { |
2177 | total_size += |
2178 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
2179 | } |
2180 | |
2181 | // repeated .caffe2.NetDef caffe2_nets = 3; |
2182 | total_size += 1UL * this->_internal_caffe2_nets_size(); |
2183 | for (const auto& msg : this->caffe2_nets_) { |
2184 | total_size += |
2185 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
2186 | } |
2187 | |
2188 | // repeated .torch.ParameterDef parameters = 6; |
2189 | total_size += 1UL * this->_internal_parameters_size(); |
2190 | for (const auto& msg : this->parameters_) { |
2191 | total_size += |
2192 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
2193 | } |
2194 | |
2195 | // repeated .torch.AttributeDef attributes = 9; |
2196 | total_size += 1UL * this->_internal_attributes_size(); |
2197 | for (const auto& msg : this->attributes_) { |
2198 | total_size += |
2199 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
2200 | } |
2201 | |
2202 | cached_has_bits = _has_bits_[0]; |
2203 | if (cached_has_bits & 0x0000007fu) { |
2204 | // optional string name = 7; |
2205 | if (cached_has_bits & 0x00000001u) { |
2206 | total_size += 1 + |
2207 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
2208 | this->_internal_name()); |
2209 | } |
2210 | |
2211 | // optional .torch.RecordRef torchscript_arena = 2; |
2212 | if (cached_has_bits & 0x00000002u) { |
2213 | total_size += 1 + |
2214 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
2215 | *torchscript_arena_); |
2216 | } |
2217 | |
2218 | // optional .torch.RecordRef pickle_arena = 4; |
2219 | if (cached_has_bits & 0x00000004u) { |
2220 | total_size += 1 + |
2221 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
2222 | *pickle_arena_); |
2223 | } |
2224 | |
2225 | // optional .torch.RecordRef cpp_arena = 5; |
2226 | if (cached_has_bits & 0x00000008u) { |
2227 | total_size += 1 + |
2228 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
2229 | *cpp_arena_); |
2230 | } |
2231 | |
2232 | // optional .torch.RecordRef torchscript_debug_arena = 11; |
2233 | if (cached_has_bits & 0x00000010u) { |
2234 | total_size += 1 + |
2235 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
2236 | *torchscript_debug_arena_); |
2237 | } |
2238 | |
2239 | // optional int64 get_state_attribute_id = 10; |
2240 | if (cached_has_bits & 0x00000020u) { |
2241 | total_size += 1 + |
2242 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
2243 | this->_internal_get_state_attribute_id()); |
2244 | } |
2245 | |
2246 | // optional bool optimize = 8; |
2247 | if (cached_has_bits & 0x00000040u) { |
2248 | total_size += 1 + 1; |
2249 | } |
2250 | |
2251 | } |
2252 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
2253 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
2254 | _internal_metadata_, total_size, &_cached_size_); |
2255 | } |
2256 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
2257 | SetCachedSize(cached_size); |
2258 | return total_size; |
2259 | } |
2260 | |
2261 | void ModuleDef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
2262 | // @@protoc_insertion_point(generalized_merge_from_start:torch.ModuleDef) |
2263 | GOOGLE_DCHECK_NE(&from, this); |
2264 | const ModuleDef* source = |
2265 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ModuleDef>( |
2266 | &from); |
2267 | if (source == nullptr) { |
2268 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.ModuleDef) |
2269 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
2270 | } else { |
2271 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.ModuleDef) |
2272 | MergeFrom(*source); |
2273 | } |
2274 | } |
2275 | |
2276 | void ModuleDef::MergeFrom(const ModuleDef& from) { |
2277 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.ModuleDef) |
2278 | GOOGLE_DCHECK_NE(&from, this); |
2279 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
2280 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2281 | (void) cached_has_bits; |
2282 | |
2283 | submodules_.MergeFrom(from.submodules_); |
2284 | caffe2_nets_.MergeFrom(from.caffe2_nets_); |
2285 | parameters_.MergeFrom(from.parameters_); |
2286 | attributes_.MergeFrom(from.attributes_); |
2287 | cached_has_bits = from._has_bits_[0]; |
2288 | if (cached_has_bits & 0x0000007fu) { |
2289 | if (cached_has_bits & 0x00000001u) { |
2290 | _internal_set_name(from._internal_name()); |
2291 | } |
2292 | if (cached_has_bits & 0x00000002u) { |
2293 | _internal_mutable_torchscript_arena()->::torch::RecordRef::MergeFrom(from._internal_torchscript_arena()); |
2294 | } |
2295 | if (cached_has_bits & 0x00000004u) { |
2296 | _internal_mutable_pickle_arena()->::torch::RecordRef::MergeFrom(from._internal_pickle_arena()); |
2297 | } |
2298 | if (cached_has_bits & 0x00000008u) { |
2299 | _internal_mutable_cpp_arena()->::torch::RecordRef::MergeFrom(from._internal_cpp_arena()); |
2300 | } |
2301 | if (cached_has_bits & 0x00000010u) { |
2302 | _internal_mutable_torchscript_debug_arena()->::torch::RecordRef::MergeFrom(from._internal_torchscript_debug_arena()); |
2303 | } |
2304 | if (cached_has_bits & 0x00000020u) { |
2305 | get_state_attribute_id_ = from.get_state_attribute_id_; |
2306 | } |
2307 | if (cached_has_bits & 0x00000040u) { |
2308 | optimize_ = from.optimize_; |
2309 | } |
2310 | _has_bits_[0] |= cached_has_bits; |
2311 | } |
2312 | } |
2313 | |
2314 | void ModuleDef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
2315 | // @@protoc_insertion_point(generalized_copy_from_start:torch.ModuleDef) |
2316 | if (&from == this) return; |
2317 | Clear(); |
2318 | MergeFrom(from); |
2319 | } |
2320 | |
2321 | void ModuleDef::CopyFrom(const ModuleDef& from) { |
2322 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.ModuleDef) |
2323 | if (&from == this) return; |
2324 | Clear(); |
2325 | MergeFrom(from); |
2326 | } |
2327 | |
2328 | bool ModuleDef::IsInitialized() const { |
2329 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(submodules_)) return false; |
2330 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(caffe2_nets_)) return false; |
2331 | if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(attributes_)) return false; |
2332 | return true; |
2333 | } |
2334 | |
2335 | void ModuleDef::InternalSwap(ModuleDef* other) { |
2336 | using std::swap; |
2337 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
2338 | swap(_has_bits_[0], other->_has_bits_[0]); |
2339 | submodules_.InternalSwap(&other->submodules_); |
2340 | caffe2_nets_.InternalSwap(&other->caffe2_nets_); |
2341 | parameters_.InternalSwap(&other->parameters_); |
2342 | attributes_.InternalSwap(&other->attributes_); |
2343 | name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
2344 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
2345 | PROTOBUF_FIELD_OFFSET(ModuleDef, optimize_) |
2346 | + sizeof(ModuleDef::optimize_) |
2347 | - PROTOBUF_FIELD_OFFSET(ModuleDef, torchscript_arena_)>( |
2348 | reinterpret_cast<char*>(&torchscript_arena_), |
2349 | reinterpret_cast<char*>(&other->torchscript_arena_)); |
2350 | } |
2351 | |
2352 | ::PROTOBUF_NAMESPACE_ID::Metadata ModuleDef::GetMetadata() const { |
2353 | return GetMetadataStatic(); |
2354 | } |
2355 | |
2356 | |
2357 | // =================================================================== |
2358 | |
2359 | void LibDef::InitAsDefaultInstance() { |
2360 | ::torch::_LibDef_default_instance_._instance.get_mutable()->torchscript_arena_ = const_cast< ::torch::RecordRef*>( |
2361 | ::torch::RecordRef::internal_default_instance()); |
2362 | } |
2363 | class LibDef::_Internal { |
2364 | public: |
2365 | using HasBits = decltype(std::declval<LibDef>()._has_bits_); |
2366 | static const ::torch::RecordRef& torchscript_arena(const LibDef* msg); |
2367 | static void set_has_torchscript_arena(HasBits* has_bits) { |
2368 | (*has_bits)[0] |= 1u; |
2369 | } |
2370 | }; |
2371 | |
2372 | const ::torch::RecordRef& |
2373 | LibDef::_Internal::torchscript_arena(const LibDef* msg) { |
2374 | return *msg->torchscript_arena_; |
2375 | } |
2376 | LibDef::LibDef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
2377 | : ::PROTOBUF_NAMESPACE_ID::Message(arena) { |
2378 | SharedCtor(); |
2379 | RegisterArenaDtor(arena); |
2380 | // @@protoc_insertion_point(arena_constructor:torch.LibDef) |
2381 | } |
2382 | LibDef::LibDef(const LibDef& from) |
2383 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
2384 | _has_bits_(from._has_bits_) { |
2385 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
2386 | if (from._internal_has_torchscript_arena()) { |
2387 | torchscript_arena_ = new ::torch::RecordRef(*from.torchscript_arena_); |
2388 | } else { |
2389 | torchscript_arena_ = nullptr; |
2390 | } |
2391 | // @@protoc_insertion_point(copy_constructor:torch.LibDef) |
2392 | } |
2393 | |
2394 | void LibDef::SharedCtor() { |
2395 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_LibDef_caffe2_2fproto_2ftorch_2eproto.base); |
2396 | torchscript_arena_ = nullptr; |
2397 | } |
2398 | |
2399 | LibDef::~LibDef() { |
2400 | // @@protoc_insertion_point(destructor:torch.LibDef) |
2401 | SharedDtor(); |
2402 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
2403 | } |
2404 | |
2405 | void LibDef::SharedDtor() { |
2406 | GOOGLE_DCHECK(GetArena() == nullptr); |
2407 | if (this != internal_default_instance()) delete torchscript_arena_; |
2408 | } |
2409 | |
2410 | void LibDef::ArenaDtor(void* object) { |
2411 | LibDef* _this = reinterpret_cast< LibDef* >(object); |
2412 | (void)_this; |
2413 | } |
2414 | void LibDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
2415 | } |
2416 | void LibDef::SetCachedSize(int size) const { |
2417 | _cached_size_.Set(size); |
2418 | } |
2419 | const LibDef& LibDef::default_instance() { |
2420 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LibDef_caffe2_2fproto_2ftorch_2eproto.base); |
2421 | return *internal_default_instance(); |
2422 | } |
2423 | |
2424 | |
2425 | void LibDef::Clear() { |
2426 | // @@protoc_insertion_point(message_clear_start:torch.LibDef) |
2427 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2428 | // Prevent compiler warnings about cached_has_bits being unused |
2429 | (void) cached_has_bits; |
2430 | |
2431 | cached_has_bits = _has_bits_[0]; |
2432 | if (cached_has_bits & 0x00000001u) { |
2433 | GOOGLE_DCHECK(torchscript_arena_ != nullptr); |
2434 | torchscript_arena_->Clear(); |
2435 | } |
2436 | _has_bits_.Clear(); |
2437 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
2438 | } |
2439 | |
2440 | const char* LibDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
2441 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
2442 | _Internal::HasBits has_bits{}; |
2443 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
2444 | while (!ctx->Done(&ptr)) { |
2445 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
2446 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
2447 | CHK_(ptr); |
2448 | switch (tag >> 3) { |
2449 | // optional .torch.RecordRef torchscript_arena = 1; |
2450 | case 1: |
2451 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { |
2452 | ptr = ctx->ParseMessage(_internal_mutable_torchscript_arena(), ptr); |
2453 | CHK_(ptr); |
2454 | } else goto handle_unusual; |
2455 | continue; |
2456 | default: { |
2457 | handle_unusual: |
2458 | if ((tag & 7) == 4 || tag == 0) { |
2459 | ctx->SetLastTag(tag); |
2460 | goto success; |
2461 | } |
2462 | ptr = UnknownFieldParse(tag, |
2463 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
2464 | ptr, ctx); |
2465 | CHK_(ptr != nullptr); |
2466 | continue; |
2467 | } |
2468 | } // switch |
2469 | } // while |
2470 | success: |
2471 | _has_bits_.Or(has_bits); |
2472 | return ptr; |
2473 | failure: |
2474 | ptr = nullptr; |
2475 | goto success; |
2476 | #undef CHK_ |
2477 | } |
2478 | |
2479 | ::PROTOBUF_NAMESPACE_ID::uint8* LibDef::_InternalSerialize( |
2480 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
2481 | // @@protoc_insertion_point(serialize_to_array_start:torch.LibDef) |
2482 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2483 | (void) cached_has_bits; |
2484 | |
2485 | cached_has_bits = _has_bits_[0]; |
2486 | // optional .torch.RecordRef torchscript_arena = 1; |
2487 | if (cached_has_bits & 0x00000001u) { |
2488 | target = stream->EnsureSpace(target); |
2489 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2490 | InternalWriteMessage( |
2491 | 1, _Internal::torchscript_arena(this), target, stream); |
2492 | } |
2493 | |
2494 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
2495 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
2496 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
2497 | } |
2498 | // @@protoc_insertion_point(serialize_to_array_end:torch.LibDef) |
2499 | return target; |
2500 | } |
2501 | |
2502 | size_t LibDef::ByteSizeLong() const { |
2503 | // @@protoc_insertion_point(message_byte_size_start:torch.LibDef) |
2504 | size_t total_size = 0; |
2505 | |
2506 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2507 | // Prevent compiler warnings about cached_has_bits being unused |
2508 | (void) cached_has_bits; |
2509 | |
2510 | // optional .torch.RecordRef torchscript_arena = 1; |
2511 | cached_has_bits = _has_bits_[0]; |
2512 | if (cached_has_bits & 0x00000001u) { |
2513 | total_size += 1 + |
2514 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
2515 | *torchscript_arena_); |
2516 | } |
2517 | |
2518 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
2519 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
2520 | _internal_metadata_, total_size, &_cached_size_); |
2521 | } |
2522 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
2523 | SetCachedSize(cached_size); |
2524 | return total_size; |
2525 | } |
2526 | |
2527 | void LibDef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
2528 | // @@protoc_insertion_point(generalized_merge_from_start:torch.LibDef) |
2529 | GOOGLE_DCHECK_NE(&from, this); |
2530 | const LibDef* source = |
2531 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LibDef>( |
2532 | &from); |
2533 | if (source == nullptr) { |
2534 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.LibDef) |
2535 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
2536 | } else { |
2537 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.LibDef) |
2538 | MergeFrom(*source); |
2539 | } |
2540 | } |
2541 | |
2542 | void LibDef::MergeFrom(const LibDef& from) { |
2543 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.LibDef) |
2544 | GOOGLE_DCHECK_NE(&from, this); |
2545 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
2546 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2547 | (void) cached_has_bits; |
2548 | |
2549 | if (from._internal_has_torchscript_arena()) { |
2550 | _internal_mutable_torchscript_arena()->::torch::RecordRef::MergeFrom(from._internal_torchscript_arena()); |
2551 | } |
2552 | } |
2553 | |
2554 | void LibDef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
2555 | // @@protoc_insertion_point(generalized_copy_from_start:torch.LibDef) |
2556 | if (&from == this) return; |
2557 | Clear(); |
2558 | MergeFrom(from); |
2559 | } |
2560 | |
2561 | void LibDef::CopyFrom(const LibDef& from) { |
2562 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.LibDef) |
2563 | if (&from == this) return; |
2564 | Clear(); |
2565 | MergeFrom(from); |
2566 | } |
2567 | |
2568 | bool LibDef::IsInitialized() const { |
2569 | return true; |
2570 | } |
2571 | |
2572 | void LibDef::InternalSwap(LibDef* other) { |
2573 | using std::swap; |
2574 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
2575 | swap(_has_bits_[0], other->_has_bits_[0]); |
2576 | swap(torchscript_arena_, other->torchscript_arena_); |
2577 | } |
2578 | |
2579 | ::PROTOBUF_NAMESPACE_ID::Metadata LibDef::GetMetadata() const { |
2580 | return GetMetadataStatic(); |
2581 | } |
2582 | |
2583 | |
2584 | // =================================================================== |
2585 | |
2586 | void ModelDef::InitAsDefaultInstance() { |
2587 | ::torch::_ModelDef_default_instance_._instance.get_mutable()->main_module_ = const_cast< ::torch::ModuleDef*>( |
2588 | ::torch::ModuleDef::internal_default_instance()); |
2589 | } |
2590 | class ModelDef::_Internal { |
2591 | public: |
2592 | using HasBits = decltype(std::declval<ModelDef>()._has_bits_); |
2593 | static void set_has_proto_version(HasBits* has_bits) { |
2594 | (*has_bits)[0] |= 8u; |
2595 | } |
2596 | static const ::torch::ModuleDef& main_module(const ModelDef* msg); |
2597 | static void set_has_main_module(HasBits* has_bits) { |
2598 | (*has_bits)[0] |= 4u; |
2599 | } |
2600 | static void set_has_producer_name(HasBits* has_bits) { |
2601 | (*has_bits)[0] |= 1u; |
2602 | } |
2603 | static void set_has_producer_version(HasBits* has_bits) { |
2604 | (*has_bits)[0] |= 2u; |
2605 | } |
2606 | }; |
2607 | |
2608 | const ::torch::ModuleDef& |
2609 | ModelDef::_Internal::main_module(const ModelDef* msg) { |
2610 | return *msg->main_module_; |
2611 | } |
2612 | ModelDef::ModelDef(::PROTOBUF_NAMESPACE_ID::Arena* arena) |
2613 | : ::PROTOBUF_NAMESPACE_ID::Message(arena), |
2614 | tensors_(arena) { |
2615 | SharedCtor(); |
2616 | RegisterArenaDtor(arena); |
2617 | // @@protoc_insertion_point(arena_constructor:torch.ModelDef) |
2618 | } |
2619 | ModelDef::ModelDef(const ModelDef& from) |
2620 | : ::PROTOBUF_NAMESPACE_ID::Message(), |
2621 | _has_bits_(from._has_bits_), |
2622 | tensors_(from.tensors_) { |
2623 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
2624 | producer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
2625 | if (from._internal_has_producer_name()) { |
2626 | producer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_producer_name(), |
2627 | GetArena()); |
2628 | } |
2629 | producer_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
2630 | if (from._internal_has_producer_version()) { |
2631 | producer_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_producer_version(), |
2632 | GetArena()); |
2633 | } |
2634 | if (from._internal_has_main_module()) { |
2635 | main_module_ = new ::torch::ModuleDef(*from.main_module_); |
2636 | } else { |
2637 | main_module_ = nullptr; |
2638 | } |
2639 | proto_version_ = from.proto_version_; |
2640 | // @@protoc_insertion_point(copy_constructor:torch.ModelDef) |
2641 | } |
2642 | |
2643 | void ModelDef::SharedCtor() { |
2644 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ModelDef_caffe2_2fproto_2ftorch_2eproto.base); |
2645 | producer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
2646 | producer_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
2647 | ::memset(&main_module_, 0, static_cast<size_t>( |
2648 | reinterpret_cast<char*>(&proto_version_) - |
2649 | reinterpret_cast<char*>(&main_module_)) + sizeof(proto_version_)); |
2650 | } |
2651 | |
2652 | ModelDef::~ModelDef() { |
2653 | // @@protoc_insertion_point(destructor:torch.ModelDef) |
2654 | SharedDtor(); |
2655 | _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
2656 | } |
2657 | |
2658 | void ModelDef::SharedDtor() { |
2659 | GOOGLE_DCHECK(GetArena() == nullptr); |
2660 | producer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
2661 | producer_version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); |
2662 | if (this != internal_default_instance()) delete main_module_; |
2663 | } |
2664 | |
2665 | void ModelDef::ArenaDtor(void* object) { |
2666 | ModelDef* _this = reinterpret_cast< ModelDef* >(object); |
2667 | (void)_this; |
2668 | } |
2669 | void ModelDef::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { |
2670 | } |
2671 | void ModelDef::SetCachedSize(int size) const { |
2672 | _cached_size_.Set(size); |
2673 | } |
2674 | const ModelDef& ModelDef::default_instance() { |
2675 | ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ModelDef_caffe2_2fproto_2ftorch_2eproto.base); |
2676 | return *internal_default_instance(); |
2677 | } |
2678 | |
2679 | |
2680 | void ModelDef::Clear() { |
2681 | // @@protoc_insertion_point(message_clear_start:torch.ModelDef) |
2682 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2683 | // Prevent compiler warnings about cached_has_bits being unused |
2684 | (void) cached_has_bits; |
2685 | |
2686 | tensors_.Clear(); |
2687 | cached_has_bits = _has_bits_[0]; |
2688 | if (cached_has_bits & 0x00000007u) { |
2689 | if (cached_has_bits & 0x00000001u) { |
2690 | producer_name_.ClearNonDefaultToEmpty(); |
2691 | } |
2692 | if (cached_has_bits & 0x00000002u) { |
2693 | producer_version_.ClearNonDefaultToEmpty(); |
2694 | } |
2695 | if (cached_has_bits & 0x00000004u) { |
2696 | GOOGLE_DCHECK(main_module_ != nullptr); |
2697 | main_module_->Clear(); |
2698 | } |
2699 | } |
2700 | proto_version_ = PROTOBUF_LONGLONG(0); |
2701 | _has_bits_.Clear(); |
2702 | _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); |
2703 | } |
2704 | |
2705 | const char* ModelDef::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { |
2706 | #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure |
2707 | _Internal::HasBits has_bits{}; |
2708 | ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; |
2709 | while (!ctx->Done(&ptr)) { |
2710 | ::PROTOBUF_NAMESPACE_ID::uint32 tag; |
2711 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); |
2712 | CHK_(ptr); |
2713 | switch (tag >> 3) { |
2714 | // optional int64 proto_version = 1; |
2715 | case 1: |
2716 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { |
2717 | _Internal::set_has_proto_version(&has_bits); |
2718 | proto_version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); |
2719 | CHK_(ptr); |
2720 | } else goto handle_unusual; |
2721 | continue; |
2722 | // optional .torch.ModuleDef main_module = 2; |
2723 | case 2: |
2724 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { |
2725 | ptr = ctx->ParseMessage(_internal_mutable_main_module(), ptr); |
2726 | CHK_(ptr); |
2727 | } else goto handle_unusual; |
2728 | continue; |
2729 | // optional string producer_name = 3; |
2730 | case 3: |
2731 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { |
2732 | auto str = _internal_mutable_producer_name(); |
2733 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
2734 | #ifndef NDEBUG |
2735 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.ModelDef.producer_name" ); |
2736 | #endif // !NDEBUG |
2737 | CHK_(ptr); |
2738 | } else goto handle_unusual; |
2739 | continue; |
2740 | // optional string producer_version = 4; |
2741 | case 4: |
2742 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) { |
2743 | auto str = _internal_mutable_producer_version(); |
2744 | ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); |
2745 | #ifndef NDEBUG |
2746 | ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "torch.ModelDef.producer_version" ); |
2747 | #endif // !NDEBUG |
2748 | CHK_(ptr); |
2749 | } else goto handle_unusual; |
2750 | continue; |
2751 | // repeated .torch.TensorDef tensors = 5; |
2752 | case 5: |
2753 | if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) { |
2754 | ptr -= 1; |
2755 | do { |
2756 | ptr += 1; |
2757 | ptr = ctx->ParseMessage(_internal_add_tensors(), ptr); |
2758 | CHK_(ptr); |
2759 | if (!ctx->DataAvailable(ptr)) break; |
2760 | } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); |
2761 | } else goto handle_unusual; |
2762 | continue; |
2763 | default: { |
2764 | handle_unusual: |
2765 | if ((tag & 7) == 4 || tag == 0) { |
2766 | ctx->SetLastTag(tag); |
2767 | goto success; |
2768 | } |
2769 | ptr = UnknownFieldParse(tag, |
2770 | _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), |
2771 | ptr, ctx); |
2772 | CHK_(ptr != nullptr); |
2773 | continue; |
2774 | } |
2775 | } // switch |
2776 | } // while |
2777 | success: |
2778 | _has_bits_.Or(has_bits); |
2779 | return ptr; |
2780 | failure: |
2781 | ptr = nullptr; |
2782 | goto success; |
2783 | #undef CHK_ |
2784 | } |
2785 | |
2786 | ::PROTOBUF_NAMESPACE_ID::uint8* ModelDef::_InternalSerialize( |
2787 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { |
2788 | // @@protoc_insertion_point(serialize_to_array_start:torch.ModelDef) |
2789 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2790 | (void) cached_has_bits; |
2791 | |
2792 | cached_has_bits = _has_bits_[0]; |
2793 | // optional int64 proto_version = 1; |
2794 | if (cached_has_bits & 0x00000008u) { |
2795 | target = stream->EnsureSpace(target); |
2796 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_proto_version(), target); |
2797 | } |
2798 | |
2799 | // optional .torch.ModuleDef main_module = 2; |
2800 | if (cached_has_bits & 0x00000004u) { |
2801 | target = stream->EnsureSpace(target); |
2802 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2803 | InternalWriteMessage( |
2804 | 2, _Internal::main_module(this), target, stream); |
2805 | } |
2806 | |
2807 | // optional string producer_name = 3; |
2808 | if (cached_has_bits & 0x00000001u) { |
2809 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
2810 | this->_internal_producer_name().data(), static_cast<int>(this->_internal_producer_name().length()), |
2811 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
2812 | "torch.ModelDef.producer_name" ); |
2813 | target = stream->WriteStringMaybeAliased( |
2814 | 3, this->_internal_producer_name(), target); |
2815 | } |
2816 | |
2817 | // optional string producer_version = 4; |
2818 | if (cached_has_bits & 0x00000002u) { |
2819 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( |
2820 | this->_internal_producer_version().data(), static_cast<int>(this->_internal_producer_version().length()), |
2821 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, |
2822 | "torch.ModelDef.producer_version" ); |
2823 | target = stream->WriteStringMaybeAliased( |
2824 | 4, this->_internal_producer_version(), target); |
2825 | } |
2826 | |
2827 | // repeated .torch.TensorDef tensors = 5; |
2828 | for (unsigned int i = 0, |
2829 | n = static_cast<unsigned int>(this->_internal_tensors_size()); i < n; i++) { |
2830 | target = stream->EnsureSpace(target); |
2831 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: |
2832 | InternalWriteMessage(5, this->_internal_tensors(i), target, stream); |
2833 | } |
2834 | |
2835 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
2836 | target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( |
2837 | _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); |
2838 | } |
2839 | // @@protoc_insertion_point(serialize_to_array_end:torch.ModelDef) |
2840 | return target; |
2841 | } |
2842 | |
2843 | size_t ModelDef::ByteSizeLong() const { |
2844 | // @@protoc_insertion_point(message_byte_size_start:torch.ModelDef) |
2845 | size_t total_size = 0; |
2846 | |
2847 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2848 | // Prevent compiler warnings about cached_has_bits being unused |
2849 | (void) cached_has_bits; |
2850 | |
2851 | // repeated .torch.TensorDef tensors = 5; |
2852 | total_size += 1UL * this->_internal_tensors_size(); |
2853 | for (const auto& msg : this->tensors_) { |
2854 | total_size += |
2855 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); |
2856 | } |
2857 | |
2858 | cached_has_bits = _has_bits_[0]; |
2859 | if (cached_has_bits & 0x0000000fu) { |
2860 | // optional string producer_name = 3; |
2861 | if (cached_has_bits & 0x00000001u) { |
2862 | total_size += 1 + |
2863 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
2864 | this->_internal_producer_name()); |
2865 | } |
2866 | |
2867 | // optional string producer_version = 4; |
2868 | if (cached_has_bits & 0x00000002u) { |
2869 | total_size += 1 + |
2870 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( |
2871 | this->_internal_producer_version()); |
2872 | } |
2873 | |
2874 | // optional .torch.ModuleDef main_module = 2; |
2875 | if (cached_has_bits & 0x00000004u) { |
2876 | total_size += 1 + |
2877 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( |
2878 | *main_module_); |
2879 | } |
2880 | |
2881 | // optional int64 proto_version = 1; |
2882 | if (cached_has_bits & 0x00000008u) { |
2883 | total_size += 1 + |
2884 | ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( |
2885 | this->_internal_proto_version()); |
2886 | } |
2887 | |
2888 | } |
2889 | if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { |
2890 | return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( |
2891 | _internal_metadata_, total_size, &_cached_size_); |
2892 | } |
2893 | int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); |
2894 | SetCachedSize(cached_size); |
2895 | return total_size; |
2896 | } |
2897 | |
2898 | void ModelDef::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
2899 | // @@protoc_insertion_point(generalized_merge_from_start:torch.ModelDef) |
2900 | GOOGLE_DCHECK_NE(&from, this); |
2901 | const ModelDef* source = |
2902 | ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ModelDef>( |
2903 | &from); |
2904 | if (source == nullptr) { |
2905 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:torch.ModelDef) |
2906 | ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); |
2907 | } else { |
2908 | // @@protoc_insertion_point(generalized_merge_from_cast_success:torch.ModelDef) |
2909 | MergeFrom(*source); |
2910 | } |
2911 | } |
2912 | |
2913 | void ModelDef::MergeFrom(const ModelDef& from) { |
2914 | // @@protoc_insertion_point(class_specific_merge_from_start:torch.ModelDef) |
2915 | GOOGLE_DCHECK_NE(&from, this); |
2916 | _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); |
2917 | ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; |
2918 | (void) cached_has_bits; |
2919 | |
2920 | tensors_.MergeFrom(from.tensors_); |
2921 | cached_has_bits = from._has_bits_[0]; |
2922 | if (cached_has_bits & 0x0000000fu) { |
2923 | if (cached_has_bits & 0x00000001u) { |
2924 | _internal_set_producer_name(from._internal_producer_name()); |
2925 | } |
2926 | if (cached_has_bits & 0x00000002u) { |
2927 | _internal_set_producer_version(from._internal_producer_version()); |
2928 | } |
2929 | if (cached_has_bits & 0x00000004u) { |
2930 | _internal_mutable_main_module()->::torch::ModuleDef::MergeFrom(from._internal_main_module()); |
2931 | } |
2932 | if (cached_has_bits & 0x00000008u) { |
2933 | proto_version_ = from.proto_version_; |
2934 | } |
2935 | _has_bits_[0] |= cached_has_bits; |
2936 | } |
2937 | } |
2938 | |
2939 | void ModelDef::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { |
2940 | // @@protoc_insertion_point(generalized_copy_from_start:torch.ModelDef) |
2941 | if (&from == this) return; |
2942 | Clear(); |
2943 | MergeFrom(from); |
2944 | } |
2945 | |
2946 | void ModelDef::CopyFrom(const ModelDef& from) { |
2947 | // @@protoc_insertion_point(class_specific_copy_from_start:torch.ModelDef) |
2948 | if (&from == this) return; |
2949 | Clear(); |
2950 | MergeFrom(from); |
2951 | } |
2952 | |
2953 | bool ModelDef::IsInitialized() const { |
2954 | if (_internal_has_main_module()) { |
2955 | if (!main_module_->IsInitialized()) return false; |
2956 | } |
2957 | return true; |
2958 | } |
2959 | |
2960 | void ModelDef::InternalSwap(ModelDef* other) { |
2961 | using std::swap; |
2962 | _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); |
2963 | swap(_has_bits_[0], other->_has_bits_[0]); |
2964 | tensors_.InternalSwap(&other->tensors_); |
2965 | producer_name_.Swap(&other->producer_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
2966 | producer_version_.Swap(&other->producer_version_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); |
2967 | ::PROTOBUF_NAMESPACE_ID::internal::memswap< |
2968 | PROTOBUF_FIELD_OFFSET(ModelDef, proto_version_) |
2969 | + sizeof(ModelDef::proto_version_) |
2970 | - PROTOBUF_FIELD_OFFSET(ModelDef, main_module_)>( |
2971 | reinterpret_cast<char*>(&main_module_), |
2972 | reinterpret_cast<char*>(&other->main_module_)); |
2973 | } |
2974 | |
2975 | ::PROTOBUF_NAMESPACE_ID::Metadata ModelDef::GetMetadata() const { |
2976 | return GetMetadataStatic(); |
2977 | } |
2978 | |
2979 | |
2980 | // @@protoc_insertion_point(namespace_scope) |
2981 | } // namespace torch |
2982 | PROTOBUF_NAMESPACE_OPEN |
2983 | template<> PROTOBUF_NOINLINE ::torch::RecordRef* Arena::CreateMaybeMessage< ::torch::RecordRef >(Arena* arena) { |
2984 | return Arena::CreateMessageInternal< ::torch::RecordRef >(arena); |
2985 | } |
2986 | template<> PROTOBUF_NOINLINE ::torch::TensorDef* Arena::CreateMaybeMessage< ::torch::TensorDef >(Arena* arena) { |
2987 | return Arena::CreateMessageInternal< ::torch::TensorDef >(arena); |
2988 | } |
2989 | template<> PROTOBUF_NOINLINE ::torch::AttributeDef* Arena::CreateMaybeMessage< ::torch::AttributeDef >(Arena* arena) { |
2990 | return Arena::CreateMessageInternal< ::torch::AttributeDef >(arena); |
2991 | } |
2992 | template<> PROTOBUF_NOINLINE ::torch::ParameterDef* Arena::CreateMaybeMessage< ::torch::ParameterDef >(Arena* arena) { |
2993 | return Arena::CreateMessageInternal< ::torch::ParameterDef >(arena); |
2994 | } |
2995 | template<> PROTOBUF_NOINLINE ::torch::ModuleDef* Arena::CreateMaybeMessage< ::torch::ModuleDef >(Arena* arena) { |
2996 | return Arena::CreateMessageInternal< ::torch::ModuleDef >(arena); |
2997 | } |
2998 | template<> PROTOBUF_NOINLINE ::torch::LibDef* Arena::CreateMaybeMessage< ::torch::LibDef >(Arena* arena) { |
2999 | return Arena::CreateMessageInternal< ::torch::LibDef >(arena); |
3000 | } |
3001 | template<> PROTOBUF_NOINLINE ::torch::ModelDef* Arena::CreateMaybeMessage< ::torch::ModelDef >(Arena* arena) { |
3002 | return Arena::CreateMessageInternal< ::torch::ModelDef >(arena); |
3003 | } |
3004 | PROTOBUF_NAMESPACE_CLOSE |
3005 | |
3006 | // @@protoc_insertion_point(global_scope) |
3007 | #include <google/protobuf/port_undef.inc> |
3008 | |