1// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: tensorflow/dtensor/proto/layout.proto
3
4#include "tensorflow/dtensor/proto/layout.pb.h"
5
6#include <algorithm>
7
8#include <google/protobuf/stubs/common.h>
9#include <google/protobuf/io/coded_stream.h>
10#include <google/protobuf/extension_set.h>
11#include <google/protobuf/wire_format_lite.h>
12#include <google/protobuf/descriptor.h>
13#include <google/protobuf/generated_message_reflection.h>
14#include <google/protobuf/reflection_ops.h>
15#include <google/protobuf/wire_format.h>
16// @@protoc_insertion_point(includes)
17#include <google/protobuf/port_def.inc>
18extern PROTOBUF_INTERNAL_EXPORT_tensorflow_2fdtensor_2fproto_2flayout_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto;
19extern PROTOBUF_INTERNAL_EXPORT_tensorflow_2fdtensor_2fproto_2flayout_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto;
20extern PROTOBUF_INTERNAL_EXPORT_tensorflow_2fdtensor_2fproto_2flayout_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto;
21namespace tensorflow {
22namespace dtensor {
23class ShardingSpecDefaultTypeInternal {
24 public:
25 ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<ShardingSpec> _instance;
26} _ShardingSpec_default_instance_;
27class MeshDimensionProtoDefaultTypeInternal {
28 public:
29 ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<MeshDimensionProto> _instance;
30} _MeshDimensionProto_default_instance_;
31class LayoutProtoDefaultTypeInternal {
32 public:
33 ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<LayoutProto> _instance;
34} _LayoutProto_default_instance_;
35class MeshProtoDefaultTypeInternal {
36 public:
37 ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<MeshProto> _instance;
38} _MeshProto_default_instance_;
39} // namespace dtensor
40} // namespace tensorflow
41static void InitDefaultsscc_info_LayoutProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto() {
42 GOOGLE_PROTOBUF_VERIFY_VERSION;
43
44 {
45 void* ptr = &::tensorflow::dtensor::_LayoutProto_default_instance_;
46 new (ptr) ::tensorflow::dtensor::LayoutProto();
47 ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
48 }
49 ::tensorflow::dtensor::LayoutProto::InitAsDefaultInstance();
50}
51
52::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_LayoutProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto =
53 {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, InitDefaultsscc_info_LayoutProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto}, {
54 &scc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,
55 &scc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,}};
56
57static void InitDefaultsscc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto() {
58 GOOGLE_PROTOBUF_VERIFY_VERSION;
59
60 {
61 void* ptr = &::tensorflow::dtensor::_MeshDimensionProto_default_instance_;
62 new (ptr) ::tensorflow::dtensor::MeshDimensionProto();
63 ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
64 }
65 ::tensorflow::dtensor::MeshDimensionProto::InitAsDefaultInstance();
66}
67
68::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto =
69 {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto}, {}};
70
71static void InitDefaultsscc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto() {
72 GOOGLE_PROTOBUF_VERIFY_VERSION;
73
74 {
75 void* ptr = &::tensorflow::dtensor::_MeshProto_default_instance_;
76 new (ptr) ::tensorflow::dtensor::MeshProto();
77 ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
78 }
79 ::tensorflow::dtensor::MeshProto::InitAsDefaultInstance();
80}
81
82::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto =
83 {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsscc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto}, {
84 &scc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,}};
85
86static void InitDefaultsscc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto() {
87 GOOGLE_PROTOBUF_VERIFY_VERSION;
88
89 {
90 void* ptr = &::tensorflow::dtensor::_ShardingSpec_default_instance_;
91 new (ptr) ::tensorflow::dtensor::ShardingSpec();
92 ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
93 }
94 ::tensorflow::dtensor::ShardingSpec::InitAsDefaultInstance();
95}
96
97::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto =
98 {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto}, {}};
99
100static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_tensorflow_2fdtensor_2fproto_2flayout_2eproto[4];
101static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_tensorflow_2fdtensor_2fproto_2flayout_2eproto = nullptr;
102static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_tensorflow_2fdtensor_2fproto_2flayout_2eproto = nullptr;
103
104const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_tensorflow_2fdtensor_2fproto_2flayout_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
105 ~0u, // no _has_bits_
106 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::ShardingSpec, _internal_metadata_),
107 ~0u, // no _extensions_
108 ~0u, // no _oneof_case_
109 ~0u, // no _weak_field_map_
110 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::ShardingSpec, sharding_spec_),
111 ~0u, // no _has_bits_
112 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshDimensionProto, _internal_metadata_),
113 ~0u, // no _extensions_
114 ~0u, // no _oneof_case_
115 ~0u, // no _weak_field_map_
116 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshDimensionProto, name_),
117 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshDimensionProto, size_),
118 ~0u, // no _has_bits_
119 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::LayoutProto, _internal_metadata_),
120 ~0u, // no _extensions_
121 ~0u, // no _oneof_case_
122 ~0u, // no _weak_field_map_
123 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::LayoutProto, sharding_specs_),
124 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::LayoutProto, mesh_config_),
125 ~0u, // no _has_bits_
126 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, _internal_metadata_),
127 ~0u, // no _extensions_
128 ~0u, // no _oneof_case_
129 ~0u, // no _weak_field_map_
130 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, mesh_dimensions_),
131 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, global_device_ids_),
132 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, local_device_ids_),
133 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, local_devices_),
134 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, global_devices_),
135 PROTOBUF_FIELD_OFFSET(::tensorflow::dtensor::MeshProto, name_),
136};
137static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
138 { 0, -1, sizeof(::tensorflow::dtensor::ShardingSpec)},
139 { 6, -1, sizeof(::tensorflow::dtensor::MeshDimensionProto)},
140 { 13, -1, sizeof(::tensorflow::dtensor::LayoutProto)},
141 { 20, -1, sizeof(::tensorflow::dtensor::MeshProto)},
142};
143
144static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
145 reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::tensorflow::dtensor::_ShardingSpec_default_instance_),
146 reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::tensorflow::dtensor::_MeshDimensionProto_default_instance_),
147 reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::tensorflow::dtensor::_LayoutProto_default_instance_),
148 reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::tensorflow::dtensor::_MeshProto_default_instance_),
149};
150
151const char descriptor_table_protodef_tensorflow_2fdtensor_2fproto_2flayout_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
152 "\n%tensorflow/dtensor/proto/layout.proto\022"
153 "\022tensorflow.dtensor\"+\n\014ShardingSpec\022\025\n\rs"
154 "harding_spec\030\002 \001(\tJ\004\010\001\020\002\"0\n\022MeshDimensio"
155 "nProto\022\014\n\004name\030\001 \001(\t\022\014\n\004size\030\002 \001(\003\"{\n\013La"
156 "youtProto\0228\n\016sharding_specs\030\001 \003(\0132 .tens"
157 "orflow.dtensor.ShardingSpec\0222\n\013mesh_conf"
158 "ig\030\002 \001(\0132\035.tensorflow.dtensor.MeshProto\""
159 "\276\001\n\tMeshProto\022\?\n\017mesh_dimensions\030\001 \003(\0132&"
160 ".tensorflow.dtensor.MeshDimensionProto\022\031"
161 "\n\021global_device_ids\030\002 \003(\003\022\030\n\020local_devic"
162 "e_ids\030\004 \003(\003\022\025\n\rlocal_devices\030\005 \003(\t\022\026\n\016gl"
163 "obal_devices\030\006 \003(\t\022\014\n\004name\030\003 \001(\tb\006proto3"
164 ;
165static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_deps[1] = {
166};
167static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_sccs[4] = {
168 &scc_info_LayoutProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,
169 &scc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,
170 &scc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,
171 &scc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base,
172};
173static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_once;
174static bool descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_initialized = false;
175const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto = {
176 &descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_initialized, descriptor_table_protodef_tensorflow_2fdtensor_2fproto_2flayout_2eproto, "tensorflow/dtensor/proto/layout.proto", 480,
177 &descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_once, descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_sccs, descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto_deps, 4, 0,
178 schemas, file_default_instances, TableStruct_tensorflow_2fdtensor_2fproto_2flayout_2eproto::offsets,
179 file_level_metadata_tensorflow_2fdtensor_2fproto_2flayout_2eproto, 4, file_level_enum_descriptors_tensorflow_2fdtensor_2fproto_2flayout_2eproto, file_level_service_descriptors_tensorflow_2fdtensor_2fproto_2flayout_2eproto,
180};
181
182// Force running AddDescriptors() at dynamic initialization time.
183static bool dynamic_init_dummy_tensorflow_2fdtensor_2fproto_2flayout_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_tensorflow_2fdtensor_2fproto_2flayout_2eproto), true);
184namespace tensorflow {
185namespace dtensor {
186
187// ===================================================================
188
189void ShardingSpec::InitAsDefaultInstance() {
190}
191class ShardingSpec::_Internal {
192 public:
193};
194
195ShardingSpec::ShardingSpec()
196 : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
197 SharedCtor();
198 // @@protoc_insertion_point(constructor:tensorflow.dtensor.ShardingSpec)
199}
200ShardingSpec::ShardingSpec(const ShardingSpec& from)
201 : ::PROTOBUF_NAMESPACE_ID::Message(),
202 _internal_metadata_(nullptr) {
203 _internal_metadata_.MergeFrom(from._internal_metadata_);
204 sharding_spec_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
205 if (!from.sharding_spec().empty()) {
206 sharding_spec_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.sharding_spec_);
207 }
208 // @@protoc_insertion_point(copy_constructor:tensorflow.dtensor.ShardingSpec)
209}
210
211void ShardingSpec::SharedCtor() {
212 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
213 sharding_spec_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
214}
215
216ShardingSpec::~ShardingSpec() {
217 // @@protoc_insertion_point(destructor:tensorflow.dtensor.ShardingSpec)
218 SharedDtor();
219}
220
221void ShardingSpec::SharedDtor() {
222 sharding_spec_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
223}
224
225void ShardingSpec::SetCachedSize(int size) const {
226 _cached_size_.Set(size);
227}
228const ShardingSpec& ShardingSpec::default_instance() {
229 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_ShardingSpec_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
230 return *internal_default_instance();
231}
232
233
234void ShardingSpec::Clear() {
235// @@protoc_insertion_point(message_clear_start:tensorflow.dtensor.ShardingSpec)
236 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
237 // Prevent compiler warnings about cached_has_bits being unused
238 (void) cached_has_bits;
239
240 sharding_spec_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
241 _internal_metadata_.Clear();
242}
243
244#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
245const char* ShardingSpec::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
246#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
247 while (!ctx->Done(&ptr)) {
248 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
249 ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
250 CHK_(ptr);
251 switch (tag >> 3) {
252 // string sharding_spec = 2;
253 case 2:
254 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
255 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_sharding_spec(), ptr, ctx, "tensorflow.dtensor.ShardingSpec.sharding_spec");
256 CHK_(ptr);
257 } else goto handle_unusual;
258 continue;
259 default: {
260 handle_unusual:
261 if ((tag & 7) == 4 || tag == 0) {
262 ctx->SetLastTag(tag);
263 goto success;
264 }
265 ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
266 CHK_(ptr != nullptr);
267 continue;
268 }
269 } // switch
270 } // while
271success:
272 return ptr;
273failure:
274 ptr = nullptr;
275 goto success;
276#undef CHK_
277}
278#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
279bool ShardingSpec::MergePartialFromCodedStream(
280 ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
281#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
282 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
283 // @@protoc_insertion_point(parse_start:tensorflow.dtensor.ShardingSpec)
284 for (;;) {
285 ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
286 tag = p.first;
287 if (!p.second) goto handle_unusual;
288 switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
289 // string sharding_spec = 2;
290 case 2: {
291 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
292 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
293 input, this->mutable_sharding_spec()));
294 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
295 this->sharding_spec().data(), static_cast<int>(this->sharding_spec().length()),
296 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
297 "tensorflow.dtensor.ShardingSpec.sharding_spec"));
298 } else {
299 goto handle_unusual;
300 }
301 break;
302 }
303
304 default: {
305 handle_unusual:
306 if (tag == 0) {
307 goto success;
308 }
309 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
310 input, tag, _internal_metadata_.mutable_unknown_fields()));
311 break;
312 }
313 }
314 }
315success:
316 // @@protoc_insertion_point(parse_success:tensorflow.dtensor.ShardingSpec)
317 return true;
318failure:
319 // @@protoc_insertion_point(parse_failure:tensorflow.dtensor.ShardingSpec)
320 return false;
321#undef DO_
322}
323#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
324
325void ShardingSpec::SerializeWithCachedSizes(
326 ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
327 // @@protoc_insertion_point(serialize_start:tensorflow.dtensor.ShardingSpec)
328 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
329 (void) cached_has_bits;
330
331 // string sharding_spec = 2;
332 if (this->sharding_spec().size() > 0) {
333 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
334 this->sharding_spec().data(), static_cast<int>(this->sharding_spec().length()),
335 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
336 "tensorflow.dtensor.ShardingSpec.sharding_spec");
337 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased(
338 2, this->sharding_spec(), output);
339 }
340
341 if (_internal_metadata_.have_unknown_fields()) {
342 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
343 _internal_metadata_.unknown_fields(), output);
344 }
345 // @@protoc_insertion_point(serialize_end:tensorflow.dtensor.ShardingSpec)
346}
347
348::PROTOBUF_NAMESPACE_ID::uint8* ShardingSpec::InternalSerializeWithCachedSizesToArray(
349 ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
350 // @@protoc_insertion_point(serialize_to_array_start:tensorflow.dtensor.ShardingSpec)
351 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
352 (void) cached_has_bits;
353
354 // string sharding_spec = 2;
355 if (this->sharding_spec().size() > 0) {
356 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
357 this->sharding_spec().data(), static_cast<int>(this->sharding_spec().length()),
358 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
359 "tensorflow.dtensor.ShardingSpec.sharding_spec");
360 target =
361 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray(
362 2, this->sharding_spec(), target);
363 }
364
365 if (_internal_metadata_.have_unknown_fields()) {
366 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
367 _internal_metadata_.unknown_fields(), target);
368 }
369 // @@protoc_insertion_point(serialize_to_array_end:tensorflow.dtensor.ShardingSpec)
370 return target;
371}
372
373size_t ShardingSpec::ByteSizeLong() const {
374// @@protoc_insertion_point(message_byte_size_start:tensorflow.dtensor.ShardingSpec)
375 size_t total_size = 0;
376
377 if (_internal_metadata_.have_unknown_fields()) {
378 total_size +=
379 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
380 _internal_metadata_.unknown_fields());
381 }
382 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
383 // Prevent compiler warnings about cached_has_bits being unused
384 (void) cached_has_bits;
385
386 // string sharding_spec = 2;
387 if (this->sharding_spec().size() > 0) {
388 total_size += 1 +
389 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
390 this->sharding_spec());
391 }
392
393 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
394 SetCachedSize(cached_size);
395 return total_size;
396}
397
398void ShardingSpec::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
399// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.dtensor.ShardingSpec)
400 GOOGLE_DCHECK_NE(&from, this);
401 const ShardingSpec* source =
402 ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ShardingSpec>(
403 &from);
404 if (source == nullptr) {
405 // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.dtensor.ShardingSpec)
406 ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
407 } else {
408 // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.dtensor.ShardingSpec)
409 MergeFrom(*source);
410 }
411}
412
413void ShardingSpec::MergeFrom(const ShardingSpec& from) {
414// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.dtensor.ShardingSpec)
415 GOOGLE_DCHECK_NE(&from, this);
416 _internal_metadata_.MergeFrom(from._internal_metadata_);
417 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
418 (void) cached_has_bits;
419
420 if (from.sharding_spec().size() > 0) {
421
422 sharding_spec_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.sharding_spec_);
423 }
424}
425
426void ShardingSpec::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
427// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.dtensor.ShardingSpec)
428 if (&from == this) return;
429 Clear();
430 MergeFrom(from);
431}
432
433void ShardingSpec::CopyFrom(const ShardingSpec& from) {
434// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.dtensor.ShardingSpec)
435 if (&from == this) return;
436 Clear();
437 MergeFrom(from);
438}
439
440bool ShardingSpec::IsInitialized() const {
441 return true;
442}
443
444void ShardingSpec::InternalSwap(ShardingSpec* other) {
445 using std::swap;
446 _internal_metadata_.Swap(&other->_internal_metadata_);
447 sharding_spec_.Swap(&other->sharding_spec_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
448 GetArenaNoVirtual());
449}
450
451::PROTOBUF_NAMESPACE_ID::Metadata ShardingSpec::GetMetadata() const {
452 return GetMetadataStatic();
453}
454
455
456// ===================================================================
457
458void MeshDimensionProto::InitAsDefaultInstance() {
459}
460class MeshDimensionProto::_Internal {
461 public:
462};
463
464MeshDimensionProto::MeshDimensionProto()
465 : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
466 SharedCtor();
467 // @@protoc_insertion_point(constructor:tensorflow.dtensor.MeshDimensionProto)
468}
469MeshDimensionProto::MeshDimensionProto(const MeshDimensionProto& from)
470 : ::PROTOBUF_NAMESPACE_ID::Message(),
471 _internal_metadata_(nullptr) {
472 _internal_metadata_.MergeFrom(from._internal_metadata_);
473 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
474 if (!from.name().empty()) {
475 name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
476 }
477 size_ = from.size_;
478 // @@protoc_insertion_point(copy_constructor:tensorflow.dtensor.MeshDimensionProto)
479}
480
481void MeshDimensionProto::SharedCtor() {
482 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
483 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
484 size_ = PROTOBUF_LONGLONG(0);
485}
486
487MeshDimensionProto::~MeshDimensionProto() {
488 // @@protoc_insertion_point(destructor:tensorflow.dtensor.MeshDimensionProto)
489 SharedDtor();
490}
491
492void MeshDimensionProto::SharedDtor() {
493 name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
494}
495
496void MeshDimensionProto::SetCachedSize(int size) const {
497 _cached_size_.Set(size);
498}
499const MeshDimensionProto& MeshDimensionProto::default_instance() {
500 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_MeshDimensionProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
501 return *internal_default_instance();
502}
503
504
505void MeshDimensionProto::Clear() {
506// @@protoc_insertion_point(message_clear_start:tensorflow.dtensor.MeshDimensionProto)
507 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
508 // Prevent compiler warnings about cached_has_bits being unused
509 (void) cached_has_bits;
510
511 name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
512 size_ = PROTOBUF_LONGLONG(0);
513 _internal_metadata_.Clear();
514}
515
516#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
517const char* MeshDimensionProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
518#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
519 while (!ctx->Done(&ptr)) {
520 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
521 ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
522 CHK_(ptr);
523 switch (tag >> 3) {
524 // string name = 1;
525 case 1:
526 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
527 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "tensorflow.dtensor.MeshDimensionProto.name");
528 CHK_(ptr);
529 } else goto handle_unusual;
530 continue;
531 // int64 size = 2;
532 case 2:
533 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
534 size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
535 CHK_(ptr);
536 } else goto handle_unusual;
537 continue;
538 default: {
539 handle_unusual:
540 if ((tag & 7) == 4 || tag == 0) {
541 ctx->SetLastTag(tag);
542 goto success;
543 }
544 ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
545 CHK_(ptr != nullptr);
546 continue;
547 }
548 } // switch
549 } // while
550success:
551 return ptr;
552failure:
553 ptr = nullptr;
554 goto success;
555#undef CHK_
556}
557#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
558bool MeshDimensionProto::MergePartialFromCodedStream(
559 ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
560#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
561 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
562 // @@protoc_insertion_point(parse_start:tensorflow.dtensor.MeshDimensionProto)
563 for (;;) {
564 ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
565 tag = p.first;
566 if (!p.second) goto handle_unusual;
567 switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
568 // string name = 1;
569 case 1: {
570 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
571 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
572 input, this->mutable_name()));
573 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
574 this->name().data(), static_cast<int>(this->name().length()),
575 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
576 "tensorflow.dtensor.MeshDimensionProto.name"));
577 } else {
578 goto handle_unusual;
579 }
580 break;
581 }
582
583 // int64 size = 2;
584 case 2: {
585 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) {
586
587 DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive<
588 ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>(
589 input, &size_)));
590 } else {
591 goto handle_unusual;
592 }
593 break;
594 }
595
596 default: {
597 handle_unusual:
598 if (tag == 0) {
599 goto success;
600 }
601 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
602 input, tag, _internal_metadata_.mutable_unknown_fields()));
603 break;
604 }
605 }
606 }
607success:
608 // @@protoc_insertion_point(parse_success:tensorflow.dtensor.MeshDimensionProto)
609 return true;
610failure:
611 // @@protoc_insertion_point(parse_failure:tensorflow.dtensor.MeshDimensionProto)
612 return false;
613#undef DO_
614}
615#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
616
617void MeshDimensionProto::SerializeWithCachedSizes(
618 ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
619 // @@protoc_insertion_point(serialize_start:tensorflow.dtensor.MeshDimensionProto)
620 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
621 (void) cached_has_bits;
622
623 // string name = 1;
624 if (this->name().size() > 0) {
625 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
626 this->name().data(), static_cast<int>(this->name().length()),
627 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
628 "tensorflow.dtensor.MeshDimensionProto.name");
629 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased(
630 1, this->name(), output);
631 }
632
633 // int64 size = 2;
634 if (this->size() != 0) {
635 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64(2, this->size(), output);
636 }
637
638 if (_internal_metadata_.have_unknown_fields()) {
639 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
640 _internal_metadata_.unknown_fields(), output);
641 }
642 // @@protoc_insertion_point(serialize_end:tensorflow.dtensor.MeshDimensionProto)
643}
644
645::PROTOBUF_NAMESPACE_ID::uint8* MeshDimensionProto::InternalSerializeWithCachedSizesToArray(
646 ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
647 // @@protoc_insertion_point(serialize_to_array_start:tensorflow.dtensor.MeshDimensionProto)
648 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
649 (void) cached_has_bits;
650
651 // string name = 1;
652 if (this->name().size() > 0) {
653 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
654 this->name().data(), static_cast<int>(this->name().length()),
655 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
656 "tensorflow.dtensor.MeshDimensionProto.name");
657 target =
658 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray(
659 1, this->name(), target);
660 }
661
662 // int64 size = 2;
663 if (this->size() != 0) {
664 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->size(), target);
665 }
666
667 if (_internal_metadata_.have_unknown_fields()) {
668 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
669 _internal_metadata_.unknown_fields(), target);
670 }
671 // @@protoc_insertion_point(serialize_to_array_end:tensorflow.dtensor.MeshDimensionProto)
672 return target;
673}
674
675size_t MeshDimensionProto::ByteSizeLong() const {
676// @@protoc_insertion_point(message_byte_size_start:tensorflow.dtensor.MeshDimensionProto)
677 size_t total_size = 0;
678
679 if (_internal_metadata_.have_unknown_fields()) {
680 total_size +=
681 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
682 _internal_metadata_.unknown_fields());
683 }
684 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
685 // Prevent compiler warnings about cached_has_bits being unused
686 (void) cached_has_bits;
687
688 // string name = 1;
689 if (this->name().size() > 0) {
690 total_size += 1 +
691 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
692 this->name());
693 }
694
695 // int64 size = 2;
696 if (this->size() != 0) {
697 total_size += 1 +
698 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size(
699 this->size());
700 }
701
702 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
703 SetCachedSize(cached_size);
704 return total_size;
705}
706
707void MeshDimensionProto::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
708// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.dtensor.MeshDimensionProto)
709 GOOGLE_DCHECK_NE(&from, this);
710 const MeshDimensionProto* source =
711 ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<MeshDimensionProto>(
712 &from);
713 if (source == nullptr) {
714 // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.dtensor.MeshDimensionProto)
715 ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
716 } else {
717 // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.dtensor.MeshDimensionProto)
718 MergeFrom(*source);
719 }
720}
721
722void MeshDimensionProto::MergeFrom(const MeshDimensionProto& from) {
723// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.dtensor.MeshDimensionProto)
724 GOOGLE_DCHECK_NE(&from, this);
725 _internal_metadata_.MergeFrom(from._internal_metadata_);
726 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
727 (void) cached_has_bits;
728
729 if (from.name().size() > 0) {
730
731 name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
732 }
733 if (from.size() != 0) {
734 set_size(from.size());
735 }
736}
737
738void MeshDimensionProto::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
739// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.dtensor.MeshDimensionProto)
740 if (&from == this) return;
741 Clear();
742 MergeFrom(from);
743}
744
745void MeshDimensionProto::CopyFrom(const MeshDimensionProto& from) {
746// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.dtensor.MeshDimensionProto)
747 if (&from == this) return;
748 Clear();
749 MergeFrom(from);
750}
751
752bool MeshDimensionProto::IsInitialized() const {
753 return true;
754}
755
756void MeshDimensionProto::InternalSwap(MeshDimensionProto* other) {
757 using std::swap;
758 _internal_metadata_.Swap(&other->_internal_metadata_);
759 name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
760 GetArenaNoVirtual());
761 swap(size_, other->size_);
762}
763
764::PROTOBUF_NAMESPACE_ID::Metadata MeshDimensionProto::GetMetadata() const {
765 return GetMetadataStatic();
766}
767
768
769// ===================================================================
770
771void LayoutProto::InitAsDefaultInstance() {
772 ::tensorflow::dtensor::_LayoutProto_default_instance_._instance.get_mutable()->mesh_config_ = const_cast< ::tensorflow::dtensor::MeshProto*>(
773 ::tensorflow::dtensor::MeshProto::internal_default_instance());
774}
775class LayoutProto::_Internal {
776 public:
777 static const ::tensorflow::dtensor::MeshProto& mesh_config(const LayoutProto* msg);
778};
779
780const ::tensorflow::dtensor::MeshProto&
781LayoutProto::_Internal::mesh_config(const LayoutProto* msg) {
782 return *msg->mesh_config_;
783}
784LayoutProto::LayoutProto()
785 : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
786 SharedCtor();
787 // @@protoc_insertion_point(constructor:tensorflow.dtensor.LayoutProto)
788}
789LayoutProto::LayoutProto(const LayoutProto& from)
790 : ::PROTOBUF_NAMESPACE_ID::Message(),
791 _internal_metadata_(nullptr),
792 sharding_specs_(from.sharding_specs_) {
793 _internal_metadata_.MergeFrom(from._internal_metadata_);
794 if (from.has_mesh_config()) {
795 mesh_config_ = new ::tensorflow::dtensor::MeshProto(*from.mesh_config_);
796 } else {
797 mesh_config_ = nullptr;
798 }
799 // @@protoc_insertion_point(copy_constructor:tensorflow.dtensor.LayoutProto)
800}
801
802void LayoutProto::SharedCtor() {
803 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_LayoutProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
804 mesh_config_ = nullptr;
805}
806
807LayoutProto::~LayoutProto() {
808 // @@protoc_insertion_point(destructor:tensorflow.dtensor.LayoutProto)
809 SharedDtor();
810}
811
812void LayoutProto::SharedDtor() {
813 if (this != internal_default_instance()) delete mesh_config_;
814}
815
816void LayoutProto::SetCachedSize(int size) const {
817 _cached_size_.Set(size);
818}
819const LayoutProto& LayoutProto::default_instance() {
820 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_LayoutProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
821 return *internal_default_instance();
822}
823
824
825void LayoutProto::Clear() {
826// @@protoc_insertion_point(message_clear_start:tensorflow.dtensor.LayoutProto)
827 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
828 // Prevent compiler warnings about cached_has_bits being unused
829 (void) cached_has_bits;
830
831 sharding_specs_.Clear();
832 if (GetArenaNoVirtual() == nullptr && mesh_config_ != nullptr) {
833 delete mesh_config_;
834 }
835 mesh_config_ = nullptr;
836 _internal_metadata_.Clear();
837}
838
839#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
840const char* LayoutProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
841#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
842 while (!ctx->Done(&ptr)) {
843 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
844 ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
845 CHK_(ptr);
846 switch (tag >> 3) {
847 // repeated .tensorflow.dtensor.ShardingSpec sharding_specs = 1;
848 case 1:
849 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
850 ptr -= 1;
851 do {
852 ptr += 1;
853 ptr = ctx->ParseMessage(add_sharding_specs(), ptr);
854 CHK_(ptr);
855 if (!ctx->DataAvailable(ptr)) break;
856 } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
857 } else goto handle_unusual;
858 continue;
859 // .tensorflow.dtensor.MeshProto mesh_config = 2;
860 case 2:
861 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
862 ptr = ctx->ParseMessage(mutable_mesh_config(), ptr);
863 CHK_(ptr);
864 } else goto handle_unusual;
865 continue;
866 default: {
867 handle_unusual:
868 if ((tag & 7) == 4 || tag == 0) {
869 ctx->SetLastTag(tag);
870 goto success;
871 }
872 ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
873 CHK_(ptr != nullptr);
874 continue;
875 }
876 } // switch
877 } // while
878success:
879 return ptr;
880failure:
881 ptr = nullptr;
882 goto success;
883#undef CHK_
884}
885#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
886bool LayoutProto::MergePartialFromCodedStream(
887 ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
888#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
889 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
890 // @@protoc_insertion_point(parse_start:tensorflow.dtensor.LayoutProto)
891 for (;;) {
892 ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
893 tag = p.first;
894 if (!p.second) goto handle_unusual;
895 switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
896 // repeated .tensorflow.dtensor.ShardingSpec sharding_specs = 1;
897 case 1: {
898 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
899 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
900 input, add_sharding_specs()));
901 } else {
902 goto handle_unusual;
903 }
904 break;
905 }
906
907 // .tensorflow.dtensor.MeshProto mesh_config = 2;
908 case 2: {
909 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
910 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
911 input, mutable_mesh_config()));
912 } else {
913 goto handle_unusual;
914 }
915 break;
916 }
917
918 default: {
919 handle_unusual:
920 if (tag == 0) {
921 goto success;
922 }
923 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
924 input, tag, _internal_metadata_.mutable_unknown_fields()));
925 break;
926 }
927 }
928 }
929success:
930 // @@protoc_insertion_point(parse_success:tensorflow.dtensor.LayoutProto)
931 return true;
932failure:
933 // @@protoc_insertion_point(parse_failure:tensorflow.dtensor.LayoutProto)
934 return false;
935#undef DO_
936}
937#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
938
939void LayoutProto::SerializeWithCachedSizes(
940 ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
941 // @@protoc_insertion_point(serialize_start:tensorflow.dtensor.LayoutProto)
942 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
943 (void) cached_has_bits;
944
945 // repeated .tensorflow.dtensor.ShardingSpec sharding_specs = 1;
946 for (unsigned int i = 0,
947 n = static_cast<unsigned int>(this->sharding_specs_size()); i < n; i++) {
948 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
949 1,
950 this->sharding_specs(static_cast<int>(i)),
951 output);
952 }
953
954 // .tensorflow.dtensor.MeshProto mesh_config = 2;
955 if (this->has_mesh_config()) {
956 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
957 2, _Internal::mesh_config(this), output);
958 }
959
960 if (_internal_metadata_.have_unknown_fields()) {
961 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
962 _internal_metadata_.unknown_fields(), output);
963 }
964 // @@protoc_insertion_point(serialize_end:tensorflow.dtensor.LayoutProto)
965}
966
967::PROTOBUF_NAMESPACE_ID::uint8* LayoutProto::InternalSerializeWithCachedSizesToArray(
968 ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
969 // @@protoc_insertion_point(serialize_to_array_start:tensorflow.dtensor.LayoutProto)
970 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
971 (void) cached_has_bits;
972
973 // repeated .tensorflow.dtensor.ShardingSpec sharding_specs = 1;
974 for (unsigned int i = 0,
975 n = static_cast<unsigned int>(this->sharding_specs_size()); i < n; i++) {
976 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
977 InternalWriteMessageToArray(
978 1, this->sharding_specs(static_cast<int>(i)), target);
979 }
980
981 // .tensorflow.dtensor.MeshProto mesh_config = 2;
982 if (this->has_mesh_config()) {
983 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
984 InternalWriteMessageToArray(
985 2, _Internal::mesh_config(this), target);
986 }
987
988 if (_internal_metadata_.have_unknown_fields()) {
989 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
990 _internal_metadata_.unknown_fields(), target);
991 }
992 // @@protoc_insertion_point(serialize_to_array_end:tensorflow.dtensor.LayoutProto)
993 return target;
994}
995
996size_t LayoutProto::ByteSizeLong() const {
997// @@protoc_insertion_point(message_byte_size_start:tensorflow.dtensor.LayoutProto)
998 size_t total_size = 0;
999
1000 if (_internal_metadata_.have_unknown_fields()) {
1001 total_size +=
1002 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
1003 _internal_metadata_.unknown_fields());
1004 }
1005 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1006 // Prevent compiler warnings about cached_has_bits being unused
1007 (void) cached_has_bits;
1008
1009 // repeated .tensorflow.dtensor.ShardingSpec sharding_specs = 1;
1010 {
1011 unsigned int count = static_cast<unsigned int>(this->sharding_specs_size());
1012 total_size += 1UL * count;
1013 for (unsigned int i = 0; i < count; i++) {
1014 total_size +=
1015 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
1016 this->sharding_specs(static_cast<int>(i)));
1017 }
1018 }
1019
1020 // .tensorflow.dtensor.MeshProto mesh_config = 2;
1021 if (this->has_mesh_config()) {
1022 total_size += 1 +
1023 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
1024 *mesh_config_);
1025 }
1026
1027 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
1028 SetCachedSize(cached_size);
1029 return total_size;
1030}
1031
1032void LayoutProto::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
1033// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.dtensor.LayoutProto)
1034 GOOGLE_DCHECK_NE(&from, this);
1035 const LayoutProto* source =
1036 ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<LayoutProto>(
1037 &from);
1038 if (source == nullptr) {
1039 // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.dtensor.LayoutProto)
1040 ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
1041 } else {
1042 // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.dtensor.LayoutProto)
1043 MergeFrom(*source);
1044 }
1045}
1046
1047void LayoutProto::MergeFrom(const LayoutProto& from) {
1048// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.dtensor.LayoutProto)
1049 GOOGLE_DCHECK_NE(&from, this);
1050 _internal_metadata_.MergeFrom(from._internal_metadata_);
1051 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1052 (void) cached_has_bits;
1053
1054 sharding_specs_.MergeFrom(from.sharding_specs_);
1055 if (from.has_mesh_config()) {
1056 mutable_mesh_config()->::tensorflow::dtensor::MeshProto::MergeFrom(from.mesh_config());
1057 }
1058}
1059
1060void LayoutProto::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
1061// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.dtensor.LayoutProto)
1062 if (&from == this) return;
1063 Clear();
1064 MergeFrom(from);
1065}
1066
1067void LayoutProto::CopyFrom(const LayoutProto& from) {
1068// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.dtensor.LayoutProto)
1069 if (&from == this) return;
1070 Clear();
1071 MergeFrom(from);
1072}
1073
1074bool LayoutProto::IsInitialized() const {
1075 return true;
1076}
1077
1078void LayoutProto::InternalSwap(LayoutProto* other) {
1079 using std::swap;
1080 _internal_metadata_.Swap(&other->_internal_metadata_);
1081 CastToBase(&sharding_specs_)->InternalSwap(CastToBase(&other->sharding_specs_));
1082 swap(mesh_config_, other->mesh_config_);
1083}
1084
1085::PROTOBUF_NAMESPACE_ID::Metadata LayoutProto::GetMetadata() const {
1086 return GetMetadataStatic();
1087}
1088
1089
1090// ===================================================================
1091
1092void MeshProto::InitAsDefaultInstance() {
1093}
1094class MeshProto::_Internal {
1095 public:
1096};
1097
1098MeshProto::MeshProto()
1099 : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
1100 SharedCtor();
1101 // @@protoc_insertion_point(constructor:tensorflow.dtensor.MeshProto)
1102}
1103MeshProto::MeshProto(const MeshProto& from)
1104 : ::PROTOBUF_NAMESPACE_ID::Message(),
1105 _internal_metadata_(nullptr),
1106 mesh_dimensions_(from.mesh_dimensions_),
1107 global_device_ids_(from.global_device_ids_),
1108 local_device_ids_(from.local_device_ids_),
1109 local_devices_(from.local_devices_),
1110 global_devices_(from.global_devices_) {
1111 _internal_metadata_.MergeFrom(from._internal_metadata_);
1112 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
1113 if (!from.name().empty()) {
1114 name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
1115 }
1116 // @@protoc_insertion_point(copy_constructor:tensorflow.dtensor.MeshProto)
1117}
1118
1119void MeshProto::SharedCtor() {
1120 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
1121 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
1122}
1123
1124MeshProto::~MeshProto() {
1125 // @@protoc_insertion_point(destructor:tensorflow.dtensor.MeshProto)
1126 SharedDtor();
1127}
1128
1129void MeshProto::SharedDtor() {
1130 name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
1131}
1132
1133void MeshProto::SetCachedSize(int size) const {
1134 _cached_size_.Set(size);
1135}
1136const MeshProto& MeshProto::default_instance() {
1137 ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_MeshProto_tensorflow_2fdtensor_2fproto_2flayout_2eproto.base);
1138 return *internal_default_instance();
1139}
1140
1141
1142void MeshProto::Clear() {
1143// @@protoc_insertion_point(message_clear_start:tensorflow.dtensor.MeshProto)
1144 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1145 // Prevent compiler warnings about cached_has_bits being unused
1146 (void) cached_has_bits;
1147
1148 mesh_dimensions_.Clear();
1149 global_device_ids_.Clear();
1150 local_device_ids_.Clear();
1151 local_devices_.Clear();
1152 global_devices_.Clear();
1153 name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
1154 _internal_metadata_.Clear();
1155}
1156
1157#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
1158const char* MeshProto::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
1159#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
1160 while (!ctx->Done(&ptr)) {
1161 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
1162 ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
1163 CHK_(ptr);
1164 switch (tag >> 3) {
1165 // repeated .tensorflow.dtensor.MeshDimensionProto mesh_dimensions = 1;
1166 case 1:
1167 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
1168 ptr -= 1;
1169 do {
1170 ptr += 1;
1171 ptr = ctx->ParseMessage(add_mesh_dimensions(), ptr);
1172 CHK_(ptr);
1173 if (!ctx->DataAvailable(ptr)) break;
1174 } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 10);
1175 } else goto handle_unusual;
1176 continue;
1177 // repeated int64 global_device_ids = 2;
1178 case 2:
1179 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
1180 ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(mutable_global_device_ids(), ptr, ctx);
1181 CHK_(ptr);
1182 } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) {
1183 add_global_device_ids(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr));
1184 CHK_(ptr);
1185 } else goto handle_unusual;
1186 continue;
1187 // string name = 3;
1188 case 3:
1189 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
1190 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(mutable_name(), ptr, ctx, "tensorflow.dtensor.MeshProto.name");
1191 CHK_(ptr);
1192 } else goto handle_unusual;
1193 continue;
1194 // repeated int64 local_device_ids = 4;
1195 case 4:
1196 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
1197 ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt64Parser(mutable_local_device_ids(), ptr, ctx);
1198 CHK_(ptr);
1199 } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32) {
1200 add_local_device_ids(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr));
1201 CHK_(ptr);
1202 } else goto handle_unusual;
1203 continue;
1204 // repeated string local_devices = 5;
1205 case 5:
1206 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
1207 ptr -= 1;
1208 do {
1209 ptr += 1;
1210 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(add_local_devices(), ptr, ctx, "tensorflow.dtensor.MeshProto.local_devices");
1211 CHK_(ptr);
1212 if (!ctx->DataAvailable(ptr)) break;
1213 } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 42);
1214 } else goto handle_unusual;
1215 continue;
1216 // repeated string global_devices = 6;
1217 case 6:
1218 if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
1219 ptr -= 1;
1220 do {
1221 ptr += 1;
1222 ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8(add_global_devices(), ptr, ctx, "tensorflow.dtensor.MeshProto.global_devices");
1223 CHK_(ptr);
1224 if (!ctx->DataAvailable(ptr)) break;
1225 } while (::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<::PROTOBUF_NAMESPACE_ID::uint8>(ptr) == 50);
1226 } else goto handle_unusual;
1227 continue;
1228 default: {
1229 handle_unusual:
1230 if ((tag & 7) == 4 || tag == 0) {
1231 ctx->SetLastTag(tag);
1232 goto success;
1233 }
1234 ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
1235 CHK_(ptr != nullptr);
1236 continue;
1237 }
1238 } // switch
1239 } // while
1240success:
1241 return ptr;
1242failure:
1243 ptr = nullptr;
1244 goto success;
1245#undef CHK_
1246}
1247#else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
1248bool MeshProto::MergePartialFromCodedStream(
1249 ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) {
1250#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
1251 ::PROTOBUF_NAMESPACE_ID::uint32 tag;
1252 // @@protoc_insertion_point(parse_start:tensorflow.dtensor.MeshProto)
1253 for (;;) {
1254 ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
1255 tag = p.first;
1256 if (!p.second) goto handle_unusual;
1257 switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) {
1258 // repeated .tensorflow.dtensor.MeshDimensionProto mesh_dimensions = 1;
1259 case 1: {
1260 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (10 & 0xFF)) {
1261 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadMessage(
1262 input, add_mesh_dimensions()));
1263 } else {
1264 goto handle_unusual;
1265 }
1266 break;
1267 }
1268
1269 // repeated int64 global_device_ids = 2;
1270 case 2: {
1271 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (18 & 0xFF)) {
1272 DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitive<
1273 ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>(
1274 input, this->mutable_global_device_ids())));
1275 } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) {
1276 DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
1277 ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>(
1278 1, 18u, input, this->mutable_global_device_ids())));
1279 } else {
1280 goto handle_unusual;
1281 }
1282 break;
1283 }
1284
1285 // string name = 3;
1286 case 3: {
1287 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (26 & 0xFF)) {
1288 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
1289 input, this->mutable_name()));
1290 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1291 this->name().data(), static_cast<int>(this->name().length()),
1292 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
1293 "tensorflow.dtensor.MeshProto.name"));
1294 } else {
1295 goto handle_unusual;
1296 }
1297 break;
1298 }
1299
1300 // repeated int64 local_device_ids = 4;
1301 case 4: {
1302 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (34 & 0xFF)) {
1303 DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPackedPrimitive<
1304 ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>(
1305 input, this->mutable_local_device_ids())));
1306 } else if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (32 & 0xFF)) {
1307 DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
1308 ::PROTOBUF_NAMESPACE_ID::int64, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT64>(
1309 1, 34u, input, this->mutable_local_device_ids())));
1310 } else {
1311 goto handle_unusual;
1312 }
1313 break;
1314 }
1315
1316 // repeated string local_devices = 5;
1317 case 5: {
1318 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (42 & 0xFF)) {
1319 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
1320 input, this->add_local_devices()));
1321 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1322 this->local_devices(this->local_devices_size() - 1).data(),
1323 static_cast<int>(this->local_devices(this->local_devices_size() - 1).length()),
1324 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
1325 "tensorflow.dtensor.MeshProto.local_devices"));
1326 } else {
1327 goto handle_unusual;
1328 }
1329 break;
1330 }
1331
1332 // repeated string global_devices = 6;
1333 case 6: {
1334 if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (50 & 0xFF)) {
1335 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString(
1336 input, this->add_global_devices()));
1337 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1338 this->global_devices(this->global_devices_size() - 1).data(),
1339 static_cast<int>(this->global_devices(this->global_devices_size() - 1).length()),
1340 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::PARSE,
1341 "tensorflow.dtensor.MeshProto.global_devices"));
1342 } else {
1343 goto handle_unusual;
1344 }
1345 break;
1346 }
1347
1348 default: {
1349 handle_unusual:
1350 if (tag == 0) {
1351 goto success;
1352 }
1353 DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField(
1354 input, tag, _internal_metadata_.mutable_unknown_fields()));
1355 break;
1356 }
1357 }
1358 }
1359success:
1360 // @@protoc_insertion_point(parse_success:tensorflow.dtensor.MeshProto)
1361 return true;
1362failure:
1363 // @@protoc_insertion_point(parse_failure:tensorflow.dtensor.MeshProto)
1364 return false;
1365#undef DO_
1366}
1367#endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
1368
1369void MeshProto::SerializeWithCachedSizes(
1370 ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const {
1371 // @@protoc_insertion_point(serialize_start:tensorflow.dtensor.MeshProto)
1372 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1373 (void) cached_has_bits;
1374
1375 // repeated .tensorflow.dtensor.MeshDimensionProto mesh_dimensions = 1;
1376 for (unsigned int i = 0,
1377 n = static_cast<unsigned int>(this->mesh_dimensions_size()); i < n; i++) {
1378 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteMessageMaybeToArray(
1379 1,
1380 this->mesh_dimensions(static_cast<int>(i)),
1381 output);
1382 }
1383
1384 // repeated int64 global_device_ids = 2;
1385 if (this->global_device_ids_size() > 0) {
1386 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteTag(2, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
1387 output->WriteVarint32(_global_device_ids_cached_byte_size_.load(
1388 std::memory_order_relaxed));
1389 }
1390 for (int i = 0, n = this->global_device_ids_size(); i < n; i++) {
1391 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64NoTag(
1392 this->global_device_ids(i), output);
1393 }
1394
1395 // string name = 3;
1396 if (this->name().size() > 0) {
1397 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1398 this->name().data(), static_cast<int>(this->name().length()),
1399 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
1400 "tensorflow.dtensor.MeshProto.name");
1401 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased(
1402 3, this->name(), output);
1403 }
1404
1405 // repeated int64 local_device_ids = 4;
1406 if (this->local_device_ids_size() > 0) {
1407 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteTag(4, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
1408 output->WriteVarint32(_local_device_ids_cached_byte_size_.load(
1409 std::memory_order_relaxed));
1410 }
1411 for (int i = 0, n = this->local_device_ids_size(); i < n; i++) {
1412 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64NoTag(
1413 this->local_device_ids(i), output);
1414 }
1415
1416 // repeated string local_devices = 5;
1417 for (int i = 0, n = this->local_devices_size(); i < n; i++) {
1418 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1419 this->local_devices(i).data(), static_cast<int>(this->local_devices(i).length()),
1420 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
1421 "tensorflow.dtensor.MeshProto.local_devices");
1422 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteString(
1423 5, this->local_devices(i), output);
1424 }
1425
1426 // repeated string global_devices = 6;
1427 for (int i = 0, n = this->global_devices_size(); i < n; i++) {
1428 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1429 this->global_devices(i).data(), static_cast<int>(this->global_devices(i).length()),
1430 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
1431 "tensorflow.dtensor.MeshProto.global_devices");
1432 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteString(
1433 6, this->global_devices(i), output);
1434 }
1435
1436 if (_internal_metadata_.have_unknown_fields()) {
1437 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields(
1438 _internal_metadata_.unknown_fields(), output);
1439 }
1440 // @@protoc_insertion_point(serialize_end:tensorflow.dtensor.MeshProto)
1441}
1442
1443::PROTOBUF_NAMESPACE_ID::uint8* MeshProto::InternalSerializeWithCachedSizesToArray(
1444 ::PROTOBUF_NAMESPACE_ID::uint8* target) const {
1445 // @@protoc_insertion_point(serialize_to_array_start:tensorflow.dtensor.MeshProto)
1446 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1447 (void) cached_has_bits;
1448
1449 // repeated .tensorflow.dtensor.MeshDimensionProto mesh_dimensions = 1;
1450 for (unsigned int i = 0,
1451 n = static_cast<unsigned int>(this->mesh_dimensions_size()); i < n; i++) {
1452 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1453 InternalWriteMessageToArray(
1454 1, this->mesh_dimensions(static_cast<int>(i)), target);
1455 }
1456
1457 // repeated int64 global_device_ids = 2;
1458 if (this->global_device_ids_size() > 0) {
1459 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteTagToArray(
1460 2,
1461 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
1462 target);
1463 target = ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream::WriteVarint32ToArray(
1464 _global_device_ids_cached_byte_size_.load(std::memory_order_relaxed),
1465 target);
1466 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1467 WriteInt64NoTagToArray(this->global_device_ids_, target);
1468 }
1469
1470 // string name = 3;
1471 if (this->name().size() > 0) {
1472 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1473 this->name().data(), static_cast<int>(this->name().length()),
1474 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
1475 "tensorflow.dtensor.MeshProto.name");
1476 target =
1477 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray(
1478 3, this->name(), target);
1479 }
1480
1481 // repeated int64 local_device_ids = 4;
1482 if (this->local_device_ids_size() > 0) {
1483 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteTagToArray(
1484 4,
1485 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
1486 target);
1487 target = ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream::WriteVarint32ToArray(
1488 _local_device_ids_cached_byte_size_.load(std::memory_order_relaxed),
1489 target);
1490 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1491 WriteInt64NoTagToArray(this->local_device_ids_, target);
1492 }
1493
1494 // repeated string local_devices = 5;
1495 for (int i = 0, n = this->local_devices_size(); i < n; i++) {
1496 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1497 this->local_devices(i).data(), static_cast<int>(this->local_devices(i).length()),
1498 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
1499 "tensorflow.dtensor.MeshProto.local_devices");
1500 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1501 WriteStringToArray(5, this->local_devices(i), target);
1502 }
1503
1504 // repeated string global_devices = 6;
1505 for (int i = 0, n = this->global_devices_size(); i < n; i++) {
1506 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
1507 this->global_devices(i).data(), static_cast<int>(this->global_devices(i).length()),
1508 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
1509 "tensorflow.dtensor.MeshProto.global_devices");
1510 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1511 WriteStringToArray(6, this->global_devices(i), target);
1512 }
1513
1514 if (_internal_metadata_.have_unknown_fields()) {
1515 target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray(
1516 _internal_metadata_.unknown_fields(), target);
1517 }
1518 // @@protoc_insertion_point(serialize_to_array_end:tensorflow.dtensor.MeshProto)
1519 return target;
1520}
1521
1522size_t MeshProto::ByteSizeLong() const {
1523// @@protoc_insertion_point(message_byte_size_start:tensorflow.dtensor.MeshProto)
1524 size_t total_size = 0;
1525
1526 if (_internal_metadata_.have_unknown_fields()) {
1527 total_size +=
1528 ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize(
1529 _internal_metadata_.unknown_fields());
1530 }
1531 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1532 // Prevent compiler warnings about cached_has_bits being unused
1533 (void) cached_has_bits;
1534
1535 // repeated .tensorflow.dtensor.MeshDimensionProto mesh_dimensions = 1;
1536 {
1537 unsigned int count = static_cast<unsigned int>(this->mesh_dimensions_size());
1538 total_size += 1UL * count;
1539 for (unsigned int i = 0; i < count; i++) {
1540 total_size +=
1541 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
1542 this->mesh_dimensions(static_cast<int>(i)));
1543 }
1544 }
1545
1546 // repeated int64 global_device_ids = 2;
1547 {
1548 size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1549 Int64Size(this->global_device_ids_);
1550 if (data_size > 0) {
1551 total_size += 1 +
1552 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
1553 static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
1554 }
1555 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
1556 _global_device_ids_cached_byte_size_.store(cached_size,
1557 std::memory_order_relaxed);
1558 total_size += data_size;
1559 }
1560
1561 // repeated int64 local_device_ids = 4;
1562 {
1563 size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1564 Int64Size(this->local_device_ids_);
1565 if (data_size > 0) {
1566 total_size += 1 +
1567 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
1568 static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
1569 }
1570 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
1571 _local_device_ids_cached_byte_size_.store(cached_size,
1572 std::memory_order_relaxed);
1573 total_size += data_size;
1574 }
1575
1576 // repeated string local_devices = 5;
1577 total_size += 1 *
1578 ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->local_devices_size());
1579 for (int i = 0, n = this->local_devices_size(); i < n; i++) {
1580 total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
1581 this->local_devices(i));
1582 }
1583
1584 // repeated string global_devices = 6;
1585 total_size += 1 *
1586 ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->global_devices_size());
1587 for (int i = 0, n = this->global_devices_size(); i < n; i++) {
1588 total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
1589 this->global_devices(i));
1590 }
1591
1592 // string name = 3;
1593 if (this->name().size() > 0) {
1594 total_size += 1 +
1595 ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
1596 this->name());
1597 }
1598
1599 int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
1600 SetCachedSize(cached_size);
1601 return total_size;
1602}
1603
1604void MeshProto::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
1605// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.dtensor.MeshProto)
1606 GOOGLE_DCHECK_NE(&from, this);
1607 const MeshProto* source =
1608 ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<MeshProto>(
1609 &from);
1610 if (source == nullptr) {
1611 // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.dtensor.MeshProto)
1612 ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
1613 } else {
1614 // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.dtensor.MeshProto)
1615 MergeFrom(*source);
1616 }
1617}
1618
1619void MeshProto::MergeFrom(const MeshProto& from) {
1620// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.dtensor.MeshProto)
1621 GOOGLE_DCHECK_NE(&from, this);
1622 _internal_metadata_.MergeFrom(from._internal_metadata_);
1623 ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
1624 (void) cached_has_bits;
1625
1626 mesh_dimensions_.MergeFrom(from.mesh_dimensions_);
1627 global_device_ids_.MergeFrom(from.global_device_ids_);
1628 local_device_ids_.MergeFrom(from.local_device_ids_);
1629 local_devices_.MergeFrom(from.local_devices_);
1630 global_devices_.MergeFrom(from.global_devices_);
1631 if (from.name().size() > 0) {
1632
1633 name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
1634 }
1635}
1636
1637void MeshProto::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
1638// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.dtensor.MeshProto)
1639 if (&from == this) return;
1640 Clear();
1641 MergeFrom(from);
1642}
1643
1644void MeshProto::CopyFrom(const MeshProto& from) {
1645// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.dtensor.MeshProto)
1646 if (&from == this) return;
1647 Clear();
1648 MergeFrom(from);
1649}
1650
1651bool MeshProto::IsInitialized() const {
1652 return true;
1653}
1654
1655void MeshProto::InternalSwap(MeshProto* other) {
1656 using std::swap;
1657 _internal_metadata_.Swap(&other->_internal_metadata_);
1658 CastToBase(&mesh_dimensions_)->InternalSwap(CastToBase(&other->mesh_dimensions_));
1659 global_device_ids_.InternalSwap(&other->global_device_ids_);
1660 local_device_ids_.InternalSwap(&other->local_device_ids_);
1661 local_devices_.InternalSwap(CastToBase(&other->local_devices_));
1662 global_devices_.InternalSwap(CastToBase(&other->global_devices_));
1663 name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
1664 GetArenaNoVirtual());
1665}
1666
1667::PROTOBUF_NAMESPACE_ID::Metadata MeshProto::GetMetadata() const {
1668 return GetMetadataStatic();
1669}
1670
1671
1672// @@protoc_insertion_point(namespace_scope)
1673} // namespace dtensor
1674} // namespace tensorflow
1675PROTOBUF_NAMESPACE_OPEN
1676template<> PROTOBUF_NOINLINE ::tensorflow::dtensor::ShardingSpec* Arena::CreateMaybeMessage< ::tensorflow::dtensor::ShardingSpec >(Arena* arena) {
1677 return Arena::CreateInternal< ::tensorflow::dtensor::ShardingSpec >(arena);
1678}
1679template<> PROTOBUF_NOINLINE ::tensorflow::dtensor::MeshDimensionProto* Arena::CreateMaybeMessage< ::tensorflow::dtensor::MeshDimensionProto >(Arena* arena) {
1680 return Arena::CreateInternal< ::tensorflow::dtensor::MeshDimensionProto >(arena);
1681}
1682template<> PROTOBUF_NOINLINE ::tensorflow::dtensor::LayoutProto* Arena::CreateMaybeMessage< ::tensorflow::dtensor::LayoutProto >(Arena* arena) {
1683 return Arena::CreateInternal< ::tensorflow::dtensor::LayoutProto >(arena);
1684}
1685template<> PROTOBUF_NOINLINE ::tensorflow::dtensor::MeshProto* Arena::CreateMaybeMessage< ::tensorflow::dtensor::MeshProto >(Arena* arena) {
1686 return Arena::CreateInternal< ::tensorflow::dtensor::MeshProto >(arena);
1687}
1688PROTOBUF_NAMESPACE_CLOSE
1689
1690// @@protoc_insertion_point(global_scope)
1691#include <google/protobuf/port_undef.inc>
1692