├── .gitignore ├── Makefile ├── README.md ├── resources └── image_3.jpg └── src ├── generated ├── model.grpc.pb.cc ├── model.grpc.pb.h ├── model.pb.cc ├── model.pb.h ├── predict.grpc.pb.cc ├── predict.grpc.pb.h ├── predict.pb.cc ├── predict.pb.h ├── prediction_service.grpc.pb.cc ├── prediction_service.grpc.pb.h ├── prediction_service.pb.cc ├── prediction_service.pb.h ├── resource_handle.grpc.pb.cc ├── resource_handle.grpc.pb.h ├── resource_handle.pb.cc ├── resource_handle.pb.h ├── tensor.grpc.pb.cc ├── tensor.grpc.pb.h ├── tensor.pb.cc ├── tensor.pb.h ├── tensor_shape.grpc.pb.cc ├── tensor_shape.grpc.pb.h ├── tensor_shape.pb.cc ├── tensor_shape.pb.h ├── types.grpc.pb.cc ├── types.grpc.pb.h ├── types.pb.cc └── types.pb.h ├── protos ├── model.proto ├── predict.proto ├── prediction_service.proto ├── resource_handle.proto ├── tensor.proto ├── tensor_shape.proto └── types.proto └── serving_client.cc /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | 3 | bin/**/* 4 | obj/**/* 5 | 6 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) 2 | SYSTEM ?= $(HOST_SYSTEM) 3 | CC = g++ 4 | CFLAGS = -c -Wall -std=c++11 -pthread -I/usr/local/include 5 | ifeq ($(SYSTEM),Darwin) 6 | LDFLAGS = -L/usr/local/lib -lpthread -lprotobuf -lgrpc++ -lgrpc\ 7 | -lgrpc++_reflection\ 8 | -ldl 9 | else 10 | LDFLAGS = -L/usr/local/lib -lprotobuf -pthread -lgrpc++ -lgrpc\ 11 | -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\ 12 | -ldl 13 | endif 14 | EXECUTABLE_NAME=serving_client 15 | 16 | BIN =./bin 17 | SOURCE_DIR =./src 18 | OBJ =./obj 19 | 20 | SOURCE_FILES =$(wildcard src/*.cc) $(wildcard src/**/*.cc) 21 | 22 | EXECUTABLE_FILES = $(EXECUTABLE_NAME:%=$(BIN)/%) 23 | OBJECT_FILES = $(SOURCE_FILES:%.cc=$(OBJ)/%.o) 24 | 25 | build: $(EXECUTABLE_FILES) 26 | 27 | clean: 28 | rm -r -f $(BIN) 29 | rm -r -f $(OBJ) 30 | 31 | .PHONY: build clean 32 | 33 | $(EXECUTABLE_FILES): $(OBJECT_FILES) 34 | @echo Linking $< 35 | @mkdir -p $(@D) 36 | @$(CC) $^ $(LDFLAGS) -o $@ 37 | @echo "Build successful!" 38 | 39 | $(OBJECT_FILES): $(OBJ)/%.o: %.cc 40 | @echo Compiling $< 41 | @mkdir -p $(@D) 42 | @$(CC) $(CFLAGS) -o $@ $< 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## C++ client for the TensorFlow prediction service 2 | The repository contains a C++ client of a service that predicts [Street View House Numbers](http://ufldl.stanford.edu/housenumbers/). The client talks to [TensorFlow Serving](https://tensorflow.github.io/serving/) server via gRPC that hosts trained GAN model as described in the [series of articles on Medium](https://towardsdatascience.com/how-to-deploy-machine-learning-models-with-tensorflow-part-1-make-your-model-ready-for-serving-776a14ec3198). 3 | 4 | ## Pre-requisities 5 | I have tested the client on Ubuntu 16.04. To build a client code you must install: 6 | 7 | - [Protobuf library](https://github.com/google/protobuf) as described [here](https://github.com/google/protobuf/blob/master/src/README.md) 8 | - [GRPC library](https://github.com/grpc/grpc) as described [here](https://github.com/grpc/grpc/blob/master/BUILDING.md) 9 | 10 | The client does not require an installation of the TensorFlow framework. 11 | 12 | ## Generation of C++ code from protobufs 13 | I have prepared probufs under `./src/protos` and generated C++ headers and sources into `./src/generated`. If you prefer to do that yourself, execute in the terminal following commands: 14 | ``` 15 | cd 16 | rm -rf ./src/generated 17 | mkdir ./src/generated 18 | protoc -I ./src/protos --cpp_out=./src/generated --grpc_out=./src/generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./src/protos/*.proto 19 | ``` 20 | 21 | ## Build the client 22 | To build a client, execute the following: 23 | ``` 24 | make clean 25 | make 26 | ``` 27 | 28 | ## Run the client 29 | To test the client locally, first create and run the Docker container with GAN model as described [here](https://towardsdatascience.com/how-to-deploy-machine-learning-models-with-tensorflow-part-2-containerize-it-db0ad7ca35a7) and then execute: 30 | ``` 31 | ./bin/serving_client --server : --image_file 32 | ``` 33 | For example: 34 | ``` 35 | ./bin/serving_client --server localhost:9000 --image_file ./resources/image_3.jpg 36 | ``` 37 | -------------------------------------------------------------------------------- /resources/image_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vbezgachev/tf_serving_cpp_client/be553c08b0ac7f1b6a1a8fd58b653f1179ecfcb1/resources/image_3.jpg -------------------------------------------------------------------------------- /src/generated/model.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: model.proto 4 | 5 | #include "model.pb.h" 6 | #include "model.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | namespace serving { 18 | 19 | } // namespace tensorflow 20 | } // namespace serving 21 | 22 | -------------------------------------------------------------------------------- /src/generated/model.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: model.proto 4 | #ifndef GRPC_model_2eproto__INCLUDED 5 | #define GRPC_model_2eproto__INCLUDED 6 | 7 | #include "model.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace grpc { 21 | class CompletionQueue; 22 | class Channel; 23 | class ServerCompletionQueue; 24 | class ServerContext; 25 | } // namespace grpc 26 | 27 | namespace tensorflow { 28 | namespace serving { 29 | 30 | } // namespace serving 31 | } // namespace tensorflow 32 | 33 | 34 | #endif // GRPC_model_2eproto__INCLUDED 35 | -------------------------------------------------------------------------------- /src/generated/model.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: model.proto 3 | 4 | #ifndef PROTOBUF_INCLUDED_model_2eproto 5 | #define PROTOBUF_INCLUDED_model_2eproto 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 3006000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include // IWYU pragma: export 31 | #include // IWYU pragma: export 32 | #include 33 | // @@protoc_insertion_point(includes) 34 | #define PROTOBUF_INTERNAL_EXPORT_protobuf_model_2eproto 35 | 36 | namespace protobuf_model_2eproto { 37 | // Internal implementation detail -- do not use these members. 38 | struct TableStruct { 39 | static const ::google::protobuf::internal::ParseTableField entries[]; 40 | static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; 41 | static const ::google::protobuf::internal::ParseTable schema[2]; 42 | static const ::google::protobuf::internal::FieldMetadata field_metadata[]; 43 | static const ::google::protobuf::internal::SerializationTable serialization_table[]; 44 | static const ::google::protobuf::uint32 offsets[]; 45 | }; 46 | void AddDescriptors(); 47 | } // namespace protobuf_model_2eproto 48 | namespace tensorflow { 49 | namespace serving { 50 | class Int64Value; 51 | class Int64ValueDefaultTypeInternal; 52 | extern Int64ValueDefaultTypeInternal _Int64Value_default_instance_; 53 | class ModelSpec; 54 | class ModelSpecDefaultTypeInternal; 55 | extern ModelSpecDefaultTypeInternal _ModelSpec_default_instance_; 56 | } // namespace serving 57 | } // namespace tensorflow 58 | namespace google { 59 | namespace protobuf { 60 | template<> ::tensorflow::serving::Int64Value* Arena::CreateMaybeMessage<::tensorflow::serving::Int64Value>(Arena*); 61 | template<> ::tensorflow::serving::ModelSpec* Arena::CreateMaybeMessage<::tensorflow::serving::ModelSpec>(Arena*); 62 | } // namespace protobuf 63 | } // namespace google 64 | namespace tensorflow { 65 | namespace serving { 66 | 67 | // =================================================================== 68 | 69 | class Int64Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.serving.Int64Value) */ { 70 | public: 71 | Int64Value(); 72 | virtual ~Int64Value(); 73 | 74 | Int64Value(const Int64Value& from); 75 | 76 | inline Int64Value& operator=(const Int64Value& from) { 77 | CopyFrom(from); 78 | return *this; 79 | } 80 | #if LANG_CXX11 81 | Int64Value(Int64Value&& from) noexcept 82 | : Int64Value() { 83 | *this = ::std::move(from); 84 | } 85 | 86 | inline Int64Value& operator=(Int64Value&& from) noexcept { 87 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 88 | if (this != &from) InternalSwap(&from); 89 | } else { 90 | CopyFrom(from); 91 | } 92 | return *this; 93 | } 94 | #endif 95 | inline ::google::protobuf::Arena* GetArena() const final { 96 | return GetArenaNoVirtual(); 97 | } 98 | inline void* GetMaybeArenaPointer() const final { 99 | return MaybeArenaPtr(); 100 | } 101 | static const ::google::protobuf::Descriptor* descriptor(); 102 | static const Int64Value& default_instance(); 103 | 104 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 105 | static inline const Int64Value* internal_default_instance() { 106 | return reinterpret_cast( 107 | &_Int64Value_default_instance_); 108 | } 109 | static constexpr int kIndexInFileMessages = 110 | 0; 111 | 112 | void UnsafeArenaSwap(Int64Value* other); 113 | void Swap(Int64Value* other); 114 | friend void swap(Int64Value& a, Int64Value& b) { 115 | a.Swap(&b); 116 | } 117 | 118 | // implements Message ---------------------------------------------- 119 | 120 | inline Int64Value* New() const final { 121 | return CreateMaybeMessage(NULL); 122 | } 123 | 124 | Int64Value* New(::google::protobuf::Arena* arena) const final { 125 | return CreateMaybeMessage(arena); 126 | } 127 | void CopyFrom(const ::google::protobuf::Message& from) final; 128 | void MergeFrom(const ::google::protobuf::Message& from) final; 129 | void CopyFrom(const Int64Value& from); 130 | void MergeFrom(const Int64Value& from); 131 | void Clear() final; 132 | bool IsInitialized() const final; 133 | 134 | size_t ByteSizeLong() const final; 135 | bool MergePartialFromCodedStream( 136 | ::google::protobuf::io::CodedInputStream* input) final; 137 | void SerializeWithCachedSizes( 138 | ::google::protobuf::io::CodedOutputStream* output) const final; 139 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 140 | bool deterministic, ::google::protobuf::uint8* target) const final; 141 | int GetCachedSize() const final { return _cached_size_.Get(); } 142 | 143 | private: 144 | void SharedCtor(); 145 | void SharedDtor(); 146 | void SetCachedSize(int size) const final; 147 | void InternalSwap(Int64Value* other); 148 | protected: 149 | explicit Int64Value(::google::protobuf::Arena* arena); 150 | private: 151 | static void ArenaDtor(void* object); 152 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 153 | private: 154 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 155 | return _internal_metadata_.arena(); 156 | } 157 | inline void* MaybeArenaPtr() const { 158 | return _internal_metadata_.raw_arena_ptr(); 159 | } 160 | public: 161 | 162 | ::google::protobuf::Metadata GetMetadata() const final; 163 | 164 | // nested types ---------------------------------------------------- 165 | 166 | // accessors ------------------------------------------------------- 167 | 168 | // int64 value = 1; 169 | void clear_value(); 170 | static const int kValueFieldNumber = 1; 171 | ::google::protobuf::int64 value() const; 172 | void set_value(::google::protobuf::int64 value); 173 | 174 | // @@protoc_insertion_point(class_scope:tensorflow.serving.Int64Value) 175 | private: 176 | 177 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 178 | template friend class ::google::protobuf::Arena::InternalHelper; 179 | typedef void InternalArenaConstructable_; 180 | typedef void DestructorSkippable_; 181 | ::google::protobuf::int64 value_; 182 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 183 | friend struct ::protobuf_model_2eproto::TableStruct; 184 | }; 185 | // ------------------------------------------------------------------- 186 | 187 | class ModelSpec : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.serving.ModelSpec) */ { 188 | public: 189 | ModelSpec(); 190 | virtual ~ModelSpec(); 191 | 192 | ModelSpec(const ModelSpec& from); 193 | 194 | inline ModelSpec& operator=(const ModelSpec& from) { 195 | CopyFrom(from); 196 | return *this; 197 | } 198 | #if LANG_CXX11 199 | ModelSpec(ModelSpec&& from) noexcept 200 | : ModelSpec() { 201 | *this = ::std::move(from); 202 | } 203 | 204 | inline ModelSpec& operator=(ModelSpec&& from) noexcept { 205 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 206 | if (this != &from) InternalSwap(&from); 207 | } else { 208 | CopyFrom(from); 209 | } 210 | return *this; 211 | } 212 | #endif 213 | inline ::google::protobuf::Arena* GetArena() const final { 214 | return GetArenaNoVirtual(); 215 | } 216 | inline void* GetMaybeArenaPointer() const final { 217 | return MaybeArenaPtr(); 218 | } 219 | static const ::google::protobuf::Descriptor* descriptor(); 220 | static const ModelSpec& default_instance(); 221 | 222 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 223 | static inline const ModelSpec* internal_default_instance() { 224 | return reinterpret_cast( 225 | &_ModelSpec_default_instance_); 226 | } 227 | static constexpr int kIndexInFileMessages = 228 | 1; 229 | 230 | void UnsafeArenaSwap(ModelSpec* other); 231 | void Swap(ModelSpec* other); 232 | friend void swap(ModelSpec& a, ModelSpec& b) { 233 | a.Swap(&b); 234 | } 235 | 236 | // implements Message ---------------------------------------------- 237 | 238 | inline ModelSpec* New() const final { 239 | return CreateMaybeMessage(NULL); 240 | } 241 | 242 | ModelSpec* New(::google::protobuf::Arena* arena) const final { 243 | return CreateMaybeMessage(arena); 244 | } 245 | void CopyFrom(const ::google::protobuf::Message& from) final; 246 | void MergeFrom(const ::google::protobuf::Message& from) final; 247 | void CopyFrom(const ModelSpec& from); 248 | void MergeFrom(const ModelSpec& from); 249 | void Clear() final; 250 | bool IsInitialized() const final; 251 | 252 | size_t ByteSizeLong() const final; 253 | bool MergePartialFromCodedStream( 254 | ::google::protobuf::io::CodedInputStream* input) final; 255 | void SerializeWithCachedSizes( 256 | ::google::protobuf::io::CodedOutputStream* output) const final; 257 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 258 | bool deterministic, ::google::protobuf::uint8* target) const final; 259 | int GetCachedSize() const final { return _cached_size_.Get(); } 260 | 261 | private: 262 | void SharedCtor(); 263 | void SharedDtor(); 264 | void SetCachedSize(int size) const final; 265 | void InternalSwap(ModelSpec* other); 266 | protected: 267 | explicit ModelSpec(::google::protobuf::Arena* arena); 268 | private: 269 | static void ArenaDtor(void* object); 270 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 271 | private: 272 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 273 | return _internal_metadata_.arena(); 274 | } 275 | inline void* MaybeArenaPtr() const { 276 | return _internal_metadata_.raw_arena_ptr(); 277 | } 278 | public: 279 | 280 | ::google::protobuf::Metadata GetMetadata() const final; 281 | 282 | // nested types ---------------------------------------------------- 283 | 284 | // accessors ------------------------------------------------------- 285 | 286 | // string name = 1; 287 | void clear_name(); 288 | static const int kNameFieldNumber = 1; 289 | const ::std::string& name() const; 290 | void set_name(const ::std::string& value); 291 | #if LANG_CXX11 292 | void set_name(::std::string&& value); 293 | #endif 294 | void set_name(const char* value); 295 | void set_name(const char* value, size_t size); 296 | ::std::string* mutable_name(); 297 | ::std::string* release_name(); 298 | void set_allocated_name(::std::string* name); 299 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 300 | " string fields are deprecated and will be removed in a" 301 | " future release.") 302 | ::std::string* unsafe_arena_release_name(); 303 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 304 | " string fields are deprecated and will be removed in a" 305 | " future release.") 306 | void unsafe_arena_set_allocated_name( 307 | ::std::string* name); 308 | 309 | // string signature_name = 3; 310 | void clear_signature_name(); 311 | static const int kSignatureNameFieldNumber = 3; 312 | const ::std::string& signature_name() const; 313 | void set_signature_name(const ::std::string& value); 314 | #if LANG_CXX11 315 | void set_signature_name(::std::string&& value); 316 | #endif 317 | void set_signature_name(const char* value); 318 | void set_signature_name(const char* value, size_t size); 319 | ::std::string* mutable_signature_name(); 320 | ::std::string* release_signature_name(); 321 | void set_allocated_signature_name(::std::string* signature_name); 322 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 323 | " string fields are deprecated and will be removed in a" 324 | " future release.") 325 | ::std::string* unsafe_arena_release_signature_name(); 326 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 327 | " string fields are deprecated and will be removed in a" 328 | " future release.") 329 | void unsafe_arena_set_allocated_signature_name( 330 | ::std::string* signature_name); 331 | 332 | // .tensorflow.serving.Int64Value version = 2; 333 | bool has_version() const; 334 | void clear_version(); 335 | static const int kVersionFieldNumber = 2; 336 | private: 337 | const ::tensorflow::serving::Int64Value& _internal_version() const; 338 | public: 339 | const ::tensorflow::serving::Int64Value& version() const; 340 | ::tensorflow::serving::Int64Value* release_version(); 341 | ::tensorflow::serving::Int64Value* mutable_version(); 342 | void set_allocated_version(::tensorflow::serving::Int64Value* version); 343 | void unsafe_arena_set_allocated_version( 344 | ::tensorflow::serving::Int64Value* version); 345 | ::tensorflow::serving::Int64Value* unsafe_arena_release_version(); 346 | 347 | // @@protoc_insertion_point(class_scope:tensorflow.serving.ModelSpec) 348 | private: 349 | 350 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 351 | template friend class ::google::protobuf::Arena::InternalHelper; 352 | typedef void InternalArenaConstructable_; 353 | typedef void DestructorSkippable_; 354 | ::google::protobuf::internal::ArenaStringPtr name_; 355 | ::google::protobuf::internal::ArenaStringPtr signature_name_; 356 | ::tensorflow::serving::Int64Value* version_; 357 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 358 | friend struct ::protobuf_model_2eproto::TableStruct; 359 | }; 360 | // =================================================================== 361 | 362 | 363 | // =================================================================== 364 | 365 | #ifdef __GNUC__ 366 | #pragma GCC diagnostic push 367 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 368 | #endif // __GNUC__ 369 | // Int64Value 370 | 371 | // int64 value = 1; 372 | inline void Int64Value::clear_value() { 373 | value_ = GOOGLE_LONGLONG(0); 374 | } 375 | inline ::google::protobuf::int64 Int64Value::value() const { 376 | // @@protoc_insertion_point(field_get:tensorflow.serving.Int64Value.value) 377 | return value_; 378 | } 379 | inline void Int64Value::set_value(::google::protobuf::int64 value) { 380 | 381 | value_ = value; 382 | // @@protoc_insertion_point(field_set:tensorflow.serving.Int64Value.value) 383 | } 384 | 385 | // ------------------------------------------------------------------- 386 | 387 | // ModelSpec 388 | 389 | // string name = 1; 390 | inline void ModelSpec::clear_name() { 391 | name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 392 | } 393 | inline const ::std::string& ModelSpec::name() const { 394 | // @@protoc_insertion_point(field_get:tensorflow.serving.ModelSpec.name) 395 | return name_.Get(); 396 | } 397 | inline void ModelSpec::set_name(const ::std::string& value) { 398 | 399 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 400 | // @@protoc_insertion_point(field_set:tensorflow.serving.ModelSpec.name) 401 | } 402 | #if LANG_CXX11 403 | inline void ModelSpec::set_name(::std::string&& value) { 404 | 405 | name_.Set( 406 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 407 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.serving.ModelSpec.name) 408 | } 409 | #endif 410 | inline void ModelSpec::set_name(const char* value) { 411 | GOOGLE_DCHECK(value != NULL); 412 | 413 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 414 | GetArenaNoVirtual()); 415 | // @@protoc_insertion_point(field_set_char:tensorflow.serving.ModelSpec.name) 416 | } 417 | inline void ModelSpec::set_name(const char* value, 418 | size_t size) { 419 | 420 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 421 | reinterpret_cast(value), size), GetArenaNoVirtual()); 422 | // @@protoc_insertion_point(field_set_pointer:tensorflow.serving.ModelSpec.name) 423 | } 424 | inline ::std::string* ModelSpec::mutable_name() { 425 | 426 | // @@protoc_insertion_point(field_mutable:tensorflow.serving.ModelSpec.name) 427 | return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 428 | } 429 | inline ::std::string* ModelSpec::release_name() { 430 | // @@protoc_insertion_point(field_release:tensorflow.serving.ModelSpec.name) 431 | 432 | return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 433 | } 434 | inline void ModelSpec::set_allocated_name(::std::string* name) { 435 | if (name != NULL) { 436 | 437 | } else { 438 | 439 | } 440 | name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, 441 | GetArenaNoVirtual()); 442 | // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.ModelSpec.name) 443 | } 444 | inline ::std::string* ModelSpec::unsafe_arena_release_name() { 445 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.ModelSpec.name) 446 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 447 | 448 | return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 449 | GetArenaNoVirtual()); 450 | } 451 | inline void ModelSpec::unsafe_arena_set_allocated_name( 452 | ::std::string* name) { 453 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 454 | if (name != NULL) { 455 | 456 | } else { 457 | 458 | } 459 | name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 460 | name, GetArenaNoVirtual()); 461 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.serving.ModelSpec.name) 462 | } 463 | 464 | // .tensorflow.serving.Int64Value version = 2; 465 | inline bool ModelSpec::has_version() const { 466 | return this != internal_default_instance() && version_ != NULL; 467 | } 468 | inline void ModelSpec::clear_version() { 469 | if (GetArenaNoVirtual() == NULL && version_ != NULL) { 470 | delete version_; 471 | } 472 | version_ = NULL; 473 | } 474 | inline const ::tensorflow::serving::Int64Value& ModelSpec::_internal_version() const { 475 | return *version_; 476 | } 477 | inline const ::tensorflow::serving::Int64Value& ModelSpec::version() const { 478 | const ::tensorflow::serving::Int64Value* p = version_; 479 | // @@protoc_insertion_point(field_get:tensorflow.serving.ModelSpec.version) 480 | return p != NULL ? *p : *reinterpret_cast( 481 | &::tensorflow::serving::_Int64Value_default_instance_); 482 | } 483 | inline ::tensorflow::serving::Int64Value* ModelSpec::release_version() { 484 | // @@protoc_insertion_point(field_release:tensorflow.serving.ModelSpec.version) 485 | 486 | ::tensorflow::serving::Int64Value* temp = version_; 487 | if (GetArenaNoVirtual() != NULL) { 488 | temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); 489 | } 490 | version_ = NULL; 491 | return temp; 492 | } 493 | inline ::tensorflow::serving::Int64Value* ModelSpec::unsafe_arena_release_version() { 494 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.ModelSpec.version) 495 | 496 | ::tensorflow::serving::Int64Value* temp = version_; 497 | version_ = NULL; 498 | return temp; 499 | } 500 | inline ::tensorflow::serving::Int64Value* ModelSpec::mutable_version() { 501 | 502 | if (version_ == NULL) { 503 | auto* p = CreateMaybeMessage<::tensorflow::serving::Int64Value>(GetArenaNoVirtual()); 504 | version_ = p; 505 | } 506 | // @@protoc_insertion_point(field_mutable:tensorflow.serving.ModelSpec.version) 507 | return version_; 508 | } 509 | inline void ModelSpec::set_allocated_version(::tensorflow::serving::Int64Value* version) { 510 | ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); 511 | if (message_arena == NULL) { 512 | delete version_; 513 | } 514 | if (version) { 515 | ::google::protobuf::Arena* submessage_arena = 516 | ::google::protobuf::Arena::GetArena(version); 517 | if (message_arena != submessage_arena) { 518 | version = ::google::protobuf::internal::GetOwnedMessage( 519 | message_arena, version, submessage_arena); 520 | } 521 | 522 | } else { 523 | 524 | } 525 | version_ = version; 526 | // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.ModelSpec.version) 527 | } 528 | 529 | // string signature_name = 3; 530 | inline void ModelSpec::clear_signature_name() { 531 | signature_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 532 | } 533 | inline const ::std::string& ModelSpec::signature_name() const { 534 | // @@protoc_insertion_point(field_get:tensorflow.serving.ModelSpec.signature_name) 535 | return signature_name_.Get(); 536 | } 537 | inline void ModelSpec::set_signature_name(const ::std::string& value) { 538 | 539 | signature_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 540 | // @@protoc_insertion_point(field_set:tensorflow.serving.ModelSpec.signature_name) 541 | } 542 | #if LANG_CXX11 543 | inline void ModelSpec::set_signature_name(::std::string&& value) { 544 | 545 | signature_name_.Set( 546 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 547 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.serving.ModelSpec.signature_name) 548 | } 549 | #endif 550 | inline void ModelSpec::set_signature_name(const char* value) { 551 | GOOGLE_DCHECK(value != NULL); 552 | 553 | signature_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 554 | GetArenaNoVirtual()); 555 | // @@protoc_insertion_point(field_set_char:tensorflow.serving.ModelSpec.signature_name) 556 | } 557 | inline void ModelSpec::set_signature_name(const char* value, 558 | size_t size) { 559 | 560 | signature_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 561 | reinterpret_cast(value), size), GetArenaNoVirtual()); 562 | // @@protoc_insertion_point(field_set_pointer:tensorflow.serving.ModelSpec.signature_name) 563 | } 564 | inline ::std::string* ModelSpec::mutable_signature_name() { 565 | 566 | // @@protoc_insertion_point(field_mutable:tensorflow.serving.ModelSpec.signature_name) 567 | return signature_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 568 | } 569 | inline ::std::string* ModelSpec::release_signature_name() { 570 | // @@protoc_insertion_point(field_release:tensorflow.serving.ModelSpec.signature_name) 571 | 572 | return signature_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 573 | } 574 | inline void ModelSpec::set_allocated_signature_name(::std::string* signature_name) { 575 | if (signature_name != NULL) { 576 | 577 | } else { 578 | 579 | } 580 | signature_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), signature_name, 581 | GetArenaNoVirtual()); 582 | // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.ModelSpec.signature_name) 583 | } 584 | inline ::std::string* ModelSpec::unsafe_arena_release_signature_name() { 585 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.ModelSpec.signature_name) 586 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 587 | 588 | return signature_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 589 | GetArenaNoVirtual()); 590 | } 591 | inline void ModelSpec::unsafe_arena_set_allocated_signature_name( 592 | ::std::string* signature_name) { 593 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 594 | if (signature_name != NULL) { 595 | 596 | } else { 597 | 598 | } 599 | signature_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 600 | signature_name, GetArenaNoVirtual()); 601 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.serving.ModelSpec.signature_name) 602 | } 603 | 604 | #ifdef __GNUC__ 605 | #pragma GCC diagnostic pop 606 | #endif // __GNUC__ 607 | // ------------------------------------------------------------------- 608 | 609 | 610 | // @@protoc_insertion_point(namespace_scope) 611 | 612 | } // namespace serving 613 | } // namespace tensorflow 614 | 615 | // @@protoc_insertion_point(global_scope) 616 | 617 | #endif // PROTOBUF_INCLUDED_model_2eproto 618 | -------------------------------------------------------------------------------- /src/generated/predict.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: predict.proto 4 | 5 | #include "predict.pb.h" 6 | #include "predict.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | namespace serving { 18 | 19 | } // namespace tensorflow 20 | } // namespace serving 21 | 22 | -------------------------------------------------------------------------------- /src/generated/predict.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: predict.proto 4 | #ifndef GRPC_predict_2eproto__INCLUDED 5 | #define GRPC_predict_2eproto__INCLUDED 6 | 7 | #include "predict.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace grpc { 21 | class CompletionQueue; 22 | class Channel; 23 | class ServerCompletionQueue; 24 | class ServerContext; 25 | } // namespace grpc 26 | 27 | namespace tensorflow { 28 | namespace serving { 29 | 30 | } // namespace serving 31 | } // namespace tensorflow 32 | 33 | 34 | #endif // GRPC_predict_2eproto__INCLUDED 35 | -------------------------------------------------------------------------------- /src/generated/predict.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: predict.proto 3 | 4 | #ifndef PROTOBUF_INCLUDED_predict_2eproto 5 | #define PROTOBUF_INCLUDED_predict_2eproto 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 3006000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include // IWYU pragma: export 31 | #include // IWYU pragma: export 32 | #include // IWYU pragma: export 33 | #include 34 | #include 35 | #include 36 | #include "tensor.pb.h" 37 | #include "model.pb.h" 38 | // @@protoc_insertion_point(includes) 39 | #define PROTOBUF_INTERNAL_EXPORT_protobuf_predict_2eproto 40 | 41 | namespace protobuf_predict_2eproto { 42 | // Internal implementation detail -- do not use these members. 43 | struct TableStruct { 44 | static const ::google::protobuf::internal::ParseTableField entries[]; 45 | static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; 46 | static const ::google::protobuf::internal::ParseTable schema[4]; 47 | static const ::google::protobuf::internal::FieldMetadata field_metadata[]; 48 | static const ::google::protobuf::internal::SerializationTable serialization_table[]; 49 | static const ::google::protobuf::uint32 offsets[]; 50 | }; 51 | void AddDescriptors(); 52 | } // namespace protobuf_predict_2eproto 53 | namespace tensorflow { 54 | namespace serving { 55 | class PredictRequest; 56 | class PredictRequestDefaultTypeInternal; 57 | extern PredictRequestDefaultTypeInternal _PredictRequest_default_instance_; 58 | class PredictRequest_InputsEntry_DoNotUse; 59 | class PredictRequest_InputsEntry_DoNotUseDefaultTypeInternal; 60 | extern PredictRequest_InputsEntry_DoNotUseDefaultTypeInternal _PredictRequest_InputsEntry_DoNotUse_default_instance_; 61 | class PredictResponse; 62 | class PredictResponseDefaultTypeInternal; 63 | extern PredictResponseDefaultTypeInternal _PredictResponse_default_instance_; 64 | class PredictResponse_OutputsEntry_DoNotUse; 65 | class PredictResponse_OutputsEntry_DoNotUseDefaultTypeInternal; 66 | extern PredictResponse_OutputsEntry_DoNotUseDefaultTypeInternal _PredictResponse_OutputsEntry_DoNotUse_default_instance_; 67 | } // namespace serving 68 | } // namespace tensorflow 69 | namespace google { 70 | namespace protobuf { 71 | template<> ::tensorflow::serving::PredictRequest* Arena::CreateMaybeMessage<::tensorflow::serving::PredictRequest>(Arena*); 72 | template<> ::tensorflow::serving::PredictRequest_InputsEntry_DoNotUse* Arena::CreateMaybeMessage<::tensorflow::serving::PredictRequest_InputsEntry_DoNotUse>(Arena*); 73 | template<> ::tensorflow::serving::PredictResponse* Arena::CreateMaybeMessage<::tensorflow::serving::PredictResponse>(Arena*); 74 | template<> ::tensorflow::serving::PredictResponse_OutputsEntry_DoNotUse* Arena::CreateMaybeMessage<::tensorflow::serving::PredictResponse_OutputsEntry_DoNotUse>(Arena*); 75 | } // namespace protobuf 76 | } // namespace google 77 | namespace tensorflow { 78 | namespace serving { 79 | 80 | // =================================================================== 81 | 82 | class PredictRequest_InputsEntry_DoNotUse : public ::google::protobuf::internal::MapEntry { 87 | public: 88 | typedef ::google::protobuf::internal::MapEntry SuperType; 93 | PredictRequest_InputsEntry_DoNotUse(); 94 | PredictRequest_InputsEntry_DoNotUse(::google::protobuf::Arena* arena); 95 | void MergeFrom(const PredictRequest_InputsEntry_DoNotUse& other); 96 | static const PredictRequest_InputsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast(&_PredictRequest_InputsEntry_DoNotUse_default_instance_); } 97 | void MergeFrom(const ::google::protobuf::Message& other) final; 98 | ::google::protobuf::Metadata GetMetadata() const; 99 | }; 100 | 101 | // ------------------------------------------------------------------- 102 | 103 | class PredictRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.serving.PredictRequest) */ { 104 | public: 105 | PredictRequest(); 106 | virtual ~PredictRequest(); 107 | 108 | PredictRequest(const PredictRequest& from); 109 | 110 | inline PredictRequest& operator=(const PredictRequest& from) { 111 | CopyFrom(from); 112 | return *this; 113 | } 114 | #if LANG_CXX11 115 | PredictRequest(PredictRequest&& from) noexcept 116 | : PredictRequest() { 117 | *this = ::std::move(from); 118 | } 119 | 120 | inline PredictRequest& operator=(PredictRequest&& from) noexcept { 121 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 122 | if (this != &from) InternalSwap(&from); 123 | } else { 124 | CopyFrom(from); 125 | } 126 | return *this; 127 | } 128 | #endif 129 | inline ::google::protobuf::Arena* GetArena() const final { 130 | return GetArenaNoVirtual(); 131 | } 132 | inline void* GetMaybeArenaPointer() const final { 133 | return MaybeArenaPtr(); 134 | } 135 | static const ::google::protobuf::Descriptor* descriptor(); 136 | static const PredictRequest& default_instance(); 137 | 138 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 139 | static inline const PredictRequest* internal_default_instance() { 140 | return reinterpret_cast( 141 | &_PredictRequest_default_instance_); 142 | } 143 | static constexpr int kIndexInFileMessages = 144 | 1; 145 | 146 | void UnsafeArenaSwap(PredictRequest* other); 147 | void Swap(PredictRequest* other); 148 | friend void swap(PredictRequest& a, PredictRequest& b) { 149 | a.Swap(&b); 150 | } 151 | 152 | // implements Message ---------------------------------------------- 153 | 154 | inline PredictRequest* New() const final { 155 | return CreateMaybeMessage(NULL); 156 | } 157 | 158 | PredictRequest* New(::google::protobuf::Arena* arena) const final { 159 | return CreateMaybeMessage(arena); 160 | } 161 | void CopyFrom(const ::google::protobuf::Message& from) final; 162 | void MergeFrom(const ::google::protobuf::Message& from) final; 163 | void CopyFrom(const PredictRequest& from); 164 | void MergeFrom(const PredictRequest& from); 165 | void Clear() final; 166 | bool IsInitialized() const final; 167 | 168 | size_t ByteSizeLong() const final; 169 | bool MergePartialFromCodedStream( 170 | ::google::protobuf::io::CodedInputStream* input) final; 171 | void SerializeWithCachedSizes( 172 | ::google::protobuf::io::CodedOutputStream* output) const final; 173 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 174 | bool deterministic, ::google::protobuf::uint8* target) const final; 175 | int GetCachedSize() const final { return _cached_size_.Get(); } 176 | 177 | private: 178 | void SharedCtor(); 179 | void SharedDtor(); 180 | void SetCachedSize(int size) const final; 181 | void InternalSwap(PredictRequest* other); 182 | protected: 183 | explicit PredictRequest(::google::protobuf::Arena* arena); 184 | private: 185 | static void ArenaDtor(void* object); 186 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 187 | private: 188 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 189 | return _internal_metadata_.arena(); 190 | } 191 | inline void* MaybeArenaPtr() const { 192 | return _internal_metadata_.raw_arena_ptr(); 193 | } 194 | public: 195 | 196 | ::google::protobuf::Metadata GetMetadata() const final; 197 | 198 | // nested types ---------------------------------------------------- 199 | 200 | 201 | // accessors ------------------------------------------------------- 202 | 203 | // map inputs = 2; 204 | int inputs_size() const; 205 | void clear_inputs(); 206 | static const int kInputsFieldNumber = 2; 207 | const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >& 208 | inputs() const; 209 | ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >* 210 | mutable_inputs(); 211 | 212 | // repeated string output_filter = 3; 213 | int output_filter_size() const; 214 | void clear_output_filter(); 215 | static const int kOutputFilterFieldNumber = 3; 216 | const ::std::string& output_filter(int index) const; 217 | ::std::string* mutable_output_filter(int index); 218 | void set_output_filter(int index, const ::std::string& value); 219 | #if LANG_CXX11 220 | void set_output_filter(int index, ::std::string&& value); 221 | #endif 222 | void set_output_filter(int index, const char* value); 223 | void set_output_filter(int index, const char* value, size_t size); 224 | ::std::string* add_output_filter(); 225 | void add_output_filter(const ::std::string& value); 226 | #if LANG_CXX11 227 | void add_output_filter(::std::string&& value); 228 | #endif 229 | void add_output_filter(const char* value); 230 | void add_output_filter(const char* value, size_t size); 231 | const ::google::protobuf::RepeatedPtrField< ::std::string>& output_filter() const; 232 | ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_output_filter(); 233 | 234 | // .tensorflow.serving.ModelSpec model_spec = 1; 235 | bool has_model_spec() const; 236 | void clear_model_spec(); 237 | static const int kModelSpecFieldNumber = 1; 238 | private: 239 | const ::tensorflow::serving::ModelSpec& _internal_model_spec() const; 240 | public: 241 | const ::tensorflow::serving::ModelSpec& model_spec() const; 242 | ::tensorflow::serving::ModelSpec* release_model_spec(); 243 | ::tensorflow::serving::ModelSpec* mutable_model_spec(); 244 | void set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec); 245 | void unsafe_arena_set_allocated_model_spec( 246 | ::tensorflow::serving::ModelSpec* model_spec); 247 | ::tensorflow::serving::ModelSpec* unsafe_arena_release_model_spec(); 248 | 249 | // @@protoc_insertion_point(class_scope:tensorflow.serving.PredictRequest) 250 | private: 251 | 252 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 253 | template friend class ::google::protobuf::Arena::InternalHelper; 254 | typedef void InternalArenaConstructable_; 255 | typedef void DestructorSkippable_; 256 | ::google::protobuf::internal::MapField< 257 | PredictRequest_InputsEntry_DoNotUse, 258 | ::std::string, ::tensorflow::TensorProto, 259 | ::google::protobuf::internal::WireFormatLite::TYPE_STRING, 260 | ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, 261 | 0 > inputs_; 262 | ::google::protobuf::RepeatedPtrField< ::std::string> output_filter_; 263 | ::tensorflow::serving::ModelSpec* model_spec_; 264 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 265 | friend struct ::protobuf_predict_2eproto::TableStruct; 266 | }; 267 | // ------------------------------------------------------------------- 268 | 269 | class PredictResponse_OutputsEntry_DoNotUse : public ::google::protobuf::internal::MapEntry { 274 | public: 275 | typedef ::google::protobuf::internal::MapEntry SuperType; 280 | PredictResponse_OutputsEntry_DoNotUse(); 281 | PredictResponse_OutputsEntry_DoNotUse(::google::protobuf::Arena* arena); 282 | void MergeFrom(const PredictResponse_OutputsEntry_DoNotUse& other); 283 | static const PredictResponse_OutputsEntry_DoNotUse* internal_default_instance() { return reinterpret_cast(&_PredictResponse_OutputsEntry_DoNotUse_default_instance_); } 284 | void MergeFrom(const ::google::protobuf::Message& other) final; 285 | ::google::protobuf::Metadata GetMetadata() const; 286 | }; 287 | 288 | // ------------------------------------------------------------------- 289 | 290 | class PredictResponse : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.serving.PredictResponse) */ { 291 | public: 292 | PredictResponse(); 293 | virtual ~PredictResponse(); 294 | 295 | PredictResponse(const PredictResponse& from); 296 | 297 | inline PredictResponse& operator=(const PredictResponse& from) { 298 | CopyFrom(from); 299 | return *this; 300 | } 301 | #if LANG_CXX11 302 | PredictResponse(PredictResponse&& from) noexcept 303 | : PredictResponse() { 304 | *this = ::std::move(from); 305 | } 306 | 307 | inline PredictResponse& operator=(PredictResponse&& from) noexcept { 308 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 309 | if (this != &from) InternalSwap(&from); 310 | } else { 311 | CopyFrom(from); 312 | } 313 | return *this; 314 | } 315 | #endif 316 | inline ::google::protobuf::Arena* GetArena() const final { 317 | return GetArenaNoVirtual(); 318 | } 319 | inline void* GetMaybeArenaPointer() const final { 320 | return MaybeArenaPtr(); 321 | } 322 | static const ::google::protobuf::Descriptor* descriptor(); 323 | static const PredictResponse& default_instance(); 324 | 325 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 326 | static inline const PredictResponse* internal_default_instance() { 327 | return reinterpret_cast( 328 | &_PredictResponse_default_instance_); 329 | } 330 | static constexpr int kIndexInFileMessages = 331 | 3; 332 | 333 | void UnsafeArenaSwap(PredictResponse* other); 334 | void Swap(PredictResponse* other); 335 | friend void swap(PredictResponse& a, PredictResponse& b) { 336 | a.Swap(&b); 337 | } 338 | 339 | // implements Message ---------------------------------------------- 340 | 341 | inline PredictResponse* New() const final { 342 | return CreateMaybeMessage(NULL); 343 | } 344 | 345 | PredictResponse* New(::google::protobuf::Arena* arena) const final { 346 | return CreateMaybeMessage(arena); 347 | } 348 | void CopyFrom(const ::google::protobuf::Message& from) final; 349 | void MergeFrom(const ::google::protobuf::Message& from) final; 350 | void CopyFrom(const PredictResponse& from); 351 | void MergeFrom(const PredictResponse& from); 352 | void Clear() final; 353 | bool IsInitialized() const final; 354 | 355 | size_t ByteSizeLong() const final; 356 | bool MergePartialFromCodedStream( 357 | ::google::protobuf::io::CodedInputStream* input) final; 358 | void SerializeWithCachedSizes( 359 | ::google::protobuf::io::CodedOutputStream* output) const final; 360 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 361 | bool deterministic, ::google::protobuf::uint8* target) const final; 362 | int GetCachedSize() const final { return _cached_size_.Get(); } 363 | 364 | private: 365 | void SharedCtor(); 366 | void SharedDtor(); 367 | void SetCachedSize(int size) const final; 368 | void InternalSwap(PredictResponse* other); 369 | protected: 370 | explicit PredictResponse(::google::protobuf::Arena* arena); 371 | private: 372 | static void ArenaDtor(void* object); 373 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 374 | private: 375 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 376 | return _internal_metadata_.arena(); 377 | } 378 | inline void* MaybeArenaPtr() const { 379 | return _internal_metadata_.raw_arena_ptr(); 380 | } 381 | public: 382 | 383 | ::google::protobuf::Metadata GetMetadata() const final; 384 | 385 | // nested types ---------------------------------------------------- 386 | 387 | 388 | // accessors ------------------------------------------------------- 389 | 390 | // map outputs = 1; 391 | int outputs_size() const; 392 | void clear_outputs(); 393 | static const int kOutputsFieldNumber = 1; 394 | const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >& 395 | outputs() const; 396 | ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >* 397 | mutable_outputs(); 398 | 399 | // .tensorflow.serving.ModelSpec model_spec = 2; 400 | bool has_model_spec() const; 401 | void clear_model_spec(); 402 | static const int kModelSpecFieldNumber = 2; 403 | private: 404 | const ::tensorflow::serving::ModelSpec& _internal_model_spec() const; 405 | public: 406 | const ::tensorflow::serving::ModelSpec& model_spec() const; 407 | ::tensorflow::serving::ModelSpec* release_model_spec(); 408 | ::tensorflow::serving::ModelSpec* mutable_model_spec(); 409 | void set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec); 410 | void unsafe_arena_set_allocated_model_spec( 411 | ::tensorflow::serving::ModelSpec* model_spec); 412 | ::tensorflow::serving::ModelSpec* unsafe_arena_release_model_spec(); 413 | 414 | // @@protoc_insertion_point(class_scope:tensorflow.serving.PredictResponse) 415 | private: 416 | 417 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 418 | template friend class ::google::protobuf::Arena::InternalHelper; 419 | typedef void InternalArenaConstructable_; 420 | typedef void DestructorSkippable_; 421 | ::google::protobuf::internal::MapField< 422 | PredictResponse_OutputsEntry_DoNotUse, 423 | ::std::string, ::tensorflow::TensorProto, 424 | ::google::protobuf::internal::WireFormatLite::TYPE_STRING, 425 | ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, 426 | 0 > outputs_; 427 | ::tensorflow::serving::ModelSpec* model_spec_; 428 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 429 | friend struct ::protobuf_predict_2eproto::TableStruct; 430 | }; 431 | // =================================================================== 432 | 433 | 434 | // =================================================================== 435 | 436 | #ifdef __GNUC__ 437 | #pragma GCC diagnostic push 438 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 439 | #endif // __GNUC__ 440 | // ------------------------------------------------------------------- 441 | 442 | // PredictRequest 443 | 444 | // .tensorflow.serving.ModelSpec model_spec = 1; 445 | inline bool PredictRequest::has_model_spec() const { 446 | return this != internal_default_instance() && model_spec_ != NULL; 447 | } 448 | inline const ::tensorflow::serving::ModelSpec& PredictRequest::_internal_model_spec() const { 449 | return *model_spec_; 450 | } 451 | inline const ::tensorflow::serving::ModelSpec& PredictRequest::model_spec() const { 452 | const ::tensorflow::serving::ModelSpec* p = model_spec_; 453 | // @@protoc_insertion_point(field_get:tensorflow.serving.PredictRequest.model_spec) 454 | return p != NULL ? *p : *reinterpret_cast( 455 | &::tensorflow::serving::_ModelSpec_default_instance_); 456 | } 457 | inline ::tensorflow::serving::ModelSpec* PredictRequest::release_model_spec() { 458 | // @@protoc_insertion_point(field_release:tensorflow.serving.PredictRequest.model_spec) 459 | 460 | ::tensorflow::serving::ModelSpec* temp = model_spec_; 461 | if (GetArenaNoVirtual() != NULL) { 462 | temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); 463 | } 464 | model_spec_ = NULL; 465 | return temp; 466 | } 467 | inline ::tensorflow::serving::ModelSpec* PredictRequest::unsafe_arena_release_model_spec() { 468 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.PredictRequest.model_spec) 469 | 470 | ::tensorflow::serving::ModelSpec* temp = model_spec_; 471 | model_spec_ = NULL; 472 | return temp; 473 | } 474 | inline ::tensorflow::serving::ModelSpec* PredictRequest::mutable_model_spec() { 475 | 476 | if (model_spec_ == NULL) { 477 | auto* p = CreateMaybeMessage<::tensorflow::serving::ModelSpec>(GetArenaNoVirtual()); 478 | model_spec_ = p; 479 | } 480 | // @@protoc_insertion_point(field_mutable:tensorflow.serving.PredictRequest.model_spec) 481 | return model_spec_; 482 | } 483 | inline void PredictRequest::set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec) { 484 | ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); 485 | if (message_arena == NULL) { 486 | delete reinterpret_cast< ::google::protobuf::MessageLite*>(model_spec_); 487 | } 488 | if (model_spec) { 489 | ::google::protobuf::Arena* submessage_arena = 490 | reinterpret_cast<::google::protobuf::MessageLite*>(model_spec)->GetArena(); 491 | if (message_arena != submessage_arena) { 492 | model_spec = ::google::protobuf::internal::GetOwnedMessage( 493 | message_arena, model_spec, submessage_arena); 494 | } 495 | 496 | } else { 497 | 498 | } 499 | model_spec_ = model_spec; 500 | // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.PredictRequest.model_spec) 501 | } 502 | 503 | // map inputs = 2; 504 | inline int PredictRequest::inputs_size() const { 505 | return inputs_.size(); 506 | } 507 | inline const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >& 508 | PredictRequest::inputs() const { 509 | // @@protoc_insertion_point(field_map:tensorflow.serving.PredictRequest.inputs) 510 | return inputs_.GetMap(); 511 | } 512 | inline ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >* 513 | PredictRequest::mutable_inputs() { 514 | // @@protoc_insertion_point(field_mutable_map:tensorflow.serving.PredictRequest.inputs) 515 | return inputs_.MutableMap(); 516 | } 517 | 518 | // repeated string output_filter = 3; 519 | inline int PredictRequest::output_filter_size() const { 520 | return output_filter_.size(); 521 | } 522 | inline void PredictRequest::clear_output_filter() { 523 | output_filter_.Clear(); 524 | } 525 | inline const ::std::string& PredictRequest::output_filter(int index) const { 526 | // @@protoc_insertion_point(field_get:tensorflow.serving.PredictRequest.output_filter) 527 | return output_filter_.Get(index); 528 | } 529 | inline ::std::string* PredictRequest::mutable_output_filter(int index) { 530 | // @@protoc_insertion_point(field_mutable:tensorflow.serving.PredictRequest.output_filter) 531 | return output_filter_.Mutable(index); 532 | } 533 | inline void PredictRequest::set_output_filter(int index, const ::std::string& value) { 534 | // @@protoc_insertion_point(field_set:tensorflow.serving.PredictRequest.output_filter) 535 | output_filter_.Mutable(index)->assign(value); 536 | } 537 | #if LANG_CXX11 538 | inline void PredictRequest::set_output_filter(int index, ::std::string&& value) { 539 | // @@protoc_insertion_point(field_set:tensorflow.serving.PredictRequest.output_filter) 540 | output_filter_.Mutable(index)->assign(std::move(value)); 541 | } 542 | #endif 543 | inline void PredictRequest::set_output_filter(int index, const char* value) { 544 | GOOGLE_DCHECK(value != NULL); 545 | output_filter_.Mutable(index)->assign(value); 546 | // @@protoc_insertion_point(field_set_char:tensorflow.serving.PredictRequest.output_filter) 547 | } 548 | inline void PredictRequest::set_output_filter(int index, const char* value, size_t size) { 549 | output_filter_.Mutable(index)->assign( 550 | reinterpret_cast(value), size); 551 | // @@protoc_insertion_point(field_set_pointer:tensorflow.serving.PredictRequest.output_filter) 552 | } 553 | inline ::std::string* PredictRequest::add_output_filter() { 554 | // @@protoc_insertion_point(field_add_mutable:tensorflow.serving.PredictRequest.output_filter) 555 | return output_filter_.Add(); 556 | } 557 | inline void PredictRequest::add_output_filter(const ::std::string& value) { 558 | output_filter_.Add()->assign(value); 559 | // @@protoc_insertion_point(field_add:tensorflow.serving.PredictRequest.output_filter) 560 | } 561 | #if LANG_CXX11 562 | inline void PredictRequest::add_output_filter(::std::string&& value) { 563 | output_filter_.Add(std::move(value)); 564 | // @@protoc_insertion_point(field_add:tensorflow.serving.PredictRequest.output_filter) 565 | } 566 | #endif 567 | inline void PredictRequest::add_output_filter(const char* value) { 568 | GOOGLE_DCHECK(value != NULL); 569 | output_filter_.Add()->assign(value); 570 | // @@protoc_insertion_point(field_add_char:tensorflow.serving.PredictRequest.output_filter) 571 | } 572 | inline void PredictRequest::add_output_filter(const char* value, size_t size) { 573 | output_filter_.Add()->assign(reinterpret_cast(value), size); 574 | // @@protoc_insertion_point(field_add_pointer:tensorflow.serving.PredictRequest.output_filter) 575 | } 576 | inline const ::google::protobuf::RepeatedPtrField< ::std::string>& 577 | PredictRequest::output_filter() const { 578 | // @@protoc_insertion_point(field_list:tensorflow.serving.PredictRequest.output_filter) 579 | return output_filter_; 580 | } 581 | inline ::google::protobuf::RepeatedPtrField< ::std::string>* 582 | PredictRequest::mutable_output_filter() { 583 | // @@protoc_insertion_point(field_mutable_list:tensorflow.serving.PredictRequest.output_filter) 584 | return &output_filter_; 585 | } 586 | 587 | // ------------------------------------------------------------------- 588 | 589 | // ------------------------------------------------------------------- 590 | 591 | // PredictResponse 592 | 593 | // .tensorflow.serving.ModelSpec model_spec = 2; 594 | inline bool PredictResponse::has_model_spec() const { 595 | return this != internal_default_instance() && model_spec_ != NULL; 596 | } 597 | inline const ::tensorflow::serving::ModelSpec& PredictResponse::_internal_model_spec() const { 598 | return *model_spec_; 599 | } 600 | inline const ::tensorflow::serving::ModelSpec& PredictResponse::model_spec() const { 601 | const ::tensorflow::serving::ModelSpec* p = model_spec_; 602 | // @@protoc_insertion_point(field_get:tensorflow.serving.PredictResponse.model_spec) 603 | return p != NULL ? *p : *reinterpret_cast( 604 | &::tensorflow::serving::_ModelSpec_default_instance_); 605 | } 606 | inline ::tensorflow::serving::ModelSpec* PredictResponse::release_model_spec() { 607 | // @@protoc_insertion_point(field_release:tensorflow.serving.PredictResponse.model_spec) 608 | 609 | ::tensorflow::serving::ModelSpec* temp = model_spec_; 610 | if (GetArenaNoVirtual() != NULL) { 611 | temp = ::google::protobuf::internal::DuplicateIfNonNull(temp); 612 | } 613 | model_spec_ = NULL; 614 | return temp; 615 | } 616 | inline ::tensorflow::serving::ModelSpec* PredictResponse::unsafe_arena_release_model_spec() { 617 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.serving.PredictResponse.model_spec) 618 | 619 | ::tensorflow::serving::ModelSpec* temp = model_spec_; 620 | model_spec_ = NULL; 621 | return temp; 622 | } 623 | inline ::tensorflow::serving::ModelSpec* PredictResponse::mutable_model_spec() { 624 | 625 | if (model_spec_ == NULL) { 626 | auto* p = CreateMaybeMessage<::tensorflow::serving::ModelSpec>(GetArenaNoVirtual()); 627 | model_spec_ = p; 628 | } 629 | // @@protoc_insertion_point(field_mutable:tensorflow.serving.PredictResponse.model_spec) 630 | return model_spec_; 631 | } 632 | inline void PredictResponse::set_allocated_model_spec(::tensorflow::serving::ModelSpec* model_spec) { 633 | ::google::protobuf::Arena* message_arena = GetArenaNoVirtual(); 634 | if (message_arena == NULL) { 635 | delete reinterpret_cast< ::google::protobuf::MessageLite*>(model_spec_); 636 | } 637 | if (model_spec) { 638 | ::google::protobuf::Arena* submessage_arena = 639 | reinterpret_cast<::google::protobuf::MessageLite*>(model_spec)->GetArena(); 640 | if (message_arena != submessage_arena) { 641 | model_spec = ::google::protobuf::internal::GetOwnedMessage( 642 | message_arena, model_spec, submessage_arena); 643 | } 644 | 645 | } else { 646 | 647 | } 648 | model_spec_ = model_spec; 649 | // @@protoc_insertion_point(field_set_allocated:tensorflow.serving.PredictResponse.model_spec) 650 | } 651 | 652 | // map outputs = 1; 653 | inline int PredictResponse::outputs_size() const { 654 | return outputs_.size(); 655 | } 656 | inline const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >& 657 | PredictResponse::outputs() const { 658 | // @@protoc_insertion_point(field_map:tensorflow.serving.PredictResponse.outputs) 659 | return outputs_.GetMap(); 660 | } 661 | inline ::google::protobuf::Map< ::std::string, ::tensorflow::TensorProto >* 662 | PredictResponse::mutable_outputs() { 663 | // @@protoc_insertion_point(field_mutable_map:tensorflow.serving.PredictResponse.outputs) 664 | return outputs_.MutableMap(); 665 | } 666 | 667 | #ifdef __GNUC__ 668 | #pragma GCC diagnostic pop 669 | #endif // __GNUC__ 670 | // ------------------------------------------------------------------- 671 | 672 | // ------------------------------------------------------------------- 673 | 674 | // ------------------------------------------------------------------- 675 | 676 | 677 | // @@protoc_insertion_point(namespace_scope) 678 | 679 | } // namespace serving 680 | } // namespace tensorflow 681 | 682 | // @@protoc_insertion_point(global_scope) 683 | 684 | #endif // PROTOBUF_INCLUDED_predict_2eproto 685 | -------------------------------------------------------------------------------- /src/generated/prediction_service.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: prediction_service.proto 4 | 5 | #include "prediction_service.pb.h" 6 | #include "prediction_service.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | namespace serving { 18 | 19 | static const char* PredictionService_method_names[] = { 20 | "/tensorflow.serving.PredictionService/Predict", 21 | }; 22 | 23 | std::unique_ptr< PredictionService::Stub> PredictionService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { 24 | (void)options; 25 | std::unique_ptr< PredictionService::Stub> stub(new PredictionService::Stub(channel)); 26 | return stub; 27 | } 28 | 29 | PredictionService::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) 30 | : channel_(channel), rpcmethod_Predict_(PredictionService_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) 31 | {} 32 | 33 | ::grpc::Status PredictionService::Stub::Predict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::tensorflow::serving::PredictResponse* response) { 34 | return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Predict_, context, request, response); 35 | } 36 | 37 | ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>* PredictionService::Stub::AsyncPredictRaw(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) { 38 | return ::grpc::internal::ClientAsyncResponseReaderFactory< ::tensorflow::serving::PredictResponse>::Create(channel_.get(), cq, rpcmethod_Predict_, context, request, true); 39 | } 40 | 41 | ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>* PredictionService::Stub::PrepareAsyncPredictRaw(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) { 42 | return ::grpc::internal::ClientAsyncResponseReaderFactory< ::tensorflow::serving::PredictResponse>::Create(channel_.get(), cq, rpcmethod_Predict_, context, request, false); 43 | } 44 | 45 | PredictionService::Service::Service() { 46 | AddMethod(new ::grpc::internal::RpcServiceMethod( 47 | PredictionService_method_names[0], 48 | ::grpc::internal::RpcMethod::NORMAL_RPC, 49 | new ::grpc::internal::RpcMethodHandler< PredictionService::Service, ::tensorflow::serving::PredictRequest, ::tensorflow::serving::PredictResponse>( 50 | std::mem_fn(&PredictionService::Service::Predict), this))); 51 | } 52 | 53 | PredictionService::Service::~Service() { 54 | } 55 | 56 | ::grpc::Status PredictionService::Service::Predict(::grpc::ServerContext* context, const ::tensorflow::serving::PredictRequest* request, ::tensorflow::serving::PredictResponse* response) { 57 | (void) context; 58 | (void) request; 59 | (void) response; 60 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 61 | } 62 | 63 | 64 | } // namespace tensorflow 65 | } // namespace serving 66 | 67 | -------------------------------------------------------------------------------- /src/generated/prediction_service.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: prediction_service.proto 4 | #ifndef GRPC_prediction_5fservice_2eproto__INCLUDED 5 | #define GRPC_prediction_5fservice_2eproto__INCLUDED 6 | 7 | #include "prediction_service.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace grpc { 21 | class CompletionQueue; 22 | class Channel; 23 | class ServerCompletionQueue; 24 | class ServerContext; 25 | } // namespace grpc 26 | 27 | namespace tensorflow { 28 | namespace serving { 29 | 30 | // open source marker; do not remove 31 | // PredictionService provides access to machine-learned models loaded by 32 | // model_servers. 33 | class PredictionService final { 34 | public: 35 | static constexpr char const* service_full_name() { 36 | return "tensorflow.serving.PredictionService"; 37 | } 38 | class StubInterface { 39 | public: 40 | virtual ~StubInterface() {} 41 | // Predict -- provides access to loaded TensorFlow model. 42 | virtual ::grpc::Status Predict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::tensorflow::serving::PredictResponse* response) = 0; 43 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tensorflow::serving::PredictResponse>> AsyncPredict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) { 44 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tensorflow::serving::PredictResponse>>(AsyncPredictRaw(context, request, cq)); 45 | } 46 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tensorflow::serving::PredictResponse>> PrepareAsyncPredict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) { 47 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::tensorflow::serving::PredictResponse>>(PrepareAsyncPredictRaw(context, request, cq)); 48 | } 49 | private: 50 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::tensorflow::serving::PredictResponse>* AsyncPredictRaw(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) = 0; 51 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::tensorflow::serving::PredictResponse>* PrepareAsyncPredictRaw(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) = 0; 52 | }; 53 | class Stub final : public StubInterface { 54 | public: 55 | Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); 56 | ::grpc::Status Predict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::tensorflow::serving::PredictResponse* response) override; 57 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>> AsyncPredict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) { 58 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>>(AsyncPredictRaw(context, request, cq)); 59 | } 60 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>> PrepareAsyncPredict(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) { 61 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>>(PrepareAsyncPredictRaw(context, request, cq)); 62 | } 63 | 64 | private: 65 | std::shared_ptr< ::grpc::ChannelInterface> channel_; 66 | ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>* AsyncPredictRaw(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) override; 67 | ::grpc::ClientAsyncResponseReader< ::tensorflow::serving::PredictResponse>* PrepareAsyncPredictRaw(::grpc::ClientContext* context, const ::tensorflow::serving::PredictRequest& request, ::grpc::CompletionQueue* cq) override; 68 | const ::grpc::internal::RpcMethod rpcmethod_Predict_; 69 | }; 70 | static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); 71 | 72 | class Service : public ::grpc::Service { 73 | public: 74 | Service(); 75 | virtual ~Service(); 76 | // Predict -- provides access to loaded TensorFlow model. 77 | virtual ::grpc::Status Predict(::grpc::ServerContext* context, const ::tensorflow::serving::PredictRequest* request, ::tensorflow::serving::PredictResponse* response); 78 | }; 79 | template 80 | class WithAsyncMethod_Predict : public BaseClass { 81 | private: 82 | void BaseClassMustBeDerivedFromService(const Service *service) {} 83 | public: 84 | WithAsyncMethod_Predict() { 85 | ::grpc::Service::MarkMethodAsync(0); 86 | } 87 | ~WithAsyncMethod_Predict() override { 88 | BaseClassMustBeDerivedFromService(this); 89 | } 90 | // disable synchronous version of this method 91 | ::grpc::Status Predict(::grpc::ServerContext* context, const ::tensorflow::serving::PredictRequest* request, ::tensorflow::serving::PredictResponse* response) override { 92 | abort(); 93 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 94 | } 95 | void RequestPredict(::grpc::ServerContext* context, ::tensorflow::serving::PredictRequest* request, ::grpc::ServerAsyncResponseWriter< ::tensorflow::serving::PredictResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 96 | ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); 97 | } 98 | }; 99 | typedef WithAsyncMethod_Predict AsyncService; 100 | template 101 | class WithGenericMethod_Predict : public BaseClass { 102 | private: 103 | void BaseClassMustBeDerivedFromService(const Service *service) {} 104 | public: 105 | WithGenericMethod_Predict() { 106 | ::grpc::Service::MarkMethodGeneric(0); 107 | } 108 | ~WithGenericMethod_Predict() override { 109 | BaseClassMustBeDerivedFromService(this); 110 | } 111 | // disable synchronous version of this method 112 | ::grpc::Status Predict(::grpc::ServerContext* context, const ::tensorflow::serving::PredictRequest* request, ::tensorflow::serving::PredictResponse* response) override { 113 | abort(); 114 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 115 | } 116 | }; 117 | template 118 | class WithRawMethod_Predict : public BaseClass { 119 | private: 120 | void BaseClassMustBeDerivedFromService(const Service *service) {} 121 | public: 122 | WithRawMethod_Predict() { 123 | ::grpc::Service::MarkMethodRaw(0); 124 | } 125 | ~WithRawMethod_Predict() override { 126 | BaseClassMustBeDerivedFromService(this); 127 | } 128 | // disable synchronous version of this method 129 | ::grpc::Status Predict(::grpc::ServerContext* context, const ::tensorflow::serving::PredictRequest* request, ::tensorflow::serving::PredictResponse* response) override { 130 | abort(); 131 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 132 | } 133 | void RequestPredict(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 134 | ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); 135 | } 136 | }; 137 | template 138 | class WithStreamedUnaryMethod_Predict : public BaseClass { 139 | private: 140 | void BaseClassMustBeDerivedFromService(const Service *service) {} 141 | public: 142 | WithStreamedUnaryMethod_Predict() { 143 | ::grpc::Service::MarkMethodStreamed(0, 144 | new ::grpc::internal::StreamedUnaryHandler< ::tensorflow::serving::PredictRequest, ::tensorflow::serving::PredictResponse>(std::bind(&WithStreamedUnaryMethod_Predict::StreamedPredict, this, std::placeholders::_1, std::placeholders::_2))); 145 | } 146 | ~WithStreamedUnaryMethod_Predict() override { 147 | BaseClassMustBeDerivedFromService(this); 148 | } 149 | // disable regular version of this method 150 | ::grpc::Status Predict(::grpc::ServerContext* context, const ::tensorflow::serving::PredictRequest* request, ::tensorflow::serving::PredictResponse* response) override { 151 | abort(); 152 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 153 | } 154 | // replace default version of method with streamed unary 155 | virtual ::grpc::Status StreamedPredict(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::tensorflow::serving::PredictRequest,::tensorflow::serving::PredictResponse>* server_unary_streamer) = 0; 156 | }; 157 | typedef WithStreamedUnaryMethod_Predict StreamedUnaryService; 158 | typedef Service SplitStreamedService; 159 | typedef WithStreamedUnaryMethod_Predict StreamedService; 160 | }; 161 | 162 | } // namespace serving 163 | } // namespace tensorflow 164 | 165 | 166 | #endif // GRPC_prediction_5fservice_2eproto__INCLUDED 167 | -------------------------------------------------------------------------------- /src/generated/prediction_service.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: prediction_service.proto 3 | 4 | #include "prediction_service.pb.h" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | // This is a temporary google only hack 17 | #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS 18 | #include "third_party/protobuf/version.h" 19 | #endif 20 | // @@protoc_insertion_point(includes) 21 | 22 | namespace tensorflow { 23 | namespace serving { 24 | } // namespace serving 25 | } // namespace tensorflow 26 | namespace protobuf_prediction_5fservice_2eproto { 27 | void InitDefaults() { 28 | } 29 | 30 | const ::google::protobuf::uint32 TableStruct::offsets[1] = {}; 31 | static const ::google::protobuf::internal::MigrationSchema* schemas = NULL; 32 | static const ::google::protobuf::Message* const* file_default_instances = NULL; 33 | 34 | static void protobuf_AssignDescriptors() { 35 | AddDescriptors(); 36 | AssignDescriptors( 37 | "prediction_service.proto", schemas, file_default_instances, TableStruct::offsets, 38 | NULL, NULL, NULL); 39 | } 40 | 41 | static void protobuf_AssignDescriptorsOnce() { 42 | static ::google::protobuf::internal::once_flag once; 43 | ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); 44 | } 45 | 46 | void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; 47 | void protobuf_RegisterTypes(const ::std::string&) { 48 | protobuf_AssignDescriptorsOnce(); 49 | } 50 | 51 | static void AddDescriptorsImpl() { 52 | InitDefaults(); 53 | static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 54 | "\n\030prediction_service.proto\022\022tensorflow.s" 55 | "erving\032\rpredict.proto2g\n\021PredictionServi" 56 | "ce\022R\n\007Predict\022\".tensorflow.serving.Predi" 57 | "ctRequest\032#.tensorflow.serving.PredictRe" 58 | "sponseB\006\200\001\000\370\001\001b\006proto3" 59 | }; 60 | ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( 61 | descriptor, 182); 62 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( 63 | "prediction_service.proto", &protobuf_RegisterTypes); 64 | ::protobuf_predict_2eproto::AddDescriptors(); 65 | } 66 | 67 | void AddDescriptors() { 68 | static ::google::protobuf::internal::once_flag once; 69 | ::google::protobuf::internal::call_once(once, AddDescriptorsImpl); 70 | } 71 | // Force AddDescriptors() to be called at dynamic initialization time. 72 | struct StaticDescriptorInitializer { 73 | StaticDescriptorInitializer() { 74 | AddDescriptors(); 75 | } 76 | } static_descriptor_initializer; 77 | } // namespace protobuf_prediction_5fservice_2eproto 78 | namespace tensorflow { 79 | namespace serving { 80 | 81 | // @@protoc_insertion_point(namespace_scope) 82 | } // namespace serving 83 | } // namespace tensorflow 84 | namespace google { 85 | namespace protobuf { 86 | } // namespace protobuf 87 | } // namespace google 88 | 89 | // @@protoc_insertion_point(global_scope) 90 | -------------------------------------------------------------------------------- /src/generated/prediction_service.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: prediction_service.proto 3 | 4 | #ifndef PROTOBUF_INCLUDED_prediction_5fservice_2eproto 5 | #define PROTOBUF_INCLUDED_prediction_5fservice_2eproto 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 3006000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include // IWYU pragma: export 30 | #include // IWYU pragma: export 31 | #include "predict.pb.h" 32 | // @@protoc_insertion_point(includes) 33 | #define PROTOBUF_INTERNAL_EXPORT_protobuf_prediction_5fservice_2eproto 34 | 35 | namespace protobuf_prediction_5fservice_2eproto { 36 | // Internal implementation detail -- do not use these members. 37 | struct TableStruct { 38 | static const ::google::protobuf::internal::ParseTableField entries[]; 39 | static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; 40 | static const ::google::protobuf::internal::ParseTable schema[1]; 41 | static const ::google::protobuf::internal::FieldMetadata field_metadata[]; 42 | static const ::google::protobuf::internal::SerializationTable serialization_table[]; 43 | static const ::google::protobuf::uint32 offsets[]; 44 | }; 45 | void AddDescriptors(); 46 | } // namespace protobuf_prediction_5fservice_2eproto 47 | namespace tensorflow { 48 | namespace serving { 49 | } // namespace serving 50 | } // namespace tensorflow 51 | namespace tensorflow { 52 | namespace serving { 53 | 54 | // =================================================================== 55 | 56 | 57 | // =================================================================== 58 | 59 | 60 | // =================================================================== 61 | 62 | #ifdef __GNUC__ 63 | #pragma GCC diagnostic push 64 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 65 | #endif // __GNUC__ 66 | #ifdef __GNUC__ 67 | #pragma GCC diagnostic pop 68 | #endif // __GNUC__ 69 | 70 | // @@protoc_insertion_point(namespace_scope) 71 | 72 | } // namespace serving 73 | } // namespace tensorflow 74 | 75 | // @@protoc_insertion_point(global_scope) 76 | 77 | #endif // PROTOBUF_INCLUDED_prediction_5fservice_2eproto 78 | -------------------------------------------------------------------------------- /src/generated/resource_handle.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: resource_handle.proto 4 | 5 | #include "resource_handle.pb.h" 6 | #include "resource_handle.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | 18 | } // namespace tensorflow 19 | 20 | -------------------------------------------------------------------------------- /src/generated/resource_handle.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: resource_handle.proto 4 | #ifndef GRPC_resource_5fhandle_2eproto__INCLUDED 5 | #define GRPC_resource_5fhandle_2eproto__INCLUDED 6 | 7 | #include "resource_handle.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace grpc { 21 | class CompletionQueue; 22 | class Channel; 23 | class ServerCompletionQueue; 24 | class ServerContext; 25 | } // namespace grpc 26 | 27 | namespace tensorflow { 28 | 29 | } // namespace tensorflow 30 | 31 | 32 | #endif // GRPC_resource_5fhandle_2eproto__INCLUDED 33 | -------------------------------------------------------------------------------- /src/generated/resource_handle.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: resource_handle.proto 3 | 4 | #include "resource_handle.pb.h" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | // This is a temporary google only hack 17 | #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS 18 | #include "third_party/protobuf/version.h" 19 | #endif 20 | // @@protoc_insertion_point(includes) 21 | 22 | namespace tensorflow { 23 | class ResourceHandleProtoDefaultTypeInternal { 24 | public: 25 | ::google::protobuf::internal::ExplicitlyConstructed 26 | _instance; 27 | } _ResourceHandleProto_default_instance_; 28 | } // namespace tensorflow 29 | namespace protobuf_resource_5fhandle_2eproto { 30 | static void InitDefaultsResourceHandleProto() { 31 | GOOGLE_PROTOBUF_VERIFY_VERSION; 32 | 33 | { 34 | void* ptr = &::tensorflow::_ResourceHandleProto_default_instance_; 35 | new (ptr) ::tensorflow::ResourceHandleProto(); 36 | ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); 37 | } 38 | ::tensorflow::ResourceHandleProto::InitAsDefaultInstance(); 39 | } 40 | 41 | ::google::protobuf::internal::SCCInfo<0> scc_info_ResourceHandleProto = 42 | {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsResourceHandleProto}, {}}; 43 | 44 | void InitDefaults() { 45 | ::google::protobuf::internal::InitSCC(&scc_info_ResourceHandleProto.base); 46 | } 47 | 48 | ::google::protobuf::Metadata file_level_metadata[1]; 49 | 50 | const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 51 | ~0u, // no _has_bits_ 52 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::ResourceHandleProto, _internal_metadata_), 53 | ~0u, // no _extensions_ 54 | ~0u, // no _oneof_case_ 55 | ~0u, // no _weak_field_map_ 56 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::ResourceHandleProto, device_), 57 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::ResourceHandleProto, container_), 58 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::ResourceHandleProto, name_), 59 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::ResourceHandleProto, hash_code_), 60 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::ResourceHandleProto, maybe_type_name_), 61 | }; 62 | static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 63 | { 0, -1, sizeof(::tensorflow::ResourceHandleProto)}, 64 | }; 65 | 66 | static ::google::protobuf::Message const * const file_default_instances[] = { 67 | reinterpret_cast(&::tensorflow::_ResourceHandleProto_default_instance_), 68 | }; 69 | 70 | static void protobuf_AssignDescriptors() { 71 | AddDescriptors(); 72 | AssignDescriptors( 73 | "resource_handle.proto", schemas, file_default_instances, TableStruct::offsets, 74 | file_level_metadata, NULL, NULL); 75 | } 76 | 77 | static void protobuf_AssignDescriptorsOnce() { 78 | static ::google::protobuf::internal::once_flag once; 79 | ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); 80 | } 81 | 82 | void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; 83 | void protobuf_RegisterTypes(const ::std::string&) { 84 | protobuf_AssignDescriptorsOnce(); 85 | ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); 86 | } 87 | 88 | static void AddDescriptorsImpl() { 89 | InitDefaults(); 90 | static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 91 | "\n\025resource_handle.proto\022\ntensorflow\"r\n\023R" 92 | "esourceHandleProto\022\016\n\006device\030\001 \001(\t\022\021\n\tco" 93 | "ntainer\030\002 \001(\t\022\014\n\004name\030\003 \001(\t\022\021\n\thash_code" 94 | "\030\004 \001(\004\022\027\n\017maybe_type_name\030\005 \001(\tBn\n\030org.t" 95 | "ensorflow.frameworkB\016ResourceHandleP\001Z=g" 96 | "ithub.com/tensorflow/tensorflow/tensorfl" 97 | "ow/go/core/framework\370\001\001b\006proto3" 98 | }; 99 | ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( 100 | descriptor, 271); 101 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( 102 | "resource_handle.proto", &protobuf_RegisterTypes); 103 | } 104 | 105 | void AddDescriptors() { 106 | static ::google::protobuf::internal::once_flag once; 107 | ::google::protobuf::internal::call_once(once, AddDescriptorsImpl); 108 | } 109 | // Force AddDescriptors() to be called at dynamic initialization time. 110 | struct StaticDescriptorInitializer { 111 | StaticDescriptorInitializer() { 112 | AddDescriptors(); 113 | } 114 | } static_descriptor_initializer; 115 | } // namespace protobuf_resource_5fhandle_2eproto 116 | namespace tensorflow { 117 | 118 | // =================================================================== 119 | 120 | void ResourceHandleProto::InitAsDefaultInstance() { 121 | } 122 | #if !defined(_MSC_VER) || _MSC_VER >= 1900 123 | const int ResourceHandleProto::kDeviceFieldNumber; 124 | const int ResourceHandleProto::kContainerFieldNumber; 125 | const int ResourceHandleProto::kNameFieldNumber; 126 | const int ResourceHandleProto::kHashCodeFieldNumber; 127 | const int ResourceHandleProto::kMaybeTypeNameFieldNumber; 128 | #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 129 | 130 | ResourceHandleProto::ResourceHandleProto() 131 | : ::google::protobuf::Message(), _internal_metadata_(NULL) { 132 | ::google::protobuf::internal::InitSCC( 133 | &protobuf_resource_5fhandle_2eproto::scc_info_ResourceHandleProto.base); 134 | SharedCtor(); 135 | // @@protoc_insertion_point(constructor:tensorflow.ResourceHandleProto) 136 | } 137 | ResourceHandleProto::ResourceHandleProto(::google::protobuf::Arena* arena) 138 | : ::google::protobuf::Message(), 139 | _internal_metadata_(arena) { 140 | ::google::protobuf::internal::InitSCC(&protobuf_resource_5fhandle_2eproto::scc_info_ResourceHandleProto.base); 141 | SharedCtor(); 142 | RegisterArenaDtor(arena); 143 | // @@protoc_insertion_point(arena_constructor:tensorflow.ResourceHandleProto) 144 | } 145 | ResourceHandleProto::ResourceHandleProto(const ResourceHandleProto& from) 146 | : ::google::protobuf::Message(), 147 | _internal_metadata_(NULL) { 148 | _internal_metadata_.MergeFrom(from._internal_metadata_); 149 | device_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 150 | if (from.device().size() > 0) { 151 | device_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.device(), 152 | GetArenaNoVirtual()); 153 | } 154 | container_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 155 | if (from.container().size() > 0) { 156 | container_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.container(), 157 | GetArenaNoVirtual()); 158 | } 159 | name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 160 | if (from.name().size() > 0) { 161 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), 162 | GetArenaNoVirtual()); 163 | } 164 | maybe_type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 165 | if (from.maybe_type_name().size() > 0) { 166 | maybe_type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.maybe_type_name(), 167 | GetArenaNoVirtual()); 168 | } 169 | hash_code_ = from.hash_code_; 170 | // @@protoc_insertion_point(copy_constructor:tensorflow.ResourceHandleProto) 171 | } 172 | 173 | void ResourceHandleProto::SharedCtor() { 174 | device_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 175 | container_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 176 | name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 177 | maybe_type_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 178 | hash_code_ = GOOGLE_ULONGLONG(0); 179 | } 180 | 181 | ResourceHandleProto::~ResourceHandleProto() { 182 | // @@protoc_insertion_point(destructor:tensorflow.ResourceHandleProto) 183 | SharedDtor(); 184 | } 185 | 186 | void ResourceHandleProto::SharedDtor() { 187 | GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); 188 | device_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 189 | container_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 190 | name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 191 | maybe_type_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 192 | } 193 | 194 | void ResourceHandleProto::ArenaDtor(void* object) { 195 | ResourceHandleProto* _this = reinterpret_cast< ResourceHandleProto* >(object); 196 | (void)_this; 197 | } 198 | void ResourceHandleProto::RegisterArenaDtor(::google::protobuf::Arena*) { 199 | } 200 | void ResourceHandleProto::SetCachedSize(int size) const { 201 | _cached_size_.Set(size); 202 | } 203 | const ::google::protobuf::Descriptor* ResourceHandleProto::descriptor() { 204 | ::protobuf_resource_5fhandle_2eproto::protobuf_AssignDescriptorsOnce(); 205 | return ::protobuf_resource_5fhandle_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; 206 | } 207 | 208 | const ResourceHandleProto& ResourceHandleProto::default_instance() { 209 | ::google::protobuf::internal::InitSCC(&protobuf_resource_5fhandle_2eproto::scc_info_ResourceHandleProto.base); 210 | return *internal_default_instance(); 211 | } 212 | 213 | 214 | void ResourceHandleProto::Clear() { 215 | // @@protoc_insertion_point(message_clear_start:tensorflow.ResourceHandleProto) 216 | ::google::protobuf::uint32 cached_has_bits = 0; 217 | // Prevent compiler warnings about cached_has_bits being unused 218 | (void) cached_has_bits; 219 | 220 | device_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 221 | container_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 222 | name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 223 | maybe_type_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 224 | hash_code_ = GOOGLE_ULONGLONG(0); 225 | _internal_metadata_.Clear(); 226 | } 227 | 228 | bool ResourceHandleProto::MergePartialFromCodedStream( 229 | ::google::protobuf::io::CodedInputStream* input) { 230 | #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure 231 | ::google::protobuf::uint32 tag; 232 | // @@protoc_insertion_point(parse_start:tensorflow.ResourceHandleProto) 233 | for (;;) { 234 | ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); 235 | tag = p.first; 236 | if (!p.second) goto handle_unusual; 237 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { 238 | // string device = 1; 239 | case 1: { 240 | if (static_cast< ::google::protobuf::uint8>(tag) == 241 | static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { 242 | DO_(::google::protobuf::internal::WireFormatLite::ReadString( 243 | input, this->mutable_device())); 244 | DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 245 | this->device().data(), static_cast(this->device().length()), 246 | ::google::protobuf::internal::WireFormatLite::PARSE, 247 | "tensorflow.ResourceHandleProto.device")); 248 | } else { 249 | goto handle_unusual; 250 | } 251 | break; 252 | } 253 | 254 | // string container = 2; 255 | case 2: { 256 | if (static_cast< ::google::protobuf::uint8>(tag) == 257 | static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { 258 | DO_(::google::protobuf::internal::WireFormatLite::ReadString( 259 | input, this->mutable_container())); 260 | DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 261 | this->container().data(), static_cast(this->container().length()), 262 | ::google::protobuf::internal::WireFormatLite::PARSE, 263 | "tensorflow.ResourceHandleProto.container")); 264 | } else { 265 | goto handle_unusual; 266 | } 267 | break; 268 | } 269 | 270 | // string name = 3; 271 | case 3: { 272 | if (static_cast< ::google::protobuf::uint8>(tag) == 273 | static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { 274 | DO_(::google::protobuf::internal::WireFormatLite::ReadString( 275 | input, this->mutable_name())); 276 | DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 277 | this->name().data(), static_cast(this->name().length()), 278 | ::google::protobuf::internal::WireFormatLite::PARSE, 279 | "tensorflow.ResourceHandleProto.name")); 280 | } else { 281 | goto handle_unusual; 282 | } 283 | break; 284 | } 285 | 286 | // uint64 hash_code = 4; 287 | case 4: { 288 | if (static_cast< ::google::protobuf::uint8>(tag) == 289 | static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { 290 | 291 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 292 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( 293 | input, &hash_code_))); 294 | } else { 295 | goto handle_unusual; 296 | } 297 | break; 298 | } 299 | 300 | // string maybe_type_name = 5; 301 | case 5: { 302 | if (static_cast< ::google::protobuf::uint8>(tag) == 303 | static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { 304 | DO_(::google::protobuf::internal::WireFormatLite::ReadString( 305 | input, this->mutable_maybe_type_name())); 306 | DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 307 | this->maybe_type_name().data(), static_cast(this->maybe_type_name().length()), 308 | ::google::protobuf::internal::WireFormatLite::PARSE, 309 | "tensorflow.ResourceHandleProto.maybe_type_name")); 310 | } else { 311 | goto handle_unusual; 312 | } 313 | break; 314 | } 315 | 316 | default: { 317 | handle_unusual: 318 | if (tag == 0) { 319 | goto success; 320 | } 321 | DO_(::google::protobuf::internal::WireFormat::SkipField( 322 | input, tag, _internal_metadata_.mutable_unknown_fields())); 323 | break; 324 | } 325 | } 326 | } 327 | success: 328 | // @@protoc_insertion_point(parse_success:tensorflow.ResourceHandleProto) 329 | return true; 330 | failure: 331 | // @@protoc_insertion_point(parse_failure:tensorflow.ResourceHandleProto) 332 | return false; 333 | #undef DO_ 334 | } 335 | 336 | void ResourceHandleProto::SerializeWithCachedSizes( 337 | ::google::protobuf::io::CodedOutputStream* output) const { 338 | // @@protoc_insertion_point(serialize_start:tensorflow.ResourceHandleProto) 339 | ::google::protobuf::uint32 cached_has_bits = 0; 340 | (void) cached_has_bits; 341 | 342 | // string device = 1; 343 | if (this->device().size() > 0) { 344 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 345 | this->device().data(), static_cast(this->device().length()), 346 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 347 | "tensorflow.ResourceHandleProto.device"); 348 | ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 349 | 1, this->device(), output); 350 | } 351 | 352 | // string container = 2; 353 | if (this->container().size() > 0) { 354 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 355 | this->container().data(), static_cast(this->container().length()), 356 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 357 | "tensorflow.ResourceHandleProto.container"); 358 | ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 359 | 2, this->container(), output); 360 | } 361 | 362 | // string name = 3; 363 | if (this->name().size() > 0) { 364 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 365 | this->name().data(), static_cast(this->name().length()), 366 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 367 | "tensorflow.ResourceHandleProto.name"); 368 | ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 369 | 3, this->name(), output); 370 | } 371 | 372 | // uint64 hash_code = 4; 373 | if (this->hash_code() != 0) { 374 | ::google::protobuf::internal::WireFormatLite::WriteUInt64(4, this->hash_code(), output); 375 | } 376 | 377 | // string maybe_type_name = 5; 378 | if (this->maybe_type_name().size() > 0) { 379 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 380 | this->maybe_type_name().data(), static_cast(this->maybe_type_name().length()), 381 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 382 | "tensorflow.ResourceHandleProto.maybe_type_name"); 383 | ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 384 | 5, this->maybe_type_name(), output); 385 | } 386 | 387 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 388 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( 389 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); 390 | } 391 | // @@protoc_insertion_point(serialize_end:tensorflow.ResourceHandleProto) 392 | } 393 | 394 | ::google::protobuf::uint8* ResourceHandleProto::InternalSerializeWithCachedSizesToArray( 395 | bool deterministic, ::google::protobuf::uint8* target) const { 396 | (void)deterministic; // Unused 397 | // @@protoc_insertion_point(serialize_to_array_start:tensorflow.ResourceHandleProto) 398 | ::google::protobuf::uint32 cached_has_bits = 0; 399 | (void) cached_has_bits; 400 | 401 | // string device = 1; 402 | if (this->device().size() > 0) { 403 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 404 | this->device().data(), static_cast(this->device().length()), 405 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 406 | "tensorflow.ResourceHandleProto.device"); 407 | target = 408 | ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 409 | 1, this->device(), target); 410 | } 411 | 412 | // string container = 2; 413 | if (this->container().size() > 0) { 414 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 415 | this->container().data(), static_cast(this->container().length()), 416 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 417 | "tensorflow.ResourceHandleProto.container"); 418 | target = 419 | ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 420 | 2, this->container(), target); 421 | } 422 | 423 | // string name = 3; 424 | if (this->name().size() > 0) { 425 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 426 | this->name().data(), static_cast(this->name().length()), 427 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 428 | "tensorflow.ResourceHandleProto.name"); 429 | target = 430 | ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 431 | 3, this->name(), target); 432 | } 433 | 434 | // uint64 hash_code = 4; 435 | if (this->hash_code() != 0) { 436 | target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(4, this->hash_code(), target); 437 | } 438 | 439 | // string maybe_type_name = 5; 440 | if (this->maybe_type_name().size() > 0) { 441 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 442 | this->maybe_type_name().data(), static_cast(this->maybe_type_name().length()), 443 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 444 | "tensorflow.ResourceHandleProto.maybe_type_name"); 445 | target = 446 | ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 447 | 5, this->maybe_type_name(), target); 448 | } 449 | 450 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 451 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( 452 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); 453 | } 454 | // @@protoc_insertion_point(serialize_to_array_end:tensorflow.ResourceHandleProto) 455 | return target; 456 | } 457 | 458 | size_t ResourceHandleProto::ByteSizeLong() const { 459 | // @@protoc_insertion_point(message_byte_size_start:tensorflow.ResourceHandleProto) 460 | size_t total_size = 0; 461 | 462 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 463 | total_size += 464 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( 465 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); 466 | } 467 | // string device = 1; 468 | if (this->device().size() > 0) { 469 | total_size += 1 + 470 | ::google::protobuf::internal::WireFormatLite::StringSize( 471 | this->device()); 472 | } 473 | 474 | // string container = 2; 475 | if (this->container().size() > 0) { 476 | total_size += 1 + 477 | ::google::protobuf::internal::WireFormatLite::StringSize( 478 | this->container()); 479 | } 480 | 481 | // string name = 3; 482 | if (this->name().size() > 0) { 483 | total_size += 1 + 484 | ::google::protobuf::internal::WireFormatLite::StringSize( 485 | this->name()); 486 | } 487 | 488 | // string maybe_type_name = 5; 489 | if (this->maybe_type_name().size() > 0) { 490 | total_size += 1 + 491 | ::google::protobuf::internal::WireFormatLite::StringSize( 492 | this->maybe_type_name()); 493 | } 494 | 495 | // uint64 hash_code = 4; 496 | if (this->hash_code() != 0) { 497 | total_size += 1 + 498 | ::google::protobuf::internal::WireFormatLite::UInt64Size( 499 | this->hash_code()); 500 | } 501 | 502 | int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); 503 | SetCachedSize(cached_size); 504 | return total_size; 505 | } 506 | 507 | void ResourceHandleProto::MergeFrom(const ::google::protobuf::Message& from) { 508 | // @@protoc_insertion_point(generalized_merge_from_start:tensorflow.ResourceHandleProto) 509 | GOOGLE_DCHECK_NE(&from, this); 510 | const ResourceHandleProto* source = 511 | ::google::protobuf::internal::DynamicCastToGenerated( 512 | &from); 513 | if (source == NULL) { 514 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.ResourceHandleProto) 515 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); 516 | } else { 517 | // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.ResourceHandleProto) 518 | MergeFrom(*source); 519 | } 520 | } 521 | 522 | void ResourceHandleProto::MergeFrom(const ResourceHandleProto& from) { 523 | // @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.ResourceHandleProto) 524 | GOOGLE_DCHECK_NE(&from, this); 525 | _internal_metadata_.MergeFrom(from._internal_metadata_); 526 | ::google::protobuf::uint32 cached_has_bits = 0; 527 | (void) cached_has_bits; 528 | 529 | if (from.device().size() > 0) { 530 | set_device(from.device()); 531 | } 532 | if (from.container().size() > 0) { 533 | set_container(from.container()); 534 | } 535 | if (from.name().size() > 0) { 536 | set_name(from.name()); 537 | } 538 | if (from.maybe_type_name().size() > 0) { 539 | set_maybe_type_name(from.maybe_type_name()); 540 | } 541 | if (from.hash_code() != 0) { 542 | set_hash_code(from.hash_code()); 543 | } 544 | } 545 | 546 | void ResourceHandleProto::CopyFrom(const ::google::protobuf::Message& from) { 547 | // @@protoc_insertion_point(generalized_copy_from_start:tensorflow.ResourceHandleProto) 548 | if (&from == this) return; 549 | Clear(); 550 | MergeFrom(from); 551 | } 552 | 553 | void ResourceHandleProto::CopyFrom(const ResourceHandleProto& from) { 554 | // @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.ResourceHandleProto) 555 | if (&from == this) return; 556 | Clear(); 557 | MergeFrom(from); 558 | } 559 | 560 | bool ResourceHandleProto::IsInitialized() const { 561 | return true; 562 | } 563 | 564 | void ResourceHandleProto::Swap(ResourceHandleProto* other) { 565 | if (other == this) return; 566 | if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { 567 | InternalSwap(other); 568 | } else { 569 | ResourceHandleProto* temp = New(GetArenaNoVirtual()); 570 | temp->MergeFrom(*other); 571 | other->CopyFrom(*this); 572 | InternalSwap(temp); 573 | if (GetArenaNoVirtual() == NULL) { 574 | delete temp; 575 | } 576 | } 577 | } 578 | void ResourceHandleProto::UnsafeArenaSwap(ResourceHandleProto* other) { 579 | if (other == this) return; 580 | GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); 581 | InternalSwap(other); 582 | } 583 | void ResourceHandleProto::InternalSwap(ResourceHandleProto* other) { 584 | using std::swap; 585 | device_.Swap(&other->device_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), 586 | GetArenaNoVirtual()); 587 | container_.Swap(&other->container_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), 588 | GetArenaNoVirtual()); 589 | name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), 590 | GetArenaNoVirtual()); 591 | maybe_type_name_.Swap(&other->maybe_type_name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), 592 | GetArenaNoVirtual()); 593 | swap(hash_code_, other->hash_code_); 594 | _internal_metadata_.Swap(&other->_internal_metadata_); 595 | } 596 | 597 | ::google::protobuf::Metadata ResourceHandleProto::GetMetadata() const { 598 | protobuf_resource_5fhandle_2eproto::protobuf_AssignDescriptorsOnce(); 599 | return ::protobuf_resource_5fhandle_2eproto::file_level_metadata[kIndexInFileMessages]; 600 | } 601 | 602 | 603 | // @@protoc_insertion_point(namespace_scope) 604 | } // namespace tensorflow 605 | namespace google { 606 | namespace protobuf { 607 | template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::ResourceHandleProto* Arena::CreateMaybeMessage< ::tensorflow::ResourceHandleProto >(Arena* arena) { 608 | return Arena::CreateMessageInternal< ::tensorflow::ResourceHandleProto >(arena); 609 | } 610 | } // namespace protobuf 611 | } // namespace google 612 | 613 | // @@protoc_insertion_point(global_scope) 614 | -------------------------------------------------------------------------------- /src/generated/resource_handle.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: resource_handle.proto 3 | 4 | #ifndef PROTOBUF_INCLUDED_resource_5fhandle_2eproto 5 | #define PROTOBUF_INCLUDED_resource_5fhandle_2eproto 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 3006000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include // IWYU pragma: export 31 | #include // IWYU pragma: export 32 | #include 33 | // @@protoc_insertion_point(includes) 34 | #define PROTOBUF_INTERNAL_EXPORT_protobuf_resource_5fhandle_2eproto 35 | 36 | namespace protobuf_resource_5fhandle_2eproto { 37 | // Internal implementation detail -- do not use these members. 38 | struct TableStruct { 39 | static const ::google::protobuf::internal::ParseTableField entries[]; 40 | static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; 41 | static const ::google::protobuf::internal::ParseTable schema[1]; 42 | static const ::google::protobuf::internal::FieldMetadata field_metadata[]; 43 | static const ::google::protobuf::internal::SerializationTable serialization_table[]; 44 | static const ::google::protobuf::uint32 offsets[]; 45 | }; 46 | void AddDescriptors(); 47 | } // namespace protobuf_resource_5fhandle_2eproto 48 | namespace tensorflow { 49 | class ResourceHandleProto; 50 | class ResourceHandleProtoDefaultTypeInternal; 51 | extern ResourceHandleProtoDefaultTypeInternal _ResourceHandleProto_default_instance_; 52 | } // namespace tensorflow 53 | namespace google { 54 | namespace protobuf { 55 | template<> ::tensorflow::ResourceHandleProto* Arena::CreateMaybeMessage<::tensorflow::ResourceHandleProto>(Arena*); 56 | } // namespace protobuf 57 | } // namespace google 58 | namespace tensorflow { 59 | 60 | // =================================================================== 61 | 62 | class ResourceHandleProto : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.ResourceHandleProto) */ { 63 | public: 64 | ResourceHandleProto(); 65 | virtual ~ResourceHandleProto(); 66 | 67 | ResourceHandleProto(const ResourceHandleProto& from); 68 | 69 | inline ResourceHandleProto& operator=(const ResourceHandleProto& from) { 70 | CopyFrom(from); 71 | return *this; 72 | } 73 | #if LANG_CXX11 74 | ResourceHandleProto(ResourceHandleProto&& from) noexcept 75 | : ResourceHandleProto() { 76 | *this = ::std::move(from); 77 | } 78 | 79 | inline ResourceHandleProto& operator=(ResourceHandleProto&& from) noexcept { 80 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 81 | if (this != &from) InternalSwap(&from); 82 | } else { 83 | CopyFrom(from); 84 | } 85 | return *this; 86 | } 87 | #endif 88 | inline ::google::protobuf::Arena* GetArena() const final { 89 | return GetArenaNoVirtual(); 90 | } 91 | inline void* GetMaybeArenaPointer() const final { 92 | return MaybeArenaPtr(); 93 | } 94 | static const ::google::protobuf::Descriptor* descriptor(); 95 | static const ResourceHandleProto& default_instance(); 96 | 97 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 98 | static inline const ResourceHandleProto* internal_default_instance() { 99 | return reinterpret_cast( 100 | &_ResourceHandleProto_default_instance_); 101 | } 102 | static constexpr int kIndexInFileMessages = 103 | 0; 104 | 105 | void UnsafeArenaSwap(ResourceHandleProto* other); 106 | void Swap(ResourceHandleProto* other); 107 | friend void swap(ResourceHandleProto& a, ResourceHandleProto& b) { 108 | a.Swap(&b); 109 | } 110 | 111 | // implements Message ---------------------------------------------- 112 | 113 | inline ResourceHandleProto* New() const final { 114 | return CreateMaybeMessage(NULL); 115 | } 116 | 117 | ResourceHandleProto* New(::google::protobuf::Arena* arena) const final { 118 | return CreateMaybeMessage(arena); 119 | } 120 | void CopyFrom(const ::google::protobuf::Message& from) final; 121 | void MergeFrom(const ::google::protobuf::Message& from) final; 122 | void CopyFrom(const ResourceHandleProto& from); 123 | void MergeFrom(const ResourceHandleProto& from); 124 | void Clear() final; 125 | bool IsInitialized() const final; 126 | 127 | size_t ByteSizeLong() const final; 128 | bool MergePartialFromCodedStream( 129 | ::google::protobuf::io::CodedInputStream* input) final; 130 | void SerializeWithCachedSizes( 131 | ::google::protobuf::io::CodedOutputStream* output) const final; 132 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 133 | bool deterministic, ::google::protobuf::uint8* target) const final; 134 | int GetCachedSize() const final { return _cached_size_.Get(); } 135 | 136 | private: 137 | void SharedCtor(); 138 | void SharedDtor(); 139 | void SetCachedSize(int size) const final; 140 | void InternalSwap(ResourceHandleProto* other); 141 | protected: 142 | explicit ResourceHandleProto(::google::protobuf::Arena* arena); 143 | private: 144 | static void ArenaDtor(void* object); 145 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 146 | private: 147 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 148 | return _internal_metadata_.arena(); 149 | } 150 | inline void* MaybeArenaPtr() const { 151 | return _internal_metadata_.raw_arena_ptr(); 152 | } 153 | public: 154 | 155 | ::google::protobuf::Metadata GetMetadata() const final; 156 | 157 | // nested types ---------------------------------------------------- 158 | 159 | // accessors ------------------------------------------------------- 160 | 161 | // string device = 1; 162 | void clear_device(); 163 | static const int kDeviceFieldNumber = 1; 164 | const ::std::string& device() const; 165 | void set_device(const ::std::string& value); 166 | #if LANG_CXX11 167 | void set_device(::std::string&& value); 168 | #endif 169 | void set_device(const char* value); 170 | void set_device(const char* value, size_t size); 171 | ::std::string* mutable_device(); 172 | ::std::string* release_device(); 173 | void set_allocated_device(::std::string* device); 174 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 175 | " string fields are deprecated and will be removed in a" 176 | " future release.") 177 | ::std::string* unsafe_arena_release_device(); 178 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 179 | " string fields are deprecated and will be removed in a" 180 | " future release.") 181 | void unsafe_arena_set_allocated_device( 182 | ::std::string* device); 183 | 184 | // string container = 2; 185 | void clear_container(); 186 | static const int kContainerFieldNumber = 2; 187 | const ::std::string& container() const; 188 | void set_container(const ::std::string& value); 189 | #if LANG_CXX11 190 | void set_container(::std::string&& value); 191 | #endif 192 | void set_container(const char* value); 193 | void set_container(const char* value, size_t size); 194 | ::std::string* mutable_container(); 195 | ::std::string* release_container(); 196 | void set_allocated_container(::std::string* container); 197 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 198 | " string fields are deprecated and will be removed in a" 199 | " future release.") 200 | ::std::string* unsafe_arena_release_container(); 201 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 202 | " string fields are deprecated and will be removed in a" 203 | " future release.") 204 | void unsafe_arena_set_allocated_container( 205 | ::std::string* container); 206 | 207 | // string name = 3; 208 | void clear_name(); 209 | static const int kNameFieldNumber = 3; 210 | const ::std::string& name() const; 211 | void set_name(const ::std::string& value); 212 | #if LANG_CXX11 213 | void set_name(::std::string&& value); 214 | #endif 215 | void set_name(const char* value); 216 | void set_name(const char* value, size_t size); 217 | ::std::string* mutable_name(); 218 | ::std::string* release_name(); 219 | void set_allocated_name(::std::string* name); 220 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 221 | " string fields are deprecated and will be removed in a" 222 | " future release.") 223 | ::std::string* unsafe_arena_release_name(); 224 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 225 | " string fields are deprecated and will be removed in a" 226 | " future release.") 227 | void unsafe_arena_set_allocated_name( 228 | ::std::string* name); 229 | 230 | // string maybe_type_name = 5; 231 | void clear_maybe_type_name(); 232 | static const int kMaybeTypeNameFieldNumber = 5; 233 | const ::std::string& maybe_type_name() const; 234 | void set_maybe_type_name(const ::std::string& value); 235 | #if LANG_CXX11 236 | void set_maybe_type_name(::std::string&& value); 237 | #endif 238 | void set_maybe_type_name(const char* value); 239 | void set_maybe_type_name(const char* value, size_t size); 240 | ::std::string* mutable_maybe_type_name(); 241 | ::std::string* release_maybe_type_name(); 242 | void set_allocated_maybe_type_name(::std::string* maybe_type_name); 243 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 244 | " string fields are deprecated and will be removed in a" 245 | " future release.") 246 | ::std::string* unsafe_arena_release_maybe_type_name(); 247 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 248 | " string fields are deprecated and will be removed in a" 249 | " future release.") 250 | void unsafe_arena_set_allocated_maybe_type_name( 251 | ::std::string* maybe_type_name); 252 | 253 | // uint64 hash_code = 4; 254 | void clear_hash_code(); 255 | static const int kHashCodeFieldNumber = 4; 256 | ::google::protobuf::uint64 hash_code() const; 257 | void set_hash_code(::google::protobuf::uint64 value); 258 | 259 | // @@protoc_insertion_point(class_scope:tensorflow.ResourceHandleProto) 260 | private: 261 | 262 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 263 | template friend class ::google::protobuf::Arena::InternalHelper; 264 | typedef void InternalArenaConstructable_; 265 | typedef void DestructorSkippable_; 266 | ::google::protobuf::internal::ArenaStringPtr device_; 267 | ::google::protobuf::internal::ArenaStringPtr container_; 268 | ::google::protobuf::internal::ArenaStringPtr name_; 269 | ::google::protobuf::internal::ArenaStringPtr maybe_type_name_; 270 | ::google::protobuf::uint64 hash_code_; 271 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 272 | friend struct ::protobuf_resource_5fhandle_2eproto::TableStruct; 273 | }; 274 | // =================================================================== 275 | 276 | 277 | // =================================================================== 278 | 279 | #ifdef __GNUC__ 280 | #pragma GCC diagnostic push 281 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 282 | #endif // __GNUC__ 283 | // ResourceHandleProto 284 | 285 | // string device = 1; 286 | inline void ResourceHandleProto::clear_device() { 287 | device_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 288 | } 289 | inline const ::std::string& ResourceHandleProto::device() const { 290 | // @@protoc_insertion_point(field_get:tensorflow.ResourceHandleProto.device) 291 | return device_.Get(); 292 | } 293 | inline void ResourceHandleProto::set_device(const ::std::string& value) { 294 | 295 | device_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 296 | // @@protoc_insertion_point(field_set:tensorflow.ResourceHandleProto.device) 297 | } 298 | #if LANG_CXX11 299 | inline void ResourceHandleProto::set_device(::std::string&& value) { 300 | 301 | device_.Set( 302 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 303 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.ResourceHandleProto.device) 304 | } 305 | #endif 306 | inline void ResourceHandleProto::set_device(const char* value) { 307 | GOOGLE_DCHECK(value != NULL); 308 | 309 | device_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 310 | GetArenaNoVirtual()); 311 | // @@protoc_insertion_point(field_set_char:tensorflow.ResourceHandleProto.device) 312 | } 313 | inline void ResourceHandleProto::set_device(const char* value, 314 | size_t size) { 315 | 316 | device_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 317 | reinterpret_cast(value), size), GetArenaNoVirtual()); 318 | // @@protoc_insertion_point(field_set_pointer:tensorflow.ResourceHandleProto.device) 319 | } 320 | inline ::std::string* ResourceHandleProto::mutable_device() { 321 | 322 | // @@protoc_insertion_point(field_mutable:tensorflow.ResourceHandleProto.device) 323 | return device_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 324 | } 325 | inline ::std::string* ResourceHandleProto::release_device() { 326 | // @@protoc_insertion_point(field_release:tensorflow.ResourceHandleProto.device) 327 | 328 | return device_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 329 | } 330 | inline void ResourceHandleProto::set_allocated_device(::std::string* device) { 331 | if (device != NULL) { 332 | 333 | } else { 334 | 335 | } 336 | device_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), device, 337 | GetArenaNoVirtual()); 338 | // @@protoc_insertion_point(field_set_allocated:tensorflow.ResourceHandleProto.device) 339 | } 340 | inline ::std::string* ResourceHandleProto::unsafe_arena_release_device() { 341 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.ResourceHandleProto.device) 342 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 343 | 344 | return device_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 345 | GetArenaNoVirtual()); 346 | } 347 | inline void ResourceHandleProto::unsafe_arena_set_allocated_device( 348 | ::std::string* device) { 349 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 350 | if (device != NULL) { 351 | 352 | } else { 353 | 354 | } 355 | device_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 356 | device, GetArenaNoVirtual()); 357 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.ResourceHandleProto.device) 358 | } 359 | 360 | // string container = 2; 361 | inline void ResourceHandleProto::clear_container() { 362 | container_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 363 | } 364 | inline const ::std::string& ResourceHandleProto::container() const { 365 | // @@protoc_insertion_point(field_get:tensorflow.ResourceHandleProto.container) 366 | return container_.Get(); 367 | } 368 | inline void ResourceHandleProto::set_container(const ::std::string& value) { 369 | 370 | container_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 371 | // @@protoc_insertion_point(field_set:tensorflow.ResourceHandleProto.container) 372 | } 373 | #if LANG_CXX11 374 | inline void ResourceHandleProto::set_container(::std::string&& value) { 375 | 376 | container_.Set( 377 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 378 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.ResourceHandleProto.container) 379 | } 380 | #endif 381 | inline void ResourceHandleProto::set_container(const char* value) { 382 | GOOGLE_DCHECK(value != NULL); 383 | 384 | container_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 385 | GetArenaNoVirtual()); 386 | // @@protoc_insertion_point(field_set_char:tensorflow.ResourceHandleProto.container) 387 | } 388 | inline void ResourceHandleProto::set_container(const char* value, 389 | size_t size) { 390 | 391 | container_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 392 | reinterpret_cast(value), size), GetArenaNoVirtual()); 393 | // @@protoc_insertion_point(field_set_pointer:tensorflow.ResourceHandleProto.container) 394 | } 395 | inline ::std::string* ResourceHandleProto::mutable_container() { 396 | 397 | // @@protoc_insertion_point(field_mutable:tensorflow.ResourceHandleProto.container) 398 | return container_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 399 | } 400 | inline ::std::string* ResourceHandleProto::release_container() { 401 | // @@protoc_insertion_point(field_release:tensorflow.ResourceHandleProto.container) 402 | 403 | return container_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 404 | } 405 | inline void ResourceHandleProto::set_allocated_container(::std::string* container) { 406 | if (container != NULL) { 407 | 408 | } else { 409 | 410 | } 411 | container_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), container, 412 | GetArenaNoVirtual()); 413 | // @@protoc_insertion_point(field_set_allocated:tensorflow.ResourceHandleProto.container) 414 | } 415 | inline ::std::string* ResourceHandleProto::unsafe_arena_release_container() { 416 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.ResourceHandleProto.container) 417 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 418 | 419 | return container_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 420 | GetArenaNoVirtual()); 421 | } 422 | inline void ResourceHandleProto::unsafe_arena_set_allocated_container( 423 | ::std::string* container) { 424 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 425 | if (container != NULL) { 426 | 427 | } else { 428 | 429 | } 430 | container_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 431 | container, GetArenaNoVirtual()); 432 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.ResourceHandleProto.container) 433 | } 434 | 435 | // string name = 3; 436 | inline void ResourceHandleProto::clear_name() { 437 | name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 438 | } 439 | inline const ::std::string& ResourceHandleProto::name() const { 440 | // @@protoc_insertion_point(field_get:tensorflow.ResourceHandleProto.name) 441 | return name_.Get(); 442 | } 443 | inline void ResourceHandleProto::set_name(const ::std::string& value) { 444 | 445 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 446 | // @@protoc_insertion_point(field_set:tensorflow.ResourceHandleProto.name) 447 | } 448 | #if LANG_CXX11 449 | inline void ResourceHandleProto::set_name(::std::string&& value) { 450 | 451 | name_.Set( 452 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 453 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.ResourceHandleProto.name) 454 | } 455 | #endif 456 | inline void ResourceHandleProto::set_name(const char* value) { 457 | GOOGLE_DCHECK(value != NULL); 458 | 459 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 460 | GetArenaNoVirtual()); 461 | // @@protoc_insertion_point(field_set_char:tensorflow.ResourceHandleProto.name) 462 | } 463 | inline void ResourceHandleProto::set_name(const char* value, 464 | size_t size) { 465 | 466 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 467 | reinterpret_cast(value), size), GetArenaNoVirtual()); 468 | // @@protoc_insertion_point(field_set_pointer:tensorflow.ResourceHandleProto.name) 469 | } 470 | inline ::std::string* ResourceHandleProto::mutable_name() { 471 | 472 | // @@protoc_insertion_point(field_mutable:tensorflow.ResourceHandleProto.name) 473 | return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 474 | } 475 | inline ::std::string* ResourceHandleProto::release_name() { 476 | // @@protoc_insertion_point(field_release:tensorflow.ResourceHandleProto.name) 477 | 478 | return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 479 | } 480 | inline void ResourceHandleProto::set_allocated_name(::std::string* name) { 481 | if (name != NULL) { 482 | 483 | } else { 484 | 485 | } 486 | name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, 487 | GetArenaNoVirtual()); 488 | // @@protoc_insertion_point(field_set_allocated:tensorflow.ResourceHandleProto.name) 489 | } 490 | inline ::std::string* ResourceHandleProto::unsafe_arena_release_name() { 491 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.ResourceHandleProto.name) 492 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 493 | 494 | return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 495 | GetArenaNoVirtual()); 496 | } 497 | inline void ResourceHandleProto::unsafe_arena_set_allocated_name( 498 | ::std::string* name) { 499 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 500 | if (name != NULL) { 501 | 502 | } else { 503 | 504 | } 505 | name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 506 | name, GetArenaNoVirtual()); 507 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.ResourceHandleProto.name) 508 | } 509 | 510 | // uint64 hash_code = 4; 511 | inline void ResourceHandleProto::clear_hash_code() { 512 | hash_code_ = GOOGLE_ULONGLONG(0); 513 | } 514 | inline ::google::protobuf::uint64 ResourceHandleProto::hash_code() const { 515 | // @@protoc_insertion_point(field_get:tensorflow.ResourceHandleProto.hash_code) 516 | return hash_code_; 517 | } 518 | inline void ResourceHandleProto::set_hash_code(::google::protobuf::uint64 value) { 519 | 520 | hash_code_ = value; 521 | // @@protoc_insertion_point(field_set:tensorflow.ResourceHandleProto.hash_code) 522 | } 523 | 524 | // string maybe_type_name = 5; 525 | inline void ResourceHandleProto::clear_maybe_type_name() { 526 | maybe_type_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 527 | } 528 | inline const ::std::string& ResourceHandleProto::maybe_type_name() const { 529 | // @@protoc_insertion_point(field_get:tensorflow.ResourceHandleProto.maybe_type_name) 530 | return maybe_type_name_.Get(); 531 | } 532 | inline void ResourceHandleProto::set_maybe_type_name(const ::std::string& value) { 533 | 534 | maybe_type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 535 | // @@protoc_insertion_point(field_set:tensorflow.ResourceHandleProto.maybe_type_name) 536 | } 537 | #if LANG_CXX11 538 | inline void ResourceHandleProto::set_maybe_type_name(::std::string&& value) { 539 | 540 | maybe_type_name_.Set( 541 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 542 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.ResourceHandleProto.maybe_type_name) 543 | } 544 | #endif 545 | inline void ResourceHandleProto::set_maybe_type_name(const char* value) { 546 | GOOGLE_DCHECK(value != NULL); 547 | 548 | maybe_type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 549 | GetArenaNoVirtual()); 550 | // @@protoc_insertion_point(field_set_char:tensorflow.ResourceHandleProto.maybe_type_name) 551 | } 552 | inline void ResourceHandleProto::set_maybe_type_name(const char* value, 553 | size_t size) { 554 | 555 | maybe_type_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 556 | reinterpret_cast(value), size), GetArenaNoVirtual()); 557 | // @@protoc_insertion_point(field_set_pointer:tensorflow.ResourceHandleProto.maybe_type_name) 558 | } 559 | inline ::std::string* ResourceHandleProto::mutable_maybe_type_name() { 560 | 561 | // @@protoc_insertion_point(field_mutable:tensorflow.ResourceHandleProto.maybe_type_name) 562 | return maybe_type_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 563 | } 564 | inline ::std::string* ResourceHandleProto::release_maybe_type_name() { 565 | // @@protoc_insertion_point(field_release:tensorflow.ResourceHandleProto.maybe_type_name) 566 | 567 | return maybe_type_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 568 | } 569 | inline void ResourceHandleProto::set_allocated_maybe_type_name(::std::string* maybe_type_name) { 570 | if (maybe_type_name != NULL) { 571 | 572 | } else { 573 | 574 | } 575 | maybe_type_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), maybe_type_name, 576 | GetArenaNoVirtual()); 577 | // @@protoc_insertion_point(field_set_allocated:tensorflow.ResourceHandleProto.maybe_type_name) 578 | } 579 | inline ::std::string* ResourceHandleProto::unsafe_arena_release_maybe_type_name() { 580 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.ResourceHandleProto.maybe_type_name) 581 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 582 | 583 | return maybe_type_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 584 | GetArenaNoVirtual()); 585 | } 586 | inline void ResourceHandleProto::unsafe_arena_set_allocated_maybe_type_name( 587 | ::std::string* maybe_type_name) { 588 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 589 | if (maybe_type_name != NULL) { 590 | 591 | } else { 592 | 593 | } 594 | maybe_type_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 595 | maybe_type_name, GetArenaNoVirtual()); 596 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.ResourceHandleProto.maybe_type_name) 597 | } 598 | 599 | #ifdef __GNUC__ 600 | #pragma GCC diagnostic pop 601 | #endif // __GNUC__ 602 | 603 | // @@protoc_insertion_point(namespace_scope) 604 | 605 | } // namespace tensorflow 606 | 607 | // @@protoc_insertion_point(global_scope) 608 | 609 | #endif // PROTOBUF_INCLUDED_resource_5fhandle_2eproto 610 | -------------------------------------------------------------------------------- /src/generated/tensor.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: tensor.proto 4 | 5 | #include "tensor.pb.h" 6 | #include "tensor.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | 18 | } // namespace tensorflow 19 | 20 | -------------------------------------------------------------------------------- /src/generated/tensor.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: tensor.proto 4 | #ifndef GRPC_tensor_2eproto__INCLUDED 5 | #define GRPC_tensor_2eproto__INCLUDED 6 | 7 | #include "tensor.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace grpc { 21 | class CompletionQueue; 22 | class Channel; 23 | class ServerCompletionQueue; 24 | class ServerContext; 25 | } // namespace grpc 26 | 27 | namespace tensorflow { 28 | 29 | } // namespace tensorflow 30 | 31 | 32 | #endif // GRPC_tensor_2eproto__INCLUDED 33 | -------------------------------------------------------------------------------- /src/generated/tensor_shape.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: tensor_shape.proto 4 | 5 | #include "tensor_shape.pb.h" 6 | #include "tensor_shape.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | 18 | } // namespace tensorflow 19 | 20 | -------------------------------------------------------------------------------- /src/generated/tensor_shape.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: tensor_shape.proto 4 | // Original file comments: 5 | // Protocol buffer representing the shape of tensors. 6 | // 7 | #ifndef GRPC_tensor_5fshape_2eproto__INCLUDED 8 | #define GRPC_tensor_5fshape_2eproto__INCLUDED 9 | 10 | #include "tensor_shape.pb.h" 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | namespace grpc { 24 | class CompletionQueue; 25 | class Channel; 26 | class ServerCompletionQueue; 27 | class ServerContext; 28 | } // namespace grpc 29 | 30 | namespace tensorflow { 31 | 32 | } // namespace tensorflow 33 | 34 | 35 | #endif // GRPC_tensor_5fshape_2eproto__INCLUDED 36 | -------------------------------------------------------------------------------- /src/generated/tensor_shape.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: tensor_shape.proto 3 | 4 | #include "tensor_shape.pb.h" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | // This is a temporary google only hack 17 | #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS 18 | #include "third_party/protobuf/version.h" 19 | #endif 20 | // @@protoc_insertion_point(includes) 21 | 22 | namespace protobuf_tensor_5fshape_2eproto { 23 | extern PROTOBUF_INTERNAL_EXPORT_protobuf_tensor_5fshape_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TensorShapeProto_Dim; 24 | } // namespace protobuf_tensor_5fshape_2eproto 25 | namespace tensorflow { 26 | class TensorShapeProto_DimDefaultTypeInternal { 27 | public: 28 | ::google::protobuf::internal::ExplicitlyConstructed 29 | _instance; 30 | } _TensorShapeProto_Dim_default_instance_; 31 | class TensorShapeProtoDefaultTypeInternal { 32 | public: 33 | ::google::protobuf::internal::ExplicitlyConstructed 34 | _instance; 35 | } _TensorShapeProto_default_instance_; 36 | } // namespace tensorflow 37 | namespace protobuf_tensor_5fshape_2eproto { 38 | static void InitDefaultsTensorShapeProto_Dim() { 39 | GOOGLE_PROTOBUF_VERIFY_VERSION; 40 | 41 | { 42 | void* ptr = &::tensorflow::_TensorShapeProto_Dim_default_instance_; 43 | new (ptr) ::tensorflow::TensorShapeProto_Dim(); 44 | ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); 45 | } 46 | ::tensorflow::TensorShapeProto_Dim::InitAsDefaultInstance(); 47 | } 48 | 49 | ::google::protobuf::internal::SCCInfo<0> scc_info_TensorShapeProto_Dim = 50 | {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTensorShapeProto_Dim}, {}}; 51 | 52 | static void InitDefaultsTensorShapeProto() { 53 | GOOGLE_PROTOBUF_VERIFY_VERSION; 54 | 55 | { 56 | void* ptr = &::tensorflow::_TensorShapeProto_default_instance_; 57 | new (ptr) ::tensorflow::TensorShapeProto(); 58 | ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); 59 | } 60 | ::tensorflow::TensorShapeProto::InitAsDefaultInstance(); 61 | } 62 | 63 | ::google::protobuf::internal::SCCInfo<1> scc_info_TensorShapeProto = 64 | {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTensorShapeProto}, { 65 | &protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto_Dim.base,}}; 66 | 67 | void InitDefaults() { 68 | ::google::protobuf::internal::InitSCC(&scc_info_TensorShapeProto_Dim.base); 69 | ::google::protobuf::internal::InitSCC(&scc_info_TensorShapeProto.base); 70 | } 71 | 72 | ::google::protobuf::Metadata file_level_metadata[2]; 73 | 74 | const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 75 | ~0u, // no _has_bits_ 76 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::TensorShapeProto_Dim, _internal_metadata_), 77 | ~0u, // no _extensions_ 78 | ~0u, // no _oneof_case_ 79 | ~0u, // no _weak_field_map_ 80 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::TensorShapeProto_Dim, size_), 81 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::TensorShapeProto_Dim, name_), 82 | ~0u, // no _has_bits_ 83 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::TensorShapeProto, _internal_metadata_), 84 | ~0u, // no _extensions_ 85 | ~0u, // no _oneof_case_ 86 | ~0u, // no _weak_field_map_ 87 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::TensorShapeProto, dim_), 88 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tensorflow::TensorShapeProto, unknown_rank_), 89 | }; 90 | static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 91 | { 0, -1, sizeof(::tensorflow::TensorShapeProto_Dim)}, 92 | { 7, -1, sizeof(::tensorflow::TensorShapeProto)}, 93 | }; 94 | 95 | static ::google::protobuf::Message const * const file_default_instances[] = { 96 | reinterpret_cast(&::tensorflow::_TensorShapeProto_Dim_default_instance_), 97 | reinterpret_cast(&::tensorflow::_TensorShapeProto_default_instance_), 98 | }; 99 | 100 | static void protobuf_AssignDescriptors() { 101 | AddDescriptors(); 102 | AssignDescriptors( 103 | "tensor_shape.proto", schemas, file_default_instances, TableStruct::offsets, 104 | file_level_metadata, NULL, NULL); 105 | } 106 | 107 | static void protobuf_AssignDescriptorsOnce() { 108 | static ::google::protobuf::internal::once_flag once; 109 | ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); 110 | } 111 | 112 | void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; 113 | void protobuf_RegisterTypes(const ::std::string&) { 114 | protobuf_AssignDescriptorsOnce(); 115 | ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2); 116 | } 117 | 118 | static void AddDescriptorsImpl() { 119 | InitDefaults(); 120 | static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 121 | "\n\022tensor_shape.proto\022\ntensorflow\"z\n\020Tens" 122 | "orShapeProto\022-\n\003dim\030\002 \003(\0132 .tensorflow.T" 123 | "ensorShapeProto.Dim\022\024\n\014unknown_rank\030\003 \001(" 124 | "\010\032!\n\003Dim\022\014\n\004size\030\001 \001(\003\022\014\n\004name\030\002 \001(\tBq\n\030" 125 | "org.tensorflow.frameworkB\021TensorShapePro" 126 | "tosP\001Z=github.com/tensorflow/tensorflow/" 127 | "tensorflow/go/core/framework\370\001\001b\006proto3" 128 | }; 129 | ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( 130 | descriptor, 279); 131 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( 132 | "tensor_shape.proto", &protobuf_RegisterTypes); 133 | } 134 | 135 | void AddDescriptors() { 136 | static ::google::protobuf::internal::once_flag once; 137 | ::google::protobuf::internal::call_once(once, AddDescriptorsImpl); 138 | } 139 | // Force AddDescriptors() to be called at dynamic initialization time. 140 | struct StaticDescriptorInitializer { 141 | StaticDescriptorInitializer() { 142 | AddDescriptors(); 143 | } 144 | } static_descriptor_initializer; 145 | } // namespace protobuf_tensor_5fshape_2eproto 146 | namespace tensorflow { 147 | 148 | // =================================================================== 149 | 150 | void TensorShapeProto_Dim::InitAsDefaultInstance() { 151 | } 152 | #if !defined(_MSC_VER) || _MSC_VER >= 1900 153 | const int TensorShapeProto_Dim::kSizeFieldNumber; 154 | const int TensorShapeProto_Dim::kNameFieldNumber; 155 | #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 156 | 157 | TensorShapeProto_Dim::TensorShapeProto_Dim() 158 | : ::google::protobuf::Message(), _internal_metadata_(NULL) { 159 | ::google::protobuf::internal::InitSCC( 160 | &protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto_Dim.base); 161 | SharedCtor(); 162 | // @@protoc_insertion_point(constructor:tensorflow.TensorShapeProto.Dim) 163 | } 164 | TensorShapeProto_Dim::TensorShapeProto_Dim(::google::protobuf::Arena* arena) 165 | : ::google::protobuf::Message(), 166 | _internal_metadata_(arena) { 167 | ::google::protobuf::internal::InitSCC(&protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto_Dim.base); 168 | SharedCtor(); 169 | RegisterArenaDtor(arena); 170 | // @@protoc_insertion_point(arena_constructor:tensorflow.TensorShapeProto.Dim) 171 | } 172 | TensorShapeProto_Dim::TensorShapeProto_Dim(const TensorShapeProto_Dim& from) 173 | : ::google::protobuf::Message(), 174 | _internal_metadata_(NULL) { 175 | _internal_metadata_.MergeFrom(from._internal_metadata_); 176 | name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 177 | if (from.name().size() > 0) { 178 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name(), 179 | GetArenaNoVirtual()); 180 | } 181 | size_ = from.size_; 182 | // @@protoc_insertion_point(copy_constructor:tensorflow.TensorShapeProto.Dim) 183 | } 184 | 185 | void TensorShapeProto_Dim::SharedCtor() { 186 | name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 187 | size_ = GOOGLE_LONGLONG(0); 188 | } 189 | 190 | TensorShapeProto_Dim::~TensorShapeProto_Dim() { 191 | // @@protoc_insertion_point(destructor:tensorflow.TensorShapeProto.Dim) 192 | SharedDtor(); 193 | } 194 | 195 | void TensorShapeProto_Dim::SharedDtor() { 196 | GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); 197 | name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); 198 | } 199 | 200 | void TensorShapeProto_Dim::ArenaDtor(void* object) { 201 | TensorShapeProto_Dim* _this = reinterpret_cast< TensorShapeProto_Dim* >(object); 202 | (void)_this; 203 | } 204 | void TensorShapeProto_Dim::RegisterArenaDtor(::google::protobuf::Arena*) { 205 | } 206 | void TensorShapeProto_Dim::SetCachedSize(int size) const { 207 | _cached_size_.Set(size); 208 | } 209 | const ::google::protobuf::Descriptor* TensorShapeProto_Dim::descriptor() { 210 | ::protobuf_tensor_5fshape_2eproto::protobuf_AssignDescriptorsOnce(); 211 | return ::protobuf_tensor_5fshape_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; 212 | } 213 | 214 | const TensorShapeProto_Dim& TensorShapeProto_Dim::default_instance() { 215 | ::google::protobuf::internal::InitSCC(&protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto_Dim.base); 216 | return *internal_default_instance(); 217 | } 218 | 219 | 220 | void TensorShapeProto_Dim::Clear() { 221 | // @@protoc_insertion_point(message_clear_start:tensorflow.TensorShapeProto.Dim) 222 | ::google::protobuf::uint32 cached_has_bits = 0; 223 | // Prevent compiler warnings about cached_has_bits being unused 224 | (void) cached_has_bits; 225 | 226 | name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 227 | size_ = GOOGLE_LONGLONG(0); 228 | _internal_metadata_.Clear(); 229 | } 230 | 231 | bool TensorShapeProto_Dim::MergePartialFromCodedStream( 232 | ::google::protobuf::io::CodedInputStream* input) { 233 | #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure 234 | ::google::protobuf::uint32 tag; 235 | // @@protoc_insertion_point(parse_start:tensorflow.TensorShapeProto.Dim) 236 | for (;;) { 237 | ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); 238 | tag = p.first; 239 | if (!p.second) goto handle_unusual; 240 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { 241 | // int64 size = 1; 242 | case 1: { 243 | if (static_cast< ::google::protobuf::uint8>(tag) == 244 | static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { 245 | 246 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 247 | ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( 248 | input, &size_))); 249 | } else { 250 | goto handle_unusual; 251 | } 252 | break; 253 | } 254 | 255 | // string name = 2; 256 | case 2: { 257 | if (static_cast< ::google::protobuf::uint8>(tag) == 258 | static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { 259 | DO_(::google::protobuf::internal::WireFormatLite::ReadString( 260 | input, this->mutable_name())); 261 | DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 262 | this->name().data(), static_cast(this->name().length()), 263 | ::google::protobuf::internal::WireFormatLite::PARSE, 264 | "tensorflow.TensorShapeProto.Dim.name")); 265 | } else { 266 | goto handle_unusual; 267 | } 268 | break; 269 | } 270 | 271 | default: { 272 | handle_unusual: 273 | if (tag == 0) { 274 | goto success; 275 | } 276 | DO_(::google::protobuf::internal::WireFormat::SkipField( 277 | input, tag, _internal_metadata_.mutable_unknown_fields())); 278 | break; 279 | } 280 | } 281 | } 282 | success: 283 | // @@protoc_insertion_point(parse_success:tensorflow.TensorShapeProto.Dim) 284 | return true; 285 | failure: 286 | // @@protoc_insertion_point(parse_failure:tensorflow.TensorShapeProto.Dim) 287 | return false; 288 | #undef DO_ 289 | } 290 | 291 | void TensorShapeProto_Dim::SerializeWithCachedSizes( 292 | ::google::protobuf::io::CodedOutputStream* output) const { 293 | // @@protoc_insertion_point(serialize_start:tensorflow.TensorShapeProto.Dim) 294 | ::google::protobuf::uint32 cached_has_bits = 0; 295 | (void) cached_has_bits; 296 | 297 | // int64 size = 1; 298 | if (this->size() != 0) { 299 | ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->size(), output); 300 | } 301 | 302 | // string name = 2; 303 | if (this->name().size() > 0) { 304 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 305 | this->name().data(), static_cast(this->name().length()), 306 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 307 | "tensorflow.TensorShapeProto.Dim.name"); 308 | ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( 309 | 2, this->name(), output); 310 | } 311 | 312 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 313 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( 314 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); 315 | } 316 | // @@protoc_insertion_point(serialize_end:tensorflow.TensorShapeProto.Dim) 317 | } 318 | 319 | ::google::protobuf::uint8* TensorShapeProto_Dim::InternalSerializeWithCachedSizesToArray( 320 | bool deterministic, ::google::protobuf::uint8* target) const { 321 | (void)deterministic; // Unused 322 | // @@protoc_insertion_point(serialize_to_array_start:tensorflow.TensorShapeProto.Dim) 323 | ::google::protobuf::uint32 cached_has_bits = 0; 324 | (void) cached_has_bits; 325 | 326 | // int64 size = 1; 327 | if (this->size() != 0) { 328 | target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->size(), target); 329 | } 330 | 331 | // string name = 2; 332 | if (this->name().size() > 0) { 333 | ::google::protobuf::internal::WireFormatLite::VerifyUtf8String( 334 | this->name().data(), static_cast(this->name().length()), 335 | ::google::protobuf::internal::WireFormatLite::SERIALIZE, 336 | "tensorflow.TensorShapeProto.Dim.name"); 337 | target = 338 | ::google::protobuf::internal::WireFormatLite::WriteStringToArray( 339 | 2, this->name(), target); 340 | } 341 | 342 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 343 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( 344 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); 345 | } 346 | // @@protoc_insertion_point(serialize_to_array_end:tensorflow.TensorShapeProto.Dim) 347 | return target; 348 | } 349 | 350 | size_t TensorShapeProto_Dim::ByteSizeLong() const { 351 | // @@protoc_insertion_point(message_byte_size_start:tensorflow.TensorShapeProto.Dim) 352 | size_t total_size = 0; 353 | 354 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 355 | total_size += 356 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( 357 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); 358 | } 359 | // string name = 2; 360 | if (this->name().size() > 0) { 361 | total_size += 1 + 362 | ::google::protobuf::internal::WireFormatLite::StringSize( 363 | this->name()); 364 | } 365 | 366 | // int64 size = 1; 367 | if (this->size() != 0) { 368 | total_size += 1 + 369 | ::google::protobuf::internal::WireFormatLite::Int64Size( 370 | this->size()); 371 | } 372 | 373 | int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); 374 | SetCachedSize(cached_size); 375 | return total_size; 376 | } 377 | 378 | void TensorShapeProto_Dim::MergeFrom(const ::google::protobuf::Message& from) { 379 | // @@protoc_insertion_point(generalized_merge_from_start:tensorflow.TensorShapeProto.Dim) 380 | GOOGLE_DCHECK_NE(&from, this); 381 | const TensorShapeProto_Dim* source = 382 | ::google::protobuf::internal::DynamicCastToGenerated( 383 | &from); 384 | if (source == NULL) { 385 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.TensorShapeProto.Dim) 386 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); 387 | } else { 388 | // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.TensorShapeProto.Dim) 389 | MergeFrom(*source); 390 | } 391 | } 392 | 393 | void TensorShapeProto_Dim::MergeFrom(const TensorShapeProto_Dim& from) { 394 | // @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.TensorShapeProto.Dim) 395 | GOOGLE_DCHECK_NE(&from, this); 396 | _internal_metadata_.MergeFrom(from._internal_metadata_); 397 | ::google::protobuf::uint32 cached_has_bits = 0; 398 | (void) cached_has_bits; 399 | 400 | if (from.name().size() > 0) { 401 | set_name(from.name()); 402 | } 403 | if (from.size() != 0) { 404 | set_size(from.size()); 405 | } 406 | } 407 | 408 | void TensorShapeProto_Dim::CopyFrom(const ::google::protobuf::Message& from) { 409 | // @@protoc_insertion_point(generalized_copy_from_start:tensorflow.TensorShapeProto.Dim) 410 | if (&from == this) return; 411 | Clear(); 412 | MergeFrom(from); 413 | } 414 | 415 | void TensorShapeProto_Dim::CopyFrom(const TensorShapeProto_Dim& from) { 416 | // @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.TensorShapeProto.Dim) 417 | if (&from == this) return; 418 | Clear(); 419 | MergeFrom(from); 420 | } 421 | 422 | bool TensorShapeProto_Dim::IsInitialized() const { 423 | return true; 424 | } 425 | 426 | void TensorShapeProto_Dim::Swap(TensorShapeProto_Dim* other) { 427 | if (other == this) return; 428 | if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { 429 | InternalSwap(other); 430 | } else { 431 | TensorShapeProto_Dim* temp = New(GetArenaNoVirtual()); 432 | temp->MergeFrom(*other); 433 | other->CopyFrom(*this); 434 | InternalSwap(temp); 435 | if (GetArenaNoVirtual() == NULL) { 436 | delete temp; 437 | } 438 | } 439 | } 440 | void TensorShapeProto_Dim::UnsafeArenaSwap(TensorShapeProto_Dim* other) { 441 | if (other == this) return; 442 | GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); 443 | InternalSwap(other); 444 | } 445 | void TensorShapeProto_Dim::InternalSwap(TensorShapeProto_Dim* other) { 446 | using std::swap; 447 | name_.Swap(&other->name_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(), 448 | GetArenaNoVirtual()); 449 | swap(size_, other->size_); 450 | _internal_metadata_.Swap(&other->_internal_metadata_); 451 | } 452 | 453 | ::google::protobuf::Metadata TensorShapeProto_Dim::GetMetadata() const { 454 | protobuf_tensor_5fshape_2eproto::protobuf_AssignDescriptorsOnce(); 455 | return ::protobuf_tensor_5fshape_2eproto::file_level_metadata[kIndexInFileMessages]; 456 | } 457 | 458 | 459 | // =================================================================== 460 | 461 | void TensorShapeProto::InitAsDefaultInstance() { 462 | } 463 | #if !defined(_MSC_VER) || _MSC_VER >= 1900 464 | const int TensorShapeProto::kDimFieldNumber; 465 | const int TensorShapeProto::kUnknownRankFieldNumber; 466 | #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 467 | 468 | TensorShapeProto::TensorShapeProto() 469 | : ::google::protobuf::Message(), _internal_metadata_(NULL) { 470 | ::google::protobuf::internal::InitSCC( 471 | &protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto.base); 472 | SharedCtor(); 473 | // @@protoc_insertion_point(constructor:tensorflow.TensorShapeProto) 474 | } 475 | TensorShapeProto::TensorShapeProto(::google::protobuf::Arena* arena) 476 | : ::google::protobuf::Message(), 477 | _internal_metadata_(arena), 478 | dim_(arena) { 479 | ::google::protobuf::internal::InitSCC(&protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto.base); 480 | SharedCtor(); 481 | RegisterArenaDtor(arena); 482 | // @@protoc_insertion_point(arena_constructor:tensorflow.TensorShapeProto) 483 | } 484 | TensorShapeProto::TensorShapeProto(const TensorShapeProto& from) 485 | : ::google::protobuf::Message(), 486 | _internal_metadata_(NULL), 487 | dim_(from.dim_) { 488 | _internal_metadata_.MergeFrom(from._internal_metadata_); 489 | unknown_rank_ = from.unknown_rank_; 490 | // @@protoc_insertion_point(copy_constructor:tensorflow.TensorShapeProto) 491 | } 492 | 493 | void TensorShapeProto::SharedCtor() { 494 | unknown_rank_ = false; 495 | } 496 | 497 | TensorShapeProto::~TensorShapeProto() { 498 | // @@protoc_insertion_point(destructor:tensorflow.TensorShapeProto) 499 | SharedDtor(); 500 | } 501 | 502 | void TensorShapeProto::SharedDtor() { 503 | GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); 504 | } 505 | 506 | void TensorShapeProto::ArenaDtor(void* object) { 507 | TensorShapeProto* _this = reinterpret_cast< TensorShapeProto* >(object); 508 | (void)_this; 509 | } 510 | void TensorShapeProto::RegisterArenaDtor(::google::protobuf::Arena*) { 511 | } 512 | void TensorShapeProto::SetCachedSize(int size) const { 513 | _cached_size_.Set(size); 514 | } 515 | const ::google::protobuf::Descriptor* TensorShapeProto::descriptor() { 516 | ::protobuf_tensor_5fshape_2eproto::protobuf_AssignDescriptorsOnce(); 517 | return ::protobuf_tensor_5fshape_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; 518 | } 519 | 520 | const TensorShapeProto& TensorShapeProto::default_instance() { 521 | ::google::protobuf::internal::InitSCC(&protobuf_tensor_5fshape_2eproto::scc_info_TensorShapeProto.base); 522 | return *internal_default_instance(); 523 | } 524 | 525 | 526 | void TensorShapeProto::Clear() { 527 | // @@protoc_insertion_point(message_clear_start:tensorflow.TensorShapeProto) 528 | ::google::protobuf::uint32 cached_has_bits = 0; 529 | // Prevent compiler warnings about cached_has_bits being unused 530 | (void) cached_has_bits; 531 | 532 | dim_.Clear(); 533 | unknown_rank_ = false; 534 | _internal_metadata_.Clear(); 535 | } 536 | 537 | bool TensorShapeProto::MergePartialFromCodedStream( 538 | ::google::protobuf::io::CodedInputStream* input) { 539 | #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure 540 | ::google::protobuf::uint32 tag; 541 | // @@protoc_insertion_point(parse_start:tensorflow.TensorShapeProto) 542 | for (;;) { 543 | ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); 544 | tag = p.first; 545 | if (!p.second) goto handle_unusual; 546 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { 547 | // repeated .tensorflow.TensorShapeProto.Dim dim = 2; 548 | case 2: { 549 | if (static_cast< ::google::protobuf::uint8>(tag) == 550 | static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { 551 | DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( 552 | input, add_dim())); 553 | } else { 554 | goto handle_unusual; 555 | } 556 | break; 557 | } 558 | 559 | // bool unknown_rank = 3; 560 | case 3: { 561 | if (static_cast< ::google::protobuf::uint8>(tag) == 562 | static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { 563 | 564 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 565 | bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( 566 | input, &unknown_rank_))); 567 | } else { 568 | goto handle_unusual; 569 | } 570 | break; 571 | } 572 | 573 | default: { 574 | handle_unusual: 575 | if (tag == 0) { 576 | goto success; 577 | } 578 | DO_(::google::protobuf::internal::WireFormat::SkipField( 579 | input, tag, _internal_metadata_.mutable_unknown_fields())); 580 | break; 581 | } 582 | } 583 | } 584 | success: 585 | // @@protoc_insertion_point(parse_success:tensorflow.TensorShapeProto) 586 | return true; 587 | failure: 588 | // @@protoc_insertion_point(parse_failure:tensorflow.TensorShapeProto) 589 | return false; 590 | #undef DO_ 591 | } 592 | 593 | void TensorShapeProto::SerializeWithCachedSizes( 594 | ::google::protobuf::io::CodedOutputStream* output) const { 595 | // @@protoc_insertion_point(serialize_start:tensorflow.TensorShapeProto) 596 | ::google::protobuf::uint32 cached_has_bits = 0; 597 | (void) cached_has_bits; 598 | 599 | // repeated .tensorflow.TensorShapeProto.Dim dim = 2; 600 | for (unsigned int i = 0, 601 | n = static_cast(this->dim_size()); i < n; i++) { 602 | ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 603 | 2, 604 | this->dim(static_cast(i)), 605 | output); 606 | } 607 | 608 | // bool unknown_rank = 3; 609 | if (this->unknown_rank() != 0) { 610 | ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->unknown_rank(), output); 611 | } 612 | 613 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 614 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( 615 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); 616 | } 617 | // @@protoc_insertion_point(serialize_end:tensorflow.TensorShapeProto) 618 | } 619 | 620 | ::google::protobuf::uint8* TensorShapeProto::InternalSerializeWithCachedSizesToArray( 621 | bool deterministic, ::google::protobuf::uint8* target) const { 622 | (void)deterministic; // Unused 623 | // @@protoc_insertion_point(serialize_to_array_start:tensorflow.TensorShapeProto) 624 | ::google::protobuf::uint32 cached_has_bits = 0; 625 | (void) cached_has_bits; 626 | 627 | // repeated .tensorflow.TensorShapeProto.Dim dim = 2; 628 | for (unsigned int i = 0, 629 | n = static_cast(this->dim_size()); i < n; i++) { 630 | target = ::google::protobuf::internal::WireFormatLite:: 631 | InternalWriteMessageToArray( 632 | 2, this->dim(static_cast(i)), deterministic, target); 633 | } 634 | 635 | // bool unknown_rank = 3; 636 | if (this->unknown_rank() != 0) { 637 | target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->unknown_rank(), target); 638 | } 639 | 640 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 641 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( 642 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); 643 | } 644 | // @@protoc_insertion_point(serialize_to_array_end:tensorflow.TensorShapeProto) 645 | return target; 646 | } 647 | 648 | size_t TensorShapeProto::ByteSizeLong() const { 649 | // @@protoc_insertion_point(message_byte_size_start:tensorflow.TensorShapeProto) 650 | size_t total_size = 0; 651 | 652 | if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { 653 | total_size += 654 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( 655 | (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); 656 | } 657 | // repeated .tensorflow.TensorShapeProto.Dim dim = 2; 658 | { 659 | unsigned int count = static_cast(this->dim_size()); 660 | total_size += 1UL * count; 661 | for (unsigned int i = 0; i < count; i++) { 662 | total_size += 663 | ::google::protobuf::internal::WireFormatLite::MessageSize( 664 | this->dim(static_cast(i))); 665 | } 666 | } 667 | 668 | // bool unknown_rank = 3; 669 | if (this->unknown_rank() != 0) { 670 | total_size += 1 + 1; 671 | } 672 | 673 | int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); 674 | SetCachedSize(cached_size); 675 | return total_size; 676 | } 677 | 678 | void TensorShapeProto::MergeFrom(const ::google::protobuf::Message& from) { 679 | // @@protoc_insertion_point(generalized_merge_from_start:tensorflow.TensorShapeProto) 680 | GOOGLE_DCHECK_NE(&from, this); 681 | const TensorShapeProto* source = 682 | ::google::protobuf::internal::DynamicCastToGenerated( 683 | &from); 684 | if (source == NULL) { 685 | // @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.TensorShapeProto) 686 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); 687 | } else { 688 | // @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.TensorShapeProto) 689 | MergeFrom(*source); 690 | } 691 | } 692 | 693 | void TensorShapeProto::MergeFrom(const TensorShapeProto& from) { 694 | // @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.TensorShapeProto) 695 | GOOGLE_DCHECK_NE(&from, this); 696 | _internal_metadata_.MergeFrom(from._internal_metadata_); 697 | ::google::protobuf::uint32 cached_has_bits = 0; 698 | (void) cached_has_bits; 699 | 700 | dim_.MergeFrom(from.dim_); 701 | if (from.unknown_rank() != 0) { 702 | set_unknown_rank(from.unknown_rank()); 703 | } 704 | } 705 | 706 | void TensorShapeProto::CopyFrom(const ::google::protobuf::Message& from) { 707 | // @@protoc_insertion_point(generalized_copy_from_start:tensorflow.TensorShapeProto) 708 | if (&from == this) return; 709 | Clear(); 710 | MergeFrom(from); 711 | } 712 | 713 | void TensorShapeProto::CopyFrom(const TensorShapeProto& from) { 714 | // @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.TensorShapeProto) 715 | if (&from == this) return; 716 | Clear(); 717 | MergeFrom(from); 718 | } 719 | 720 | bool TensorShapeProto::IsInitialized() const { 721 | return true; 722 | } 723 | 724 | void TensorShapeProto::Swap(TensorShapeProto* other) { 725 | if (other == this) return; 726 | if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) { 727 | InternalSwap(other); 728 | } else { 729 | TensorShapeProto* temp = New(GetArenaNoVirtual()); 730 | temp->MergeFrom(*other); 731 | other->CopyFrom(*this); 732 | InternalSwap(temp); 733 | if (GetArenaNoVirtual() == NULL) { 734 | delete temp; 735 | } 736 | } 737 | } 738 | void TensorShapeProto::UnsafeArenaSwap(TensorShapeProto* other) { 739 | if (other == this) return; 740 | GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual()); 741 | InternalSwap(other); 742 | } 743 | void TensorShapeProto::InternalSwap(TensorShapeProto* other) { 744 | using std::swap; 745 | CastToBase(&dim_)->InternalSwap(CastToBase(&other->dim_)); 746 | swap(unknown_rank_, other->unknown_rank_); 747 | _internal_metadata_.Swap(&other->_internal_metadata_); 748 | } 749 | 750 | ::google::protobuf::Metadata TensorShapeProto::GetMetadata() const { 751 | protobuf_tensor_5fshape_2eproto::protobuf_AssignDescriptorsOnce(); 752 | return ::protobuf_tensor_5fshape_2eproto::file_level_metadata[kIndexInFileMessages]; 753 | } 754 | 755 | 756 | // @@protoc_insertion_point(namespace_scope) 757 | } // namespace tensorflow 758 | namespace google { 759 | namespace protobuf { 760 | template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::TensorShapeProto_Dim* Arena::CreateMaybeMessage< ::tensorflow::TensorShapeProto_Dim >(Arena* arena) { 761 | return Arena::CreateMessageInternal< ::tensorflow::TensorShapeProto_Dim >(arena); 762 | } 763 | template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::tensorflow::TensorShapeProto* Arena::CreateMaybeMessage< ::tensorflow::TensorShapeProto >(Arena* arena) { 764 | return Arena::CreateMessageInternal< ::tensorflow::TensorShapeProto >(arena); 765 | } 766 | } // namespace protobuf 767 | } // namespace google 768 | 769 | // @@protoc_insertion_point(global_scope) 770 | -------------------------------------------------------------------------------- /src/generated/tensor_shape.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: tensor_shape.proto 3 | 4 | #ifndef PROTOBUF_INCLUDED_tensor_5fshape_2eproto 5 | #define PROTOBUF_INCLUDED_tensor_5fshape_2eproto 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 3006000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include // IWYU pragma: export 31 | #include // IWYU pragma: export 32 | #include 33 | // @@protoc_insertion_point(includes) 34 | #define PROTOBUF_INTERNAL_EXPORT_protobuf_tensor_5fshape_2eproto 35 | 36 | namespace protobuf_tensor_5fshape_2eproto { 37 | // Internal implementation detail -- do not use these members. 38 | struct TableStruct { 39 | static const ::google::protobuf::internal::ParseTableField entries[]; 40 | static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; 41 | static const ::google::protobuf::internal::ParseTable schema[2]; 42 | static const ::google::protobuf::internal::FieldMetadata field_metadata[]; 43 | static const ::google::protobuf::internal::SerializationTable serialization_table[]; 44 | static const ::google::protobuf::uint32 offsets[]; 45 | }; 46 | void AddDescriptors(); 47 | } // namespace protobuf_tensor_5fshape_2eproto 48 | namespace tensorflow { 49 | class TensorShapeProto; 50 | class TensorShapeProtoDefaultTypeInternal; 51 | extern TensorShapeProtoDefaultTypeInternal _TensorShapeProto_default_instance_; 52 | class TensorShapeProto_Dim; 53 | class TensorShapeProto_DimDefaultTypeInternal; 54 | extern TensorShapeProto_DimDefaultTypeInternal _TensorShapeProto_Dim_default_instance_; 55 | } // namespace tensorflow 56 | namespace google { 57 | namespace protobuf { 58 | template<> ::tensorflow::TensorShapeProto* Arena::CreateMaybeMessage<::tensorflow::TensorShapeProto>(Arena*); 59 | template<> ::tensorflow::TensorShapeProto_Dim* Arena::CreateMaybeMessage<::tensorflow::TensorShapeProto_Dim>(Arena*); 60 | } // namespace protobuf 61 | } // namespace google 62 | namespace tensorflow { 63 | 64 | // =================================================================== 65 | 66 | class TensorShapeProto_Dim : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.TensorShapeProto.Dim) */ { 67 | public: 68 | TensorShapeProto_Dim(); 69 | virtual ~TensorShapeProto_Dim(); 70 | 71 | TensorShapeProto_Dim(const TensorShapeProto_Dim& from); 72 | 73 | inline TensorShapeProto_Dim& operator=(const TensorShapeProto_Dim& from) { 74 | CopyFrom(from); 75 | return *this; 76 | } 77 | #if LANG_CXX11 78 | TensorShapeProto_Dim(TensorShapeProto_Dim&& from) noexcept 79 | : TensorShapeProto_Dim() { 80 | *this = ::std::move(from); 81 | } 82 | 83 | inline TensorShapeProto_Dim& operator=(TensorShapeProto_Dim&& from) noexcept { 84 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 85 | if (this != &from) InternalSwap(&from); 86 | } else { 87 | CopyFrom(from); 88 | } 89 | return *this; 90 | } 91 | #endif 92 | inline ::google::protobuf::Arena* GetArena() const final { 93 | return GetArenaNoVirtual(); 94 | } 95 | inline void* GetMaybeArenaPointer() const final { 96 | return MaybeArenaPtr(); 97 | } 98 | static const ::google::protobuf::Descriptor* descriptor(); 99 | static const TensorShapeProto_Dim& default_instance(); 100 | 101 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 102 | static inline const TensorShapeProto_Dim* internal_default_instance() { 103 | return reinterpret_cast( 104 | &_TensorShapeProto_Dim_default_instance_); 105 | } 106 | static constexpr int kIndexInFileMessages = 107 | 0; 108 | 109 | void UnsafeArenaSwap(TensorShapeProto_Dim* other); 110 | void Swap(TensorShapeProto_Dim* other); 111 | friend void swap(TensorShapeProto_Dim& a, TensorShapeProto_Dim& b) { 112 | a.Swap(&b); 113 | } 114 | 115 | // implements Message ---------------------------------------------- 116 | 117 | inline TensorShapeProto_Dim* New() const final { 118 | return CreateMaybeMessage(NULL); 119 | } 120 | 121 | TensorShapeProto_Dim* New(::google::protobuf::Arena* arena) const final { 122 | return CreateMaybeMessage(arena); 123 | } 124 | void CopyFrom(const ::google::protobuf::Message& from) final; 125 | void MergeFrom(const ::google::protobuf::Message& from) final; 126 | void CopyFrom(const TensorShapeProto_Dim& from); 127 | void MergeFrom(const TensorShapeProto_Dim& from); 128 | void Clear() final; 129 | bool IsInitialized() const final; 130 | 131 | size_t ByteSizeLong() const final; 132 | bool MergePartialFromCodedStream( 133 | ::google::protobuf::io::CodedInputStream* input) final; 134 | void SerializeWithCachedSizes( 135 | ::google::protobuf::io::CodedOutputStream* output) const final; 136 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 137 | bool deterministic, ::google::protobuf::uint8* target) const final; 138 | int GetCachedSize() const final { return _cached_size_.Get(); } 139 | 140 | private: 141 | void SharedCtor(); 142 | void SharedDtor(); 143 | void SetCachedSize(int size) const final; 144 | void InternalSwap(TensorShapeProto_Dim* other); 145 | protected: 146 | explicit TensorShapeProto_Dim(::google::protobuf::Arena* arena); 147 | private: 148 | static void ArenaDtor(void* object); 149 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 150 | private: 151 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 152 | return _internal_metadata_.arena(); 153 | } 154 | inline void* MaybeArenaPtr() const { 155 | return _internal_metadata_.raw_arena_ptr(); 156 | } 157 | public: 158 | 159 | ::google::protobuf::Metadata GetMetadata() const final; 160 | 161 | // nested types ---------------------------------------------------- 162 | 163 | // accessors ------------------------------------------------------- 164 | 165 | // string name = 2; 166 | void clear_name(); 167 | static const int kNameFieldNumber = 2; 168 | const ::std::string& name() const; 169 | void set_name(const ::std::string& value); 170 | #if LANG_CXX11 171 | void set_name(::std::string&& value); 172 | #endif 173 | void set_name(const char* value); 174 | void set_name(const char* value, size_t size); 175 | ::std::string* mutable_name(); 176 | ::std::string* release_name(); 177 | void set_allocated_name(::std::string* name); 178 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 179 | " string fields are deprecated and will be removed in a" 180 | " future release.") 181 | ::std::string* unsafe_arena_release_name(); 182 | PROTOBUF_RUNTIME_DEPRECATED("The unsafe_arena_ accessors for" 183 | " string fields are deprecated and will be removed in a" 184 | " future release.") 185 | void unsafe_arena_set_allocated_name( 186 | ::std::string* name); 187 | 188 | // int64 size = 1; 189 | void clear_size(); 190 | static const int kSizeFieldNumber = 1; 191 | ::google::protobuf::int64 size() const; 192 | void set_size(::google::protobuf::int64 value); 193 | 194 | // @@protoc_insertion_point(class_scope:tensorflow.TensorShapeProto.Dim) 195 | private: 196 | 197 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 198 | template friend class ::google::protobuf::Arena::InternalHelper; 199 | typedef void InternalArenaConstructable_; 200 | typedef void DestructorSkippable_; 201 | ::google::protobuf::internal::ArenaStringPtr name_; 202 | ::google::protobuf::int64 size_; 203 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 204 | friend struct ::protobuf_tensor_5fshape_2eproto::TableStruct; 205 | }; 206 | // ------------------------------------------------------------------- 207 | 208 | class TensorShapeProto : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:tensorflow.TensorShapeProto) */ { 209 | public: 210 | TensorShapeProto(); 211 | virtual ~TensorShapeProto(); 212 | 213 | TensorShapeProto(const TensorShapeProto& from); 214 | 215 | inline TensorShapeProto& operator=(const TensorShapeProto& from) { 216 | CopyFrom(from); 217 | return *this; 218 | } 219 | #if LANG_CXX11 220 | TensorShapeProto(TensorShapeProto&& from) noexcept 221 | : TensorShapeProto() { 222 | *this = ::std::move(from); 223 | } 224 | 225 | inline TensorShapeProto& operator=(TensorShapeProto&& from) noexcept { 226 | if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { 227 | if (this != &from) InternalSwap(&from); 228 | } else { 229 | CopyFrom(from); 230 | } 231 | return *this; 232 | } 233 | #endif 234 | inline ::google::protobuf::Arena* GetArena() const final { 235 | return GetArenaNoVirtual(); 236 | } 237 | inline void* GetMaybeArenaPointer() const final { 238 | return MaybeArenaPtr(); 239 | } 240 | static const ::google::protobuf::Descriptor* descriptor(); 241 | static const TensorShapeProto& default_instance(); 242 | 243 | static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY 244 | static inline const TensorShapeProto* internal_default_instance() { 245 | return reinterpret_cast( 246 | &_TensorShapeProto_default_instance_); 247 | } 248 | static constexpr int kIndexInFileMessages = 249 | 1; 250 | 251 | void UnsafeArenaSwap(TensorShapeProto* other); 252 | void Swap(TensorShapeProto* other); 253 | friend void swap(TensorShapeProto& a, TensorShapeProto& b) { 254 | a.Swap(&b); 255 | } 256 | 257 | // implements Message ---------------------------------------------- 258 | 259 | inline TensorShapeProto* New() const final { 260 | return CreateMaybeMessage(NULL); 261 | } 262 | 263 | TensorShapeProto* New(::google::protobuf::Arena* arena) const final { 264 | return CreateMaybeMessage(arena); 265 | } 266 | void CopyFrom(const ::google::protobuf::Message& from) final; 267 | void MergeFrom(const ::google::protobuf::Message& from) final; 268 | void CopyFrom(const TensorShapeProto& from); 269 | void MergeFrom(const TensorShapeProto& from); 270 | void Clear() final; 271 | bool IsInitialized() const final; 272 | 273 | size_t ByteSizeLong() const final; 274 | bool MergePartialFromCodedStream( 275 | ::google::protobuf::io::CodedInputStream* input) final; 276 | void SerializeWithCachedSizes( 277 | ::google::protobuf::io::CodedOutputStream* output) const final; 278 | ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( 279 | bool deterministic, ::google::protobuf::uint8* target) const final; 280 | int GetCachedSize() const final { return _cached_size_.Get(); } 281 | 282 | private: 283 | void SharedCtor(); 284 | void SharedDtor(); 285 | void SetCachedSize(int size) const final; 286 | void InternalSwap(TensorShapeProto* other); 287 | protected: 288 | explicit TensorShapeProto(::google::protobuf::Arena* arena); 289 | private: 290 | static void ArenaDtor(void* object); 291 | inline void RegisterArenaDtor(::google::protobuf::Arena* arena); 292 | private: 293 | inline ::google::protobuf::Arena* GetArenaNoVirtual() const { 294 | return _internal_metadata_.arena(); 295 | } 296 | inline void* MaybeArenaPtr() const { 297 | return _internal_metadata_.raw_arena_ptr(); 298 | } 299 | public: 300 | 301 | ::google::protobuf::Metadata GetMetadata() const final; 302 | 303 | // nested types ---------------------------------------------------- 304 | 305 | typedef TensorShapeProto_Dim Dim; 306 | 307 | // accessors ------------------------------------------------------- 308 | 309 | // repeated .tensorflow.TensorShapeProto.Dim dim = 2; 310 | int dim_size() const; 311 | void clear_dim(); 312 | static const int kDimFieldNumber = 2; 313 | ::tensorflow::TensorShapeProto_Dim* mutable_dim(int index); 314 | ::google::protobuf::RepeatedPtrField< ::tensorflow::TensorShapeProto_Dim >* 315 | mutable_dim(); 316 | const ::tensorflow::TensorShapeProto_Dim& dim(int index) const; 317 | ::tensorflow::TensorShapeProto_Dim* add_dim(); 318 | const ::google::protobuf::RepeatedPtrField< ::tensorflow::TensorShapeProto_Dim >& 319 | dim() const; 320 | 321 | // bool unknown_rank = 3; 322 | void clear_unknown_rank(); 323 | static const int kUnknownRankFieldNumber = 3; 324 | bool unknown_rank() const; 325 | void set_unknown_rank(bool value); 326 | 327 | // @@protoc_insertion_point(class_scope:tensorflow.TensorShapeProto) 328 | private: 329 | 330 | ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; 331 | template friend class ::google::protobuf::Arena::InternalHelper; 332 | typedef void InternalArenaConstructable_; 333 | typedef void DestructorSkippable_; 334 | ::google::protobuf::RepeatedPtrField< ::tensorflow::TensorShapeProto_Dim > dim_; 335 | bool unknown_rank_; 336 | mutable ::google::protobuf::internal::CachedSize _cached_size_; 337 | friend struct ::protobuf_tensor_5fshape_2eproto::TableStruct; 338 | }; 339 | // =================================================================== 340 | 341 | 342 | // =================================================================== 343 | 344 | #ifdef __GNUC__ 345 | #pragma GCC diagnostic push 346 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 347 | #endif // __GNUC__ 348 | // TensorShapeProto_Dim 349 | 350 | // int64 size = 1; 351 | inline void TensorShapeProto_Dim::clear_size() { 352 | size_ = GOOGLE_LONGLONG(0); 353 | } 354 | inline ::google::protobuf::int64 TensorShapeProto_Dim::size() const { 355 | // @@protoc_insertion_point(field_get:tensorflow.TensorShapeProto.Dim.size) 356 | return size_; 357 | } 358 | inline void TensorShapeProto_Dim::set_size(::google::protobuf::int64 value) { 359 | 360 | size_ = value; 361 | // @@protoc_insertion_point(field_set:tensorflow.TensorShapeProto.Dim.size) 362 | } 363 | 364 | // string name = 2; 365 | inline void TensorShapeProto_Dim::clear_name() { 366 | name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 367 | } 368 | inline const ::std::string& TensorShapeProto_Dim::name() const { 369 | // @@protoc_insertion_point(field_get:tensorflow.TensorShapeProto.Dim.name) 370 | return name_.Get(); 371 | } 372 | inline void TensorShapeProto_Dim::set_name(const ::std::string& value) { 373 | 374 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual()); 375 | // @@protoc_insertion_point(field_set:tensorflow.TensorShapeProto.Dim.name) 376 | } 377 | #if LANG_CXX11 378 | inline void TensorShapeProto_Dim::set_name(::std::string&& value) { 379 | 380 | name_.Set( 381 | &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value), GetArenaNoVirtual()); 382 | // @@protoc_insertion_point(field_set_rvalue:tensorflow.TensorShapeProto.Dim.name) 383 | } 384 | #endif 385 | inline void TensorShapeProto_Dim::set_name(const char* value) { 386 | GOOGLE_DCHECK(value != NULL); 387 | 388 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value), 389 | GetArenaNoVirtual()); 390 | // @@protoc_insertion_point(field_set_char:tensorflow.TensorShapeProto.Dim.name) 391 | } 392 | inline void TensorShapeProto_Dim::set_name(const char* value, 393 | size_t size) { 394 | 395 | name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( 396 | reinterpret_cast(value), size), GetArenaNoVirtual()); 397 | // @@protoc_insertion_point(field_set_pointer:tensorflow.TensorShapeProto.Dim.name) 398 | } 399 | inline ::std::string* TensorShapeProto_Dim::mutable_name() { 400 | 401 | // @@protoc_insertion_point(field_mutable:tensorflow.TensorShapeProto.Dim.name) 402 | return name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 403 | } 404 | inline ::std::string* TensorShapeProto_Dim::release_name() { 405 | // @@protoc_insertion_point(field_release:tensorflow.TensorShapeProto.Dim.name) 406 | 407 | return name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); 408 | } 409 | inline void TensorShapeProto_Dim::set_allocated_name(::std::string* name) { 410 | if (name != NULL) { 411 | 412 | } else { 413 | 414 | } 415 | name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, 416 | GetArenaNoVirtual()); 417 | // @@protoc_insertion_point(field_set_allocated:tensorflow.TensorShapeProto.Dim.name) 418 | } 419 | inline ::std::string* TensorShapeProto_Dim::unsafe_arena_release_name() { 420 | // @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorShapeProto.Dim.name) 421 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 422 | 423 | return name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 424 | GetArenaNoVirtual()); 425 | } 426 | inline void TensorShapeProto_Dim::unsafe_arena_set_allocated_name( 427 | ::std::string* name) { 428 | GOOGLE_DCHECK(GetArenaNoVirtual() != NULL); 429 | if (name != NULL) { 430 | 431 | } else { 432 | 433 | } 434 | name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), 435 | name, GetArenaNoVirtual()); 436 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorShapeProto.Dim.name) 437 | } 438 | 439 | // ------------------------------------------------------------------- 440 | 441 | // TensorShapeProto 442 | 443 | // repeated .tensorflow.TensorShapeProto.Dim dim = 2; 444 | inline int TensorShapeProto::dim_size() const { 445 | return dim_.size(); 446 | } 447 | inline void TensorShapeProto::clear_dim() { 448 | dim_.Clear(); 449 | } 450 | inline ::tensorflow::TensorShapeProto_Dim* TensorShapeProto::mutable_dim(int index) { 451 | // @@protoc_insertion_point(field_mutable:tensorflow.TensorShapeProto.dim) 452 | return dim_.Mutable(index); 453 | } 454 | inline ::google::protobuf::RepeatedPtrField< ::tensorflow::TensorShapeProto_Dim >* 455 | TensorShapeProto::mutable_dim() { 456 | // @@protoc_insertion_point(field_mutable_list:tensorflow.TensorShapeProto.dim) 457 | return &dim_; 458 | } 459 | inline const ::tensorflow::TensorShapeProto_Dim& TensorShapeProto::dim(int index) const { 460 | // @@protoc_insertion_point(field_get:tensorflow.TensorShapeProto.dim) 461 | return dim_.Get(index); 462 | } 463 | inline ::tensorflow::TensorShapeProto_Dim* TensorShapeProto::add_dim() { 464 | // @@protoc_insertion_point(field_add:tensorflow.TensorShapeProto.dim) 465 | return dim_.Add(); 466 | } 467 | inline const ::google::protobuf::RepeatedPtrField< ::tensorflow::TensorShapeProto_Dim >& 468 | TensorShapeProto::dim() const { 469 | // @@protoc_insertion_point(field_list:tensorflow.TensorShapeProto.dim) 470 | return dim_; 471 | } 472 | 473 | // bool unknown_rank = 3; 474 | inline void TensorShapeProto::clear_unknown_rank() { 475 | unknown_rank_ = false; 476 | } 477 | inline bool TensorShapeProto::unknown_rank() const { 478 | // @@protoc_insertion_point(field_get:tensorflow.TensorShapeProto.unknown_rank) 479 | return unknown_rank_; 480 | } 481 | inline void TensorShapeProto::set_unknown_rank(bool value) { 482 | 483 | unknown_rank_ = value; 484 | // @@protoc_insertion_point(field_set:tensorflow.TensorShapeProto.unknown_rank) 485 | } 486 | 487 | #ifdef __GNUC__ 488 | #pragma GCC diagnostic pop 489 | #endif // __GNUC__ 490 | // ------------------------------------------------------------------- 491 | 492 | 493 | // @@protoc_insertion_point(namespace_scope) 494 | 495 | } // namespace tensorflow 496 | 497 | // @@protoc_insertion_point(global_scope) 498 | 499 | #endif // PROTOBUF_INCLUDED_tensor_5fshape_2eproto 500 | -------------------------------------------------------------------------------- /src/generated/types.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: types.proto 4 | 5 | #include "types.pb.h" 6 | #include "types.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace tensorflow { 17 | 18 | } // namespace tensorflow 19 | 20 | -------------------------------------------------------------------------------- /src/generated/types.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: types.proto 4 | #ifndef GRPC_types_2eproto__INCLUDED 5 | #define GRPC_types_2eproto__INCLUDED 6 | 7 | #include "types.pb.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace grpc { 21 | class CompletionQueue; 22 | class Channel; 23 | class ServerCompletionQueue; 24 | class ServerContext; 25 | } // namespace grpc 26 | 27 | namespace tensorflow { 28 | 29 | } // namespace tensorflow 30 | 31 | 32 | #endif // GRPC_types_2eproto__INCLUDED 33 | -------------------------------------------------------------------------------- /src/generated/types.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: types.proto 3 | 4 | #include "types.pb.h" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | // This is a temporary google only hack 17 | #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS 18 | #include "third_party/protobuf/version.h" 19 | #endif 20 | // @@protoc_insertion_point(includes) 21 | 22 | namespace tensorflow { 23 | } // namespace tensorflow 24 | namespace protobuf_types_2eproto { 25 | void InitDefaults() { 26 | } 27 | 28 | const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1]; 29 | const ::google::protobuf::uint32 TableStruct::offsets[1] = {}; 30 | static const ::google::protobuf::internal::MigrationSchema* schemas = NULL; 31 | static const ::google::protobuf::Message* const* file_default_instances = NULL; 32 | 33 | static void protobuf_AssignDescriptors() { 34 | AddDescriptors(); 35 | AssignDescriptors( 36 | "types.proto", schemas, file_default_instances, TableStruct::offsets, 37 | NULL, file_level_enum_descriptors, NULL); 38 | } 39 | 40 | static void protobuf_AssignDescriptorsOnce() { 41 | static ::google::protobuf::internal::once_flag once; 42 | ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); 43 | } 44 | 45 | void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; 46 | void protobuf_RegisterTypes(const ::std::string&) { 47 | protobuf_AssignDescriptorsOnce(); 48 | } 49 | 50 | static void AddDescriptorsImpl() { 51 | InitDefaults(); 52 | static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { 53 | "\n\013types.proto\022\ntensorflow*\252\006\n\010DataType\022\016" 54 | "\n\nDT_INVALID\020\000\022\014\n\010DT_FLOAT\020\001\022\r\n\tDT_DOUBL" 55 | "E\020\002\022\014\n\010DT_INT32\020\003\022\014\n\010DT_UINT8\020\004\022\014\n\010DT_IN" 56 | "T16\020\005\022\013\n\007DT_INT8\020\006\022\r\n\tDT_STRING\020\007\022\020\n\014DT_" 57 | "COMPLEX64\020\010\022\014\n\010DT_INT64\020\t\022\013\n\007DT_BOOL\020\n\022\014" 58 | "\n\010DT_QINT8\020\013\022\r\n\tDT_QUINT8\020\014\022\r\n\tDT_QINT32" 59 | "\020\r\022\017\n\013DT_BFLOAT16\020\016\022\r\n\tDT_QINT16\020\017\022\016\n\nDT" 60 | "_QUINT16\020\020\022\r\n\tDT_UINT16\020\021\022\021\n\rDT_COMPLEX1" 61 | "28\020\022\022\013\n\007DT_HALF\020\023\022\017\n\013DT_RESOURCE\020\024\022\016\n\nDT" 62 | "_VARIANT\020\025\022\r\n\tDT_UINT32\020\026\022\r\n\tDT_UINT64\020\027" 63 | "\022\020\n\014DT_FLOAT_REF\020e\022\021\n\rDT_DOUBLE_REF\020f\022\020\n" 64 | "\014DT_INT32_REF\020g\022\020\n\014DT_UINT8_REF\020h\022\020\n\014DT_" 65 | "INT16_REF\020i\022\017\n\013DT_INT8_REF\020j\022\021\n\rDT_STRIN" 66 | "G_REF\020k\022\024\n\020DT_COMPLEX64_REF\020l\022\020\n\014DT_INT6" 67 | "4_REF\020m\022\017\n\013DT_BOOL_REF\020n\022\020\n\014DT_QINT8_REF" 68 | "\020o\022\021\n\rDT_QUINT8_REF\020p\022\021\n\rDT_QINT32_REF\020q" 69 | "\022\023\n\017DT_BFLOAT16_REF\020r\022\021\n\rDT_QINT16_REF\020s" 70 | "\022\022\n\016DT_QUINT16_REF\020t\022\021\n\rDT_UINT16_REF\020u\022" 71 | "\025\n\021DT_COMPLEX128_REF\020v\022\017\n\013DT_HALF_REF\020w\022" 72 | "\023\n\017DT_RESOURCE_REF\020x\022\022\n\016DT_VARIANT_REF\020y" 73 | "\022\021\n\rDT_UINT32_REF\020z\022\021\n\rDT_UINT64_REF\020{Bk" 74 | "\n\030org.tensorflow.frameworkB\013TypesProtosP" 75 | "\001Z=github.com/tensorflow/tensorflow/tens" 76 | "orflow/go/core/framework\370\001\001b\006proto3" 77 | }; 78 | ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( 79 | descriptor, 955); 80 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( 81 | "types.proto", &protobuf_RegisterTypes); 82 | } 83 | 84 | void AddDescriptors() { 85 | static ::google::protobuf::internal::once_flag once; 86 | ::google::protobuf::internal::call_once(once, AddDescriptorsImpl); 87 | } 88 | // Force AddDescriptors() to be called at dynamic initialization time. 89 | struct StaticDescriptorInitializer { 90 | StaticDescriptorInitializer() { 91 | AddDescriptors(); 92 | } 93 | } static_descriptor_initializer; 94 | } // namespace protobuf_types_2eproto 95 | namespace tensorflow { 96 | const ::google::protobuf::EnumDescriptor* DataType_descriptor() { 97 | protobuf_types_2eproto::protobuf_AssignDescriptorsOnce(); 98 | return protobuf_types_2eproto::file_level_enum_descriptors[0]; 99 | } 100 | bool DataType_IsValid(int value) { 101 | switch (value) { 102 | case 0: 103 | case 1: 104 | case 2: 105 | case 3: 106 | case 4: 107 | case 5: 108 | case 6: 109 | case 7: 110 | case 8: 111 | case 9: 112 | case 10: 113 | case 11: 114 | case 12: 115 | case 13: 116 | case 14: 117 | case 15: 118 | case 16: 119 | case 17: 120 | case 18: 121 | case 19: 122 | case 20: 123 | case 21: 124 | case 22: 125 | case 23: 126 | case 101: 127 | case 102: 128 | case 103: 129 | case 104: 130 | case 105: 131 | case 106: 132 | case 107: 133 | case 108: 134 | case 109: 135 | case 110: 136 | case 111: 137 | case 112: 138 | case 113: 139 | case 114: 140 | case 115: 141 | case 116: 142 | case 117: 143 | case 118: 144 | case 119: 145 | case 120: 146 | case 121: 147 | case 122: 148 | case 123: 149 | return true; 150 | default: 151 | return false; 152 | } 153 | } 154 | 155 | 156 | // @@protoc_insertion_point(namespace_scope) 157 | } // namespace tensorflow 158 | namespace google { 159 | namespace protobuf { 160 | } // namespace protobuf 161 | } // namespace google 162 | 163 | // @@protoc_insertion_point(global_scope) 164 | -------------------------------------------------------------------------------- /src/generated/types.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: types.proto 3 | 4 | #ifndef PROTOBUF_INCLUDED_types_2eproto 5 | #define PROTOBUF_INCLUDED_types_2eproto 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 3006000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3006000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include // IWYU pragma: export 30 | #include // IWYU pragma: export 31 | #include 32 | // @@protoc_insertion_point(includes) 33 | #define PROTOBUF_INTERNAL_EXPORT_protobuf_types_2eproto 34 | 35 | namespace protobuf_types_2eproto { 36 | // Internal implementation detail -- do not use these members. 37 | struct TableStruct { 38 | static const ::google::protobuf::internal::ParseTableField entries[]; 39 | static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; 40 | static const ::google::protobuf::internal::ParseTable schema[1]; 41 | static const ::google::protobuf::internal::FieldMetadata field_metadata[]; 42 | static const ::google::protobuf::internal::SerializationTable serialization_table[]; 43 | static const ::google::protobuf::uint32 offsets[]; 44 | }; 45 | void AddDescriptors(); 46 | } // namespace protobuf_types_2eproto 47 | namespace tensorflow { 48 | } // namespace tensorflow 49 | namespace tensorflow { 50 | 51 | enum DataType { 52 | DT_INVALID = 0, 53 | DT_FLOAT = 1, 54 | DT_DOUBLE = 2, 55 | DT_INT32 = 3, 56 | DT_UINT8 = 4, 57 | DT_INT16 = 5, 58 | DT_INT8 = 6, 59 | DT_STRING = 7, 60 | DT_COMPLEX64 = 8, 61 | DT_INT64 = 9, 62 | DT_BOOL = 10, 63 | DT_QINT8 = 11, 64 | DT_QUINT8 = 12, 65 | DT_QINT32 = 13, 66 | DT_BFLOAT16 = 14, 67 | DT_QINT16 = 15, 68 | DT_QUINT16 = 16, 69 | DT_UINT16 = 17, 70 | DT_COMPLEX128 = 18, 71 | DT_HALF = 19, 72 | DT_RESOURCE = 20, 73 | DT_VARIANT = 21, 74 | DT_UINT32 = 22, 75 | DT_UINT64 = 23, 76 | DT_FLOAT_REF = 101, 77 | DT_DOUBLE_REF = 102, 78 | DT_INT32_REF = 103, 79 | DT_UINT8_REF = 104, 80 | DT_INT16_REF = 105, 81 | DT_INT8_REF = 106, 82 | DT_STRING_REF = 107, 83 | DT_COMPLEX64_REF = 108, 84 | DT_INT64_REF = 109, 85 | DT_BOOL_REF = 110, 86 | DT_QINT8_REF = 111, 87 | DT_QUINT8_REF = 112, 88 | DT_QINT32_REF = 113, 89 | DT_BFLOAT16_REF = 114, 90 | DT_QINT16_REF = 115, 91 | DT_QUINT16_REF = 116, 92 | DT_UINT16_REF = 117, 93 | DT_COMPLEX128_REF = 118, 94 | DT_HALF_REF = 119, 95 | DT_RESOURCE_REF = 120, 96 | DT_VARIANT_REF = 121, 97 | DT_UINT32_REF = 122, 98 | DT_UINT64_REF = 123, 99 | DataType_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, 100 | DataType_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max 101 | }; 102 | bool DataType_IsValid(int value); 103 | const DataType DataType_MIN = DT_INVALID; 104 | const DataType DataType_MAX = DT_UINT64_REF; 105 | const int DataType_ARRAYSIZE = DataType_MAX + 1; 106 | 107 | const ::google::protobuf::EnumDescriptor* DataType_descriptor(); 108 | inline const ::std::string& DataType_Name(DataType value) { 109 | return ::google::protobuf::internal::NameOfEnum( 110 | DataType_descriptor(), value); 111 | } 112 | inline bool DataType_Parse( 113 | const ::std::string& name, DataType* value) { 114 | return ::google::protobuf::internal::ParseNamedEnum( 115 | DataType_descriptor(), name, value); 116 | } 117 | // =================================================================== 118 | 119 | 120 | // =================================================================== 121 | 122 | 123 | // =================================================================== 124 | 125 | #ifdef __GNUC__ 126 | #pragma GCC diagnostic push 127 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 128 | #endif // __GNUC__ 129 | #ifdef __GNUC__ 130 | #pragma GCC diagnostic pop 131 | #endif // __GNUC__ 132 | 133 | // @@protoc_insertion_point(namespace_scope) 134 | 135 | } // namespace tensorflow 136 | 137 | namespace google { 138 | namespace protobuf { 139 | 140 | template <> struct is_proto_enum< ::tensorflow::DataType> : ::std::true_type {}; 141 | template <> 142 | inline const EnumDescriptor* GetEnumDescriptor< ::tensorflow::DataType>() { 143 | return ::tensorflow::DataType_descriptor(); 144 | } 145 | 146 | } // namespace protobuf 147 | } // namespace google 148 | 149 | // @@protoc_insertion_point(global_scope) 150 | 151 | #endif // PROTOBUF_INCLUDED_types_2eproto 152 | -------------------------------------------------------------------------------- /src/protos/model.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow.serving; 4 | option cc_enable_arenas = true; 5 | 6 | // import "google/protobuf/wrappers.proto"; 7 | 8 | // Wrapper message for `int64`. 9 | // 10 | // The JSON representation for `Int64Value` is JSON string. 11 | message Int64Value { 12 | // The int64 value. 13 | int64 value = 1; 14 | } 15 | 16 | // Metadata for an inference request such as the model name and version. 17 | message ModelSpec { 18 | // Required servable name. 19 | string name = 1; 20 | 21 | // Optional version. Recommended to be left unset in the common case. Should 22 | // be specified only when there is a strong version consistency requirement. 23 | // 24 | // When left unspecified, the system will serve the best available version. 25 | // This is typically the latest version, though during version transitions, 26 | // notably when serving on a fleet of instances, may be either the previous or 27 | // new version. 28 | // google.protobuf.Int64Value version = 2; 29 | Int64Value version = 2; 30 | 31 | // A named signature to evaluate. If unspecified, the default signature will 32 | // be used. 33 | string signature_name = 3; 34 | } 35 | -------------------------------------------------------------------------------- /src/protos/predict.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow.serving; 4 | option cc_enable_arenas = true; 5 | 6 | import "tensor.proto"; 7 | import "model.proto"; 8 | 9 | // PredictRequest specifies which TensorFlow model to run, as well as 10 | // how inputs are mapped to tensors and how outputs are filtered before 11 | // returning to user. 12 | message PredictRequest { 13 | // Model Specification. If version is not specified, will use the latest 14 | // (numerical) version. 15 | ModelSpec model_spec = 1; 16 | 17 | // Input tensors. 18 | // Names of input tensor are alias names. The mapping from aliases to real 19 | // input tensor names is stored in the SavedModel export as a prediction 20 | // SignatureDef under the 'inputs' field. 21 | map inputs = 2; 22 | 23 | // Output filter. 24 | // Names specified are alias names. The mapping from aliases to real output 25 | // tensor names is stored in the SavedModel export as a prediction 26 | // SignatureDef under the 'outputs' field. 27 | // Only tensors specified here will be run/fetched and returned, with the 28 | // exception that when none is specified, all tensors specified in the 29 | // named signature will be run/fetched and returned. 30 | repeated string output_filter = 3; 31 | } 32 | 33 | // Response for PredictRequest on successful run. 34 | message PredictResponse { 35 | // Effective Model Specification used to process PredictRequest. 36 | ModelSpec model_spec = 2; 37 | 38 | // Output tensors. 39 | map outputs = 1; 40 | } 41 | -------------------------------------------------------------------------------- /src/protos/prediction_service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow.serving; 4 | option cc_enable_arenas = true; 5 | option cc_generic_services = false; 6 | 7 | 8 | import "predict.proto"; 9 | 10 | // open source marker; do not remove 11 | // PredictionService provides access to machine-learned models loaded by 12 | // model_servers. 13 | service PredictionService { 14 | 15 | // Predict -- provides access to loaded TensorFlow model. 16 | rpc Predict(PredictRequest) returns (PredictResponse); 17 | } 18 | -------------------------------------------------------------------------------- /src/protos/resource_handle.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "ResourceHandle"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework"; 9 | 10 | // Protocol buffer representing a handle to a tensorflow resource. Handles are 11 | // not valid across executions, but can be serialized back and forth from within 12 | // a single run. 13 | message ResourceHandleProto { 14 | // Unique name for the device containing the resource. 15 | string device = 1; 16 | 17 | // Container in which this resource is placed. 18 | string container = 2; 19 | 20 | // Unique name of this resource. 21 | string name = 3; 22 | 23 | // Hash code for the type of the resource. Is only valid in the same device 24 | // and in the same execution. 25 | uint64 hash_code = 4; 26 | 27 | // For debug-only, the name of the type pointed to by this handle, if 28 | // available. 29 | string maybe_type_name = 5; 30 | }; 31 | -------------------------------------------------------------------------------- /src/protos/tensor.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "TensorProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework"; 9 | import "resource_handle.proto"; 10 | import "tensor_shape.proto"; 11 | import "types.proto"; 12 | 13 | // Protocol buffer representing a tensor. 14 | message TensorProto { 15 | DataType dtype = 1; 16 | 17 | // Shape of the tensor. TODO(touts): sort out the 0-rank issues. 18 | TensorShapeProto tensor_shape = 2; 19 | 20 | // Only one of the representations below is set, one of "tensor_contents" and 21 | // the "xxx_val" attributes. We are not using oneof because as oneofs cannot 22 | // contain repeated fields it would require another extra set of messages. 23 | 24 | // Version number. 25 | // 26 | // In version 0, if the "repeated xxx" representations contain only one 27 | // element, that element is repeated to fill the shape. This makes it easy 28 | // to represent a constant Tensor with a single value. 29 | int32 version_number = 3; 30 | 31 | // Serialized raw tensor content from either Tensor::AsProtoTensorContent or 32 | // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation 33 | // can be used for all tensor types. The purpose of this representation is to 34 | // reduce serialization overhead during RPC call by avoiding serialization of 35 | // many repeated small items. 36 | bytes tensor_content = 4; 37 | 38 | // Type specific representations that make it easy to create tensor protos in 39 | // all languages. Only the representation corresponding to "dtype" can 40 | // be set. The values hold the flattened representation of the tensor in 41 | // row major order. 42 | 43 | // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll 44 | // have some pointless zero padding for each value here. 45 | repeated int32 half_val = 13 [packed = true]; 46 | 47 | // DT_FLOAT. 48 | repeated float float_val = 5 [packed = true]; 49 | 50 | // DT_DOUBLE. 51 | repeated double double_val = 6 [packed = true]; 52 | 53 | // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. 54 | repeated int32 int_val = 7 [packed = true]; 55 | 56 | // DT_STRING 57 | repeated bytes string_val = 8; 58 | 59 | // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real 60 | // and imaginary parts of i-th single precision complex. 61 | repeated float scomplex_val = 9 [packed = true]; 62 | 63 | // DT_INT64 64 | repeated int64 int64_val = 10 [packed = true]; 65 | 66 | // DT_BOOL 67 | repeated bool bool_val = 11 [packed = true]; 68 | 69 | // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real 70 | // and imaginary parts of i-th double precision complex. 71 | repeated double dcomplex_val = 12 [packed = true]; 72 | 73 | // DT_RESOURCE 74 | repeated ResourceHandleProto resource_handle_val = 14; 75 | 76 | // DT_VARIANT 77 | repeated VariantTensorDataProto variant_val = 15; 78 | 79 | // DT_UINT32 80 | repeated uint32 uint32_val = 16 [packed = true]; 81 | 82 | // DT_UINT64 83 | repeated uint64 uint64_val = 17 [packed = true]; 84 | }; 85 | 86 | // Protocol buffer representing the serialization format of DT_VARIANT tensors. 87 | message VariantTensorDataProto { 88 | // Name of the type of objects being serialized. 89 | string type_name = 1; 90 | // Portions of the object that are not Tensors. 91 | bytes metadata = 2; 92 | // Tensors contained within objects being serialized. 93 | repeated TensorProto tensors = 3; 94 | } 95 | -------------------------------------------------------------------------------- /src/protos/tensor_shape.proto: -------------------------------------------------------------------------------- 1 | // Protocol buffer representing the shape of tensors. 2 | 3 | syntax = "proto3"; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "TensorShapeProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework"; 9 | 10 | package tensorflow; 11 | 12 | // Dimensions of a tensor. 13 | message TensorShapeProto { 14 | // One dimension of the tensor. 15 | message Dim { 16 | // Size of the tensor in that dimension. 17 | // This value must be >= -1, but values of -1 are reserved for "unknown" 18 | // shapes (values of -1 mean "unknown" dimension). Certain wrappers 19 | // that work with TensorShapeProto may fail at runtime when deserializing 20 | // a TensorShapeProto containing a dim value of -1. 21 | int64 size = 1; 22 | 23 | // Optional name of the tensor dimension. 24 | string name = 2; 25 | }; 26 | 27 | // Dimensions of the tensor, such as {"input", 30}, {"output", 40} 28 | // for a 30 x 40 2D tensor. If an entry has size -1, this 29 | // corresponds to a dimension of unknown size. The names are 30 | // optional. 31 | // 32 | // The order of entries in "dim" matters: It indicates the layout of the 33 | // values in the tensor in-memory representation. 34 | // 35 | // The first entry in "dim" is the outermost dimension used to layout the 36 | // values, the last entry is the innermost dimension. This matches the 37 | // in-memory layout of RowMajor Eigen tensors. 38 | // 39 | // If "dim.size()" > 0, "unknown_rank" must be false. 40 | repeated Dim dim = 2; 41 | 42 | // If true, the number of dimensions in the shape is unknown. 43 | // 44 | // If true, "dim.size()" must be 0. 45 | bool unknown_rank = 3; 46 | }; 47 | -------------------------------------------------------------------------------- /src/protos/types.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorflow; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "TypesProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework"; 9 | 10 | // LINT.IfChange 11 | enum DataType { 12 | // Not a legal value for DataType. Used to indicate a DataType field 13 | // has not been set. 14 | DT_INVALID = 0; 15 | 16 | // Data types that all computation devices are expected to be 17 | // capable to support. 18 | DT_FLOAT = 1; 19 | DT_DOUBLE = 2; 20 | DT_INT32 = 3; 21 | DT_UINT8 = 4; 22 | DT_INT16 = 5; 23 | DT_INT8 = 6; 24 | DT_STRING = 7; 25 | DT_COMPLEX64 = 8; // Single-precision complex 26 | DT_INT64 = 9; 27 | DT_BOOL = 10; 28 | DT_QINT8 = 11; // Quantized int8 29 | DT_QUINT8 = 12; // Quantized uint8 30 | DT_QINT32 = 13; // Quantized int32 31 | DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. 32 | DT_QINT16 = 15; // Quantized int16 33 | DT_QUINT16 = 16; // Quantized uint16 34 | DT_UINT16 = 17; 35 | DT_COMPLEX128 = 18; // Double-precision complex 36 | DT_HALF = 19; 37 | DT_RESOURCE = 20; 38 | DT_VARIANT = 21; // Arbitrary C++ data types 39 | DT_UINT32 = 22; 40 | DT_UINT64 = 23; 41 | 42 | // Do not use! These are only for parameters. Every enum above 43 | // should have a corresponding value below (verified by types_test). 44 | DT_FLOAT_REF = 101; 45 | DT_DOUBLE_REF = 102; 46 | DT_INT32_REF = 103; 47 | DT_UINT8_REF = 104; 48 | DT_INT16_REF = 105; 49 | DT_INT8_REF = 106; 50 | DT_STRING_REF = 107; 51 | DT_COMPLEX64_REF = 108; 52 | DT_INT64_REF = 109; 53 | DT_BOOL_REF = 110; 54 | DT_QINT8_REF = 111; 55 | DT_QUINT8_REF = 112; 56 | DT_QINT32_REF = 113; 57 | DT_BFLOAT16_REF = 114; 58 | DT_QINT16_REF = 115; 59 | DT_QUINT16_REF = 116; 60 | DT_UINT16_REF = 117; 61 | DT_COMPLEX128_REF = 118; 62 | DT_HALF_REF = 119; 63 | DT_RESOURCE_REF = 120; 64 | DT_VARIANT_REF = 121; 65 | DT_UINT32_REF = 122; 66 | DT_UINT64_REF = 123; 67 | } 68 | // LINT.ThenChange( 69 | // https://www.tensorflow.org/code/tensorflow/c/c_api.h, 70 | // https://www.tensorflow.org/code/tensorflow/go/tensor.go, 71 | // https://www.tensorflow.org/code/tensorflow/core/framework/tensor.cc, 72 | // https://www.tensorflow.org/code/tensorflow/core/framework/types.h, 73 | // https://www.tensorflow.org/code/tensorflow/core/framework/types.cc, 74 | // https://www.tensorflow.org/code/tensorflow/python/framework/dtypes.py, 75 | // https://www.tensorflow.org/code/tensorflow/python/framework/function.py) 76 | -------------------------------------------------------------------------------- /src/serving_client.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Google Inc. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ============================================================================== 15 | 16 | Modifications copyright (C) 2018 Vitaly Bezgachev, vitaly.bezgachev@gmail.com 17 | 18 | ============================================================================== 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | #include "grpcpp/create_channel.h" 25 | #include "grpcpp/security/credentials.h" 26 | #include "generated/prediction_service.grpc.pb.h" 27 | #include "generated/tensor.grpc.pb.h" 28 | 29 | using grpc::Channel; 30 | using grpc::ClientContext; 31 | using grpc::Status; 32 | 33 | using tensorflow::serving::PredictRequest; 34 | using tensorflow::serving::PredictResponse; 35 | using tensorflow::serving::PredictionService; 36 | 37 | typedef google::protobuf::Map OutMap; 38 | 39 | /* 40 | Serving client for the prediction service 41 | */ 42 | class ServingClient { 43 | 44 | private: 45 | std::unique_ptr stub_; 46 | 47 | public: 48 | // Constructor: create a stub for the prediction service 49 | ServingClient(std::shared_ptr channel) : stub_(PredictionService::NewStub(channel)) {} 50 | 51 | // Call the prediction service 52 | std::string callPredict(const std::string& model_name, 53 | const std::string& model_signature_name, 54 | const std::string& file_path) { 55 | PredictRequest predictRequest; 56 | PredictResponse response; 57 | ClientContext context; 58 | 59 | // set model specification: name and signature name 60 | predictRequest.mutable_model_spec()->set_name(model_name); 61 | predictRequest.mutable_model_spec()->set_signature_name(model_signature_name); 62 | 63 | // open image file 64 | std::ifstream imageFile(file_path, std::ios::binary); 65 | if (!imageFile.is_open()) { 66 | std::cout << "Failed to open " << file_path << std::endl; 67 | return ""; 68 | } 69 | 70 | std::filebuf* pbuf = imageFile.rdbuf(); 71 | auto fileSize = pbuf->pubseekoff(0, std::ios::end, std::ios::in); 72 | 73 | // read file content into the memory 74 | char* image = new char[fileSize](); 75 | pbuf->pubseekpos(0, std::ios::in); 76 | pbuf->sgetn(image, fileSize); 77 | imageFile.close(); 78 | 79 | // create input protobuf for the image 80 | tensorflow::TensorProto proto; 81 | proto.set_dtype(tensorflow::DataType::DT_STRING); 82 | proto.add_string_val(image, fileSize); 83 | 84 | proto.mutable_tensor_shape()->add_dim()->set_size(1); 85 | 86 | // initialize prediction service inputs 87 | google::protobuf::Map& inputs = *predictRequest.mutable_inputs(); 88 | inputs["images"] = proto; 89 | 90 | // issue gRPC call to the service 91 | Status status = stub_->Predict(&context, predictRequest, &response); 92 | 93 | // free the memory 94 | delete[] image; 95 | 96 | // check the response 97 | if (status.ok()) { 98 | std::cout << "call predict ok" << std::endl; 99 | std::cout << "outputs size is " << response.outputs_size() << std::endl; 100 | OutMap& map_outputs = *response.mutable_outputs(); 101 | OutMap::iterator iter; 102 | int output_index = 0; 103 | 104 | // read the response 105 | for (iter = map_outputs.begin(); iter != map_outputs.end(); ++iter) { 106 | tensorflow::TensorProto& result_tensor_proto = iter->second; 107 | std::cout << "number of probabilies " << result_tensor_proto.float_val_size() << std::endl; 108 | 109 | int maxIdx = -1; 110 | float maxVal = -1; 111 | for (int i = 0; i < result_tensor_proto.float_val_size(); ++i) { 112 | float val = result_tensor_proto.float_val(i); 113 | std::cout << "probability of " << i << " is " << val << std::endl; 114 | 115 | if (maxVal < val) { 116 | maxVal = val; 117 | maxIdx = i; 118 | } 119 | } 120 | 121 | std::cout << std::endl << "most probably the digit on the image is " << maxIdx << std::endl << std::endl; 122 | 123 | ++output_index; 124 | } 125 | 126 | return "Done."; 127 | } 128 | else { 129 | std::cout << "gRPC call return code: " << status.error_code() << ": " 130 | << status.error_message() << std::endl; 131 | return "gRPC failed."; 132 | } 133 | } 134 | }; 135 | 136 | 137 | /* 138 | Application entry point 139 | */ 140 | int main(int argc, char** argv) { 141 | const std::string model_name = "gan"; 142 | const std::string model_signature_name = "predict_images"; 143 | 144 | std::string server = "172.17.0.2:9000"; 145 | std::string image_file = "./resources/Afghan_hound_00116.jpg"; 146 | 147 | // parse arguments 148 | for (int i = 0; i < argc; ++i) { 149 | if (std::string(argv[i]) == "--server" && i + 1 < argc) { 150 | server = argv[++i]; 151 | } 152 | 153 | if (std::string(argv[i]) == "--image_file" && i + 1 < argc) { 154 | image_file = argv[++i]; 155 | } 156 | } 157 | 158 | std::cout << "calling prediction service on " << server << std::endl; 159 | 160 | // create and call serving client 161 | ServingClient guide(grpc::CreateChannel(server, grpc::InsecureChannelCredentials())); 162 | std::cout << "calling predict using file: " << image_file << " ..." << std::endl; 163 | std::cout << guide.callPredict(model_name, model_signature_name, image_file) << std::endl; 164 | return 0; 165 | } 166 | --------------------------------------------------------------------------------