8 #include <google/protobuf/stubs/common.h>
9 #include <google/protobuf/stubs/port.h>
10 #include <google/protobuf/io/coded_stream.h>
11 #include <google/protobuf/wire_format_lite_inl.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>
17 #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
18 #include "third_party/protobuf/version.h"
23 extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensorflow_2fcore_2fframework_2fgraph_2eproto ::google::protobuf::internal::SCCInfo<3>
scc_info_GraphDef;
28 ::google::protobuf::internal::ExplicitlyConstructed<TFNetworkModel>
33 static void InitDefaultsTFNetworkModel() {
34 GOOGLE_PROTOBUF_VERIFY_VERSION;
39 ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
45 {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTFNetworkModel}, {
78 static ::google::protobuf::Message
const *
const file_default_instances[] = {
90 static ::google::protobuf::internal::once_flag once;
103 "\n\017tfnetwork.proto\022\ttesseract\032%tensorflow"
104 "/core/framework/graph.proto\"\233\002\n\016TFNetwor"
105 "kModel\022#\n\005graph\030\001 \001(\0132\024.tensorflow.Graph"
106 "Def\022\023\n\013global_step\030\002 \001(\003\022\014\n\004spec\030\003 \001(\t\022\r"
107 "\n\005depth\030\004 \001(\005\022\016\n\006x_size\030\005 \001(\005\022\016\n\006y_size\030"
108 "\006 \001(\005\022\022\n\nbatch_size\030\010 \001(\005\022\023\n\013num_classes"
109 "\030\t \001(\005\022\021\n\tusing_ctc\030\n \001(\010\022\023\n\013image_input"
110 "\030\013 \001(\t\022\024\n\014image_widths\030\014 \001(\t\022\025\n\rimage_he"
111 "ights\030\r \001(\t\022\024\n\014output_layer\030\016 \001(\tb\006proto"
114 ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
116 ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
122 static ::google::protobuf::internal::once_flag once;
138 ::tensorflow::GraphDef::internal_default_instance());
141 if (GetArenaNoVirtual() == NULL && graph_ != NULL) {
146 #if !defined(_MSC_VER) || _MSC_VER >= 1900
160 #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
163 : ::
google::protobuf::Message(), _internal_metadata_(NULL) {
164 ::google::protobuf::internal::InitSCC(
170 : ::
google::protobuf::Message(),
171 _internal_metadata_(NULL) {
172 _internal_metadata_.MergeFrom(from._internal_metadata_);
173 spec_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
174 if (from.
spec().size() > 0) {
175 spec_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.spec_);
177 image_input_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
179 image_input_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_input_);
181 image_widths_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
183 image_widths_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_widths_);
185 image_heights_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
187 image_heights_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_heights_);
189 output_layer_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
191 output_layer_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_layer_);
194 graph_ = new ::tensorflow::GraphDef(*from.graph_);
198 ::memcpy(&global_step_, &from.global_step_,
199 static_cast<size_t>(reinterpret_cast<char*>(&using_ctc_) -
200 reinterpret_cast<char*>(&global_step_)) +
sizeof(using_ctc_));
204 void TFNetworkModel::SharedCtor() {
205 spec_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
206 image_input_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
207 image_widths_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
208 image_heights_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
209 output_layer_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
210 ::memset(&graph_, 0, static_cast<size_t>(
211 reinterpret_cast<char*>(&using_ctc_) -
212 reinterpret_cast<char*>(&graph_)) +
sizeof(using_ctc_));
220 void TFNetworkModel::SharedDtor() {
221 spec_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
222 image_input_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
223 image_widths_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
224 image_heights_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
225 output_layer_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
229 void TFNetworkModel::SetCachedSize(
int size)
const {
230 _cached_size_.Set(size);
245 ::google::protobuf::uint32 cached_has_bits = 0;
247 (void) cached_has_bits;
249 spec_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
250 image_input_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
251 image_widths_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
252 image_heights_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
253 output_layer_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
254 if (GetArenaNoVirtual() == NULL && graph_ != NULL) {
258 ::memset(&global_step_, 0, static_cast<size_t>(
259 reinterpret_cast<char*>(&using_ctc_) -
260 reinterpret_cast<char*>(&global_step_)) +
sizeof(using_ctc_));
261 _internal_metadata_.Clear();
265 ::google::protobuf::io::CodedInputStream* input) {
266 #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
267 ::google::protobuf::uint32 tag;
270 ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
272 if (!p.second)
goto handle_unusual;
273 switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
276 if (static_cast< ::google::protobuf::uint8>(tag) ==
277 static_cast< ::google::protobuf::uint8>(10u )) {
278 DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
288 if (static_cast< ::google::protobuf::uint8>(tag) ==
289 static_cast< ::google::protobuf::uint8>(16u )) {
291 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
292 ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
293 input, &global_step_)));
302 if (static_cast< ::google::protobuf::uint8>(tag) ==
303 static_cast< ::google::protobuf::uint8>(26u )) {
304 DO_(::google::protobuf::internal::WireFormatLite::ReadString(
306 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
307 this->
spec().data(), static_cast<int>(this->
spec().length()),
308 ::google::protobuf::internal::WireFormatLite::PARSE,
309 "tesseract.TFNetworkModel.spec"));
318 if (static_cast< ::google::protobuf::uint8>(tag) ==
319 static_cast< ::google::protobuf::uint8>(32u )) {
321 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
322 ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
332 if (static_cast< ::google::protobuf::uint8>(tag) ==
333 static_cast< ::google::protobuf::uint8>(40u )) {
335 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
336 ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
346 if (static_cast< ::google::protobuf::uint8>(tag) ==
347 static_cast< ::google::protobuf::uint8>(48u )) {
349 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
350 ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
360 if (static_cast< ::google::protobuf::uint8>(tag) ==
361 static_cast< ::google::protobuf::uint8>(64u )) {
363 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
364 ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
365 input, &batch_size_)));
374 if (static_cast< ::google::protobuf::uint8>(tag) ==
375 static_cast< ::google::protobuf::uint8>(72u )) {
377 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
378 ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
379 input, &num_classes_)));
388 if (static_cast< ::google::protobuf::uint8>(tag) ==
389 static_cast< ::google::protobuf::uint8>(80u )) {
391 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
392 bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
393 input, &using_ctc_)));
402 if (static_cast< ::google::protobuf::uint8>(tag) ==
403 static_cast< ::google::protobuf::uint8>(90u )) {
404 DO_(::google::protobuf::internal::WireFormatLite::ReadString(
406 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
408 ::google::protobuf::internal::WireFormatLite::PARSE,
409 "tesseract.TFNetworkModel.image_input"));
418 if (static_cast< ::google::protobuf::uint8>(tag) ==
419 static_cast< ::google::protobuf::uint8>(98u )) {
420 DO_(::google::protobuf::internal::WireFormatLite::ReadString(
422 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
424 ::google::protobuf::internal::WireFormatLite::PARSE,
425 "tesseract.TFNetworkModel.image_widths"));
434 if (static_cast< ::google::protobuf::uint8>(tag) ==
435 static_cast< ::google::protobuf::uint8>(106u )) {
436 DO_(::google::protobuf::internal::WireFormatLite::ReadString(
438 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
440 ::google::protobuf::internal::WireFormatLite::PARSE,
441 "tesseract.TFNetworkModel.image_heights"));
450 if (static_cast< ::google::protobuf::uint8>(tag) ==
451 static_cast< ::google::protobuf::uint8>(114u )) {
452 DO_(::google::protobuf::internal::WireFormatLite::ReadString(
454 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
456 ::google::protobuf::internal::WireFormatLite::PARSE,
457 "tesseract.TFNetworkModel.output_layer"));
469 DO_(::google::protobuf::internal::WireFormat::SkipField(
470 input, tag, _internal_metadata_.mutable_unknown_fields()));
485 ::google::protobuf::io::CodedOutputStream* output)
const {
487 ::google::protobuf::uint32 cached_has_bits = 0;
488 (void) cached_has_bits;
492 ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
493 1, this->_internal_graph(), output);
498 ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->
global_step(), output);
502 if (this->
spec().size() > 0) {
503 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
504 this->
spec().data(), static_cast<int>(this->
spec().length()),
505 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
506 "tesseract.TFNetworkModel.spec");
507 ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
508 3, this->
spec(), output);
512 if (this->
depth() != 0) {
513 ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->
depth(), output);
517 if (this->
x_size() != 0) {
518 ::google::protobuf::internal::WireFormatLite::WriteInt32(5, this->
x_size(), output);
522 if (this->
y_size() != 0) {
523 ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->
y_size(), output);
528 ::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->
batch_size(), output);
533 ::google::protobuf::internal::WireFormatLite::WriteInt32(9, this->
num_classes(), output);
538 ::google::protobuf::internal::WireFormatLite::WriteBool(10, this->
using_ctc(), output);
543 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
545 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
546 "tesseract.TFNetworkModel.image_input");
547 ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
553 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
555 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
556 "tesseract.TFNetworkModel.image_widths");
557 ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
563 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
565 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
566 "tesseract.TFNetworkModel.image_heights");
567 ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
573 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
575 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
576 "tesseract.TFNetworkModel.output_layer");
577 ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
581 if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
582 ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
583 (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
589 bool deterministic, ::google::protobuf::uint8* target)
const {
592 ::google::protobuf::uint32 cached_has_bits = 0;
593 (void) cached_has_bits;
597 target = ::google::protobuf::internal::WireFormatLite::
598 InternalWriteMessageToArray(
599 1, this->_internal_graph(), deterministic, target);
604 target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(2, this->
global_step(), target);
608 if (this->
spec().size() > 0) {
609 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
610 this->
spec().data(), static_cast<int>(this->
spec().length()),
611 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
612 "tesseract.TFNetworkModel.spec");
614 ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
615 3, this->
spec(), target);
619 if (this->
depth() != 0) {
620 target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->
depth(), target);
624 if (this->
x_size() != 0) {
625 target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(5, this->
x_size(), target);
629 if (this->
y_size() != 0) {
630 target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(6, this->
y_size(), target);
635 target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(8, this->
batch_size(), target);
640 target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(9, this->
num_classes(), target);
645 target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->
using_ctc(), target);
650 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
652 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
653 "tesseract.TFNetworkModel.image_input");
655 ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
661 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
663 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
664 "tesseract.TFNetworkModel.image_widths");
666 ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
672 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
674 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
675 "tesseract.TFNetworkModel.image_heights");
677 ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
683 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
685 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
686 "tesseract.TFNetworkModel.output_layer");
688 ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
692 if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
693 target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
694 (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
702 size_t total_size = 0;
704 if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
706 ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
707 (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
710 if (this->
spec().size() > 0) {
712 ::google::protobuf::internal::WireFormatLite::StringSize(
719 ::google::protobuf::internal::WireFormatLite::StringSize(
726 ::google::protobuf::internal::WireFormatLite::StringSize(
733 ::google::protobuf::internal::WireFormatLite::StringSize(
740 ::google::protobuf::internal::WireFormatLite::StringSize(
747 ::google::protobuf::internal::WireFormatLite::MessageSize(
754 ::google::protobuf::internal::WireFormatLite::Int64Size(
759 if (this->
depth() != 0) {
761 ::google::protobuf::internal::WireFormatLite::Int32Size(
766 if (this->
x_size() != 0) {
768 ::google::protobuf::internal::WireFormatLite::Int32Size(
773 if (this->
y_size() != 0) {
775 ::google::protobuf::internal::WireFormatLite::Int32Size(
782 ::google::protobuf::internal::WireFormatLite::Int32Size(
789 ::google::protobuf::internal::WireFormatLite::Int32Size(
798 int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
799 SetCachedSize(cached_size);
805 GOOGLE_DCHECK_NE(&from,
this);
807 ::google::protobuf::internal::DynamicCastToGenerated<const TFNetworkModel>(
809 if (source == NULL) {
811 ::google::protobuf::internal::ReflectionOps::Merge(from,
this);
820 GOOGLE_DCHECK_NE(&from,
this);
821 _internal_metadata_.MergeFrom(from._internal_metadata_);
822 ::google::protobuf::uint32 cached_has_bits = 0;
823 (void) cached_has_bits;
825 if (from.
spec().size() > 0) {
827 spec_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.spec_);
831 image_input_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_input_);
835 image_widths_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_widths_);
839 image_heights_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.image_heights_);
843 output_layer_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.output_layer_);
851 if (from.
depth() != 0) {
873 if (&from ==
this)
return;
880 if (&from ==
this)
return;
890 if (other ==
this)
return;
895 spec_.Swap(&other->spec_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
896 GetArenaNoVirtual());
897 image_input_.Swap(&other->image_input_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
898 GetArenaNoVirtual());
899 image_widths_.Swap(&other->image_widths_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
900 GetArenaNoVirtual());
901 image_heights_.Swap(&other->image_heights_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
902 GetArenaNoVirtual());
903 output_layer_.Swap(&other->output_layer_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
904 GetArenaNoVirtual());
905 swap(graph_, other->graph_);
906 swap(global_step_, other->global_step_);
907 swap(depth_, other->depth_);
908 swap(x_size_, other->x_size_);
909 swap(y_size_, other->y_size_);
910 swap(batch_size_, other->batch_size_);
911 swap(num_classes_, other->num_classes_);
912 swap(using_ctc_, other->using_ctc_);
913 _internal_metadata_.Swap(&other->_internal_metadata_);
927 return Arena::CreateInternal< ::tesseract::TFNetworkModel >(arena);