├── .rspec ├── lib ├── tensorflow_serving_client │ └── version.rb ├── tensorflow_serving_client.rb ├── tensorflow_serving │ └── apis │ │ ├── prediction_service_pb.rb │ │ ├── model_pb.rb │ │ ├── prediction_service_services_pb.rb │ │ └── predict_pb.rb └── tensorflow │ └── core │ ├── framework │ ├── versions_pb.rb │ ├── resource_handle_pb.rb │ ├── node_def_pb.rb │ ├── allocation_description_pb.rb │ ├── graph_pb.rb │ ├── tensor_shape_pb.rb │ ├── tensor_slice_pb.rb │ ├── tensor_description_pb.rb │ ├── device_attributes_pb.rb │ ├── variable_pb.rb │ ├── kernel_def_pb.rb │ ├── tensor_pb.rb │ ├── types_pb.rb │ ├── function_pb.rb │ ├── attr_value_pb.rb │ ├── cost_graph_pb.rb │ ├── step_stats_pb.rb │ ├── log_memory_pb.rb │ ├── op_def_pb.rb │ └── summary_pb.rb │ └── example │ ├── example_pb.rb │ ├── feature_pb.rb │ └── example_parser_configuration_pb.rb ├── .travis.yml ├── spec ├── spec_helper.rb └── tensorflow_serving_client_spec.rb ├── .gitmodules ├── Gemfile ├── .gitignore ├── bin ├── setup └── console ├── Rakefile ├── LICENSE.txt ├── tensorflow_serving_client.gemspec └── README.md /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | -------------------------------------------------------------------------------- /lib/tensorflow_serving_client/version.rb: -------------------------------------------------------------------------------- 1 | module TensorflowServingClient 2 | VERSION = "0.2.1" 3 | end 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: ruby 3 | rvm: 4 | - 2.3.0 5 | before_install: gem install bundler -v 1.13.6 6 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) 2 | require "tensorflow_serving_client" 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tensorflow_serving"] 2 | path = tensorflow_serving 3 | url = https://github.com/tensorflow/serving.git 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in tensorflow_serving_client.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /lib/tensorflow_serving_client.rb: -------------------------------------------------------------------------------- 1 | require "tensorflow_serving_client/version" 2 | require 'tensorflow_serving/apis/prediction_service_services_pb' 3 | require 'tensorflow/core/example/example_pb' 4 | 5 | module TensorflowServingClient 6 | # Your code goes here... 7 | end 8 | -------------------------------------------------------------------------------- /spec/tensorflow_serving_client_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe TensorflowServingClient do 4 | it "has a version number" do 5 | expect(TensorflowServingClient::VERSION).not_to be nil 6 | end 7 | 8 | it "does something useful" do 9 | expect(false).to eq(true) 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/tensorflow_serving/apis/prediction_service_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow_serving/apis/prediction_service.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow_serving/apis/predict_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | end 9 | 10 | module Tensorflow 11 | module Serving 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "tensorflow_serving_client" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start 15 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/versions_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/versions.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.VersionDef" do 8 | optional :producer, :int32, 1 9 | optional :min_consumer, :int32, 2 10 | repeated :bad_consumers, :int32, 3 11 | end 12 | end 13 | 14 | module Tensorflow 15 | VersionDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.VersionDef").msgclass 16 | end 17 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rspec/core/rake_task" 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | 6 | task :default => :spec 7 | 8 | desc "Compile protobufs" 9 | task :protoc do 10 | sh 'grpc_tools_ruby_protoc', 11 | '-I', 'tensorflow_serving/tensorflow', 12 | '-I', 'tensorflow_serving', 13 | '--ruby_out=lib', 14 | '--grpc_out=lib', 15 | *Dir['tensorflow_serving/tensorflow/tensorflow/core/framework/*.proto'], 16 | *Dir['tensorflow_serving/tensorflow/tensorflow/core/example/*.proto'], 17 | *Dir['tensorflow_serving/tensorflow_serving/apis/*.proto'] 18 | end 19 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/resource_handle_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/resource_handle.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.ResourceHandle" do 8 | optional :device, :string, 1 9 | optional :container, :string, 2 10 | optional :name, :string, 3 11 | optional :hash_code, :uint64, 4 12 | optional :maybe_type_name, :string, 5 13 | end 14 | end 15 | 16 | module Tensorflow 17 | ResourceHandle = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.ResourceHandle").msgclass 18 | end 19 | -------------------------------------------------------------------------------- /lib/tensorflow_serving/apis/model_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow_serving/apis/model.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'google/protobuf/wrappers_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | add_message "tensorflow.serving.ModelSpec" do 9 | optional :name, :string, 1 10 | optional :version, :message, 2, "google.protobuf.Int64Value" 11 | optional :signature_name, :string, 3 12 | end 13 | end 14 | 15 | module Tensorflow 16 | module Serving 17 | ModelSpec = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.serving.ModelSpec").msgclass 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/node_def_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/node_def.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/attr_value_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | add_message "tensorflow.NodeDef" do 9 | optional :name, :string, 1 10 | optional :op, :string, 2 11 | repeated :input, :string, 3 12 | optional :device, :string, 4 13 | map :attr, :string, :message, 5, "tensorflow.AttrValue" 14 | end 15 | end 16 | 17 | module Tensorflow 18 | NodeDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.NodeDef").msgclass 19 | end 20 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/allocation_description_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/allocation_description.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.AllocationDescription" do 8 | optional :requested_bytes, :int64, 1 9 | optional :allocated_bytes, :int64, 2 10 | optional :allocator_name, :string, 3 11 | optional :allocation_id, :int64, 4 12 | optional :has_single_reference, :bool, 5 13 | optional :ptr, :uint64, 6 14 | end 15 | end 16 | 17 | module Tensorflow 18 | AllocationDescription = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.AllocationDescription").msgclass 19 | end 20 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/graph_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/graph.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/node_def_pb' 7 | require 'tensorflow/core/framework/function_pb' 8 | require 'tensorflow/core/framework/versions_pb' 9 | Google::Protobuf::DescriptorPool.generated_pool.build do 10 | add_message "tensorflow.GraphDef" do 11 | repeated :node, :message, 1, "tensorflow.NodeDef" 12 | optional :versions, :message, 4, "tensorflow.VersionDef" 13 | optional :version, :int32, 3 14 | optional :library, :message, 2, "tensorflow.FunctionDefLibrary" 15 | end 16 | end 17 | 18 | module Tensorflow 19 | GraphDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.GraphDef").msgclass 20 | end 21 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/tensor_shape_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/tensor_shape.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.TensorShapeProto" do 8 | repeated :dim, :message, 2, "tensorflow.TensorShapeProto.Dim" 9 | optional :unknown_rank, :bool, 3 10 | end 11 | add_message "tensorflow.TensorShapeProto.Dim" do 12 | optional :size, :int64, 1 13 | optional :name, :string, 2 14 | end 15 | end 16 | 17 | module Tensorflow 18 | TensorShapeProto = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TensorShapeProto").msgclass 19 | TensorShapeProto::Dim = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TensorShapeProto.Dim").msgclass 20 | end 21 | -------------------------------------------------------------------------------- /lib/tensorflow/core/example/example_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/example/example.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/example/feature_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | add_message "tensorflow.Example" do 9 | optional :features, :message, 1, "tensorflow.Features" 10 | end 11 | add_message "tensorflow.SequenceExample" do 12 | optional :context, :message, 1, "tensorflow.Features" 13 | optional :feature_lists, :message, 2, "tensorflow.FeatureLists" 14 | end 15 | end 16 | 17 | module Tensorflow 18 | Example = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Example").msgclass 19 | SequenceExample = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SequenceExample").msgclass 20 | end 21 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/tensor_slice_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/tensor_slice.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.TensorSliceProto" do 8 | repeated :extent, :message, 1, "tensorflow.TensorSliceProto.Extent" 9 | end 10 | add_message "tensorflow.TensorSliceProto.Extent" do 11 | optional :start, :int64, 1 12 | oneof :has_length do 13 | optional :length, :int64, 2 14 | end 15 | end 16 | end 17 | 18 | module Tensorflow 19 | TensorSliceProto = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TensorSliceProto").msgclass 20 | TensorSliceProto::Extent = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TensorSliceProto.Extent").msgclass 21 | end 22 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/tensor_description_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/tensor_description.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/types_pb' 7 | require 'tensorflow/core/framework/tensor_shape_pb' 8 | require 'tensorflow/core/framework/allocation_description_pb' 9 | Google::Protobuf::DescriptorPool.generated_pool.build do 10 | add_message "tensorflow.TensorDescription" do 11 | optional :dtype, :enum, 1, "tensorflow.DataType" 12 | optional :shape, :message, 2, "tensorflow.TensorShapeProto" 13 | optional :allocation_description, :message, 4, "tensorflow.AllocationDescription" 14 | end 15 | end 16 | 17 | module Tensorflow 18 | TensorDescription = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TensorDescription").msgclass 19 | end 20 | -------------------------------------------------------------------------------- /lib/tensorflow_serving/apis/prediction_service_services_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # Source: tensorflow_serving/apis/prediction_service.proto for package 'tensorflow.serving' 3 | 4 | require 'grpc' 5 | require 'tensorflow_serving/apis/prediction_service_pb' 6 | 7 | module Tensorflow 8 | module Serving 9 | module PredictionService 10 | # PredictionService provides access to machine-learned models loaded by 11 | # model_servers. 12 | class Service 13 | 14 | include GRPC::GenericService 15 | 16 | self.marshal_class_method = :encode 17 | self.unmarshal_class_method = :decode 18 | self.service_name = 'tensorflow.serving.PredictionService' 19 | 20 | # Predict -- provides access to loaded TensorFlow model. 21 | rpc :Predict, PredictRequest, PredictResponse 22 | end 23 | 24 | Stub = Service.rpc_stub_class 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/device_attributes_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/device_attributes.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.DeviceLocality" do 8 | optional :bus_id, :int32, 1 9 | end 10 | add_message "tensorflow.DeviceAttributes" do 11 | optional :name, :string, 1 12 | optional :device_type, :string, 2 13 | optional :memory_limit, :int64, 4 14 | optional :locality, :message, 5, "tensorflow.DeviceLocality" 15 | optional :incarnation, :fixed64, 6 16 | optional :physical_device_desc, :string, 7 17 | end 18 | end 19 | 20 | module Tensorflow 21 | DeviceLocality = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeviceLocality").msgclass 22 | DeviceAttributes = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeviceAttributes").msgclass 23 | end 24 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/variable_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/variable.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.VariableDef" do 8 | optional :variable_name, :string, 1 9 | optional :initializer_name, :string, 2 10 | optional :snapshot_name, :string, 3 11 | optional :save_slice_info_def, :message, 4, "tensorflow.SaveSliceInfoDef" 12 | end 13 | add_message "tensorflow.SaveSliceInfoDef" do 14 | optional :full_name, :string, 1 15 | repeated :full_shape, :int64, 2 16 | repeated :var_offset, :int64, 3 17 | repeated :var_shape, :int64, 4 18 | end 19 | end 20 | 21 | module Tensorflow 22 | VariableDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.VariableDef").msgclass 23 | SaveSliceInfoDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SaveSliceInfoDef").msgclass 24 | end 25 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/kernel_def_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/kernel_def.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/attr_value_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | add_message "tensorflow.KernelDef" do 9 | optional :op, :string, 1 10 | optional :device_type, :string, 2 11 | repeated :constraint, :message, 3, "tensorflow.KernelDef.AttrConstraint" 12 | repeated :host_memory_arg, :string, 4 13 | optional :label, :string, 5 14 | end 15 | add_message "tensorflow.KernelDef.AttrConstraint" do 16 | optional :name, :string, 1 17 | optional :allowed_values, :message, 2, "tensorflow.AttrValue" 18 | end 19 | end 20 | 21 | module Tensorflow 22 | KernelDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.KernelDef").msgclass 23 | KernelDef::AttrConstraint = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.KernelDef.AttrConstraint").msgclass 24 | end 25 | -------------------------------------------------------------------------------- /lib/tensorflow_serving/apis/predict_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow_serving/apis/predict.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/tensor_pb' 7 | require 'tensorflow_serving/apis/model_pb' 8 | Google::Protobuf::DescriptorPool.generated_pool.build do 9 | add_message "tensorflow.serving.PredictRequest" do 10 | optional :model_spec, :message, 1, "tensorflow.serving.ModelSpec" 11 | map :inputs, :string, :message, 2, "tensorflow.TensorProto" 12 | repeated :output_filter, :string, 3 13 | end 14 | add_message "tensorflow.serving.PredictResponse" do 15 | map :outputs, :string, :message, 1, "tensorflow.TensorProto" 16 | end 17 | end 18 | 19 | module Tensorflow 20 | module Serving 21 | PredictRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.serving.PredictRequest").msgclass 22 | PredictResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.serving.PredictResponse").msgclass 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Dominique d’Argent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /tensorflow_serving_client.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'tensorflow_serving_client/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "tensorflow_serving_client" 8 | spec.version = TensorflowServingClient::VERSION 9 | spec.authors = ["Dominique d’Argent"] 10 | spec.email = ["dominique.dargent@me.com"] 11 | 12 | spec.summary = %q{A Ruby client library for Tensorflow Serving} 13 | spec.homepage = "https://github.com/nubbel/tensorflow_serving_client-ruby" 14 | spec.license = "MIT" 15 | 16 | spec.files = `git ls-files -z`.split("\x0").reject do |f| 17 | f.match(%r{^(test|spec|features)/}) 18 | end 19 | spec.bindir = "exe" 20 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 21 | spec.require_paths = ["lib"] 22 | 23 | spec.add_runtime_dependency 'grpc', '~> 1.0', '>= 1.0.1' 24 | 25 | spec.add_development_dependency "bundler", "~> 1.13" 26 | spec.add_development_dependency "rake", "~> 10.0" 27 | spec.add_development_dependency "rspec", "~> 3.0" 28 | spec.add_development_dependency 'grpc-tools', '~> 1.0', '>= 1.0.1' 29 | end 30 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/tensor_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/tensor.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/resource_handle_pb' 7 | require 'tensorflow/core/framework/tensor_shape_pb' 8 | require 'tensorflow/core/framework/types_pb' 9 | Google::Protobuf::DescriptorPool.generated_pool.build do 10 | add_message "tensorflow.TensorProto" do 11 | optional :dtype, :enum, 1, "tensorflow.DataType" 12 | optional :tensor_shape, :message, 2, "tensorflow.TensorShapeProto" 13 | optional :version_number, :int32, 3 14 | optional :tensor_content, :bytes, 4 15 | repeated :half_val, :int32, 13 16 | repeated :float_val, :float, 5 17 | repeated :double_val, :double, 6 18 | repeated :int_val, :int32, 7 19 | repeated :string_val, :bytes, 8 20 | repeated :scomplex_val, :float, 9 21 | repeated :int64_val, :int64, 10 22 | repeated :bool_val, :bool, 11 23 | repeated :dcomplex_val, :double, 12 24 | repeated :resource_handle_val, :message, 14, "tensorflow.ResourceHandle" 25 | end 26 | end 27 | 28 | module Tensorflow 29 | TensorProto = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TensorProto").msgclass 30 | end 31 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/types_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/types.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_enum "tensorflow.DataType" do 8 | value :DT_INVALID, 0 9 | value :DT_FLOAT, 1 10 | value :DT_DOUBLE, 2 11 | value :DT_INT32, 3 12 | value :DT_UINT8, 4 13 | value :DT_INT16, 5 14 | value :DT_INT8, 6 15 | value :DT_STRING, 7 16 | value :DT_COMPLEX64, 8 17 | value :DT_INT64, 9 18 | value :DT_BOOL, 10 19 | value :DT_QINT8, 11 20 | value :DT_QUINT8, 12 21 | value :DT_QINT32, 13 22 | value :DT_BFLOAT16, 14 23 | value :DT_QINT16, 15 24 | value :DT_QUINT16, 16 25 | value :DT_UINT16, 17 26 | value :DT_COMPLEX128, 18 27 | value :DT_HALF, 19 28 | value :DT_RESOURCE, 20 29 | value :DT_FLOAT_REF, 101 30 | value :DT_DOUBLE_REF, 102 31 | value :DT_INT32_REF, 103 32 | value :DT_UINT8_REF, 104 33 | value :DT_INT16_REF, 105 34 | value :DT_INT8_REF, 106 35 | value :DT_STRING_REF, 107 36 | value :DT_COMPLEX64_REF, 108 37 | value :DT_INT64_REF, 109 38 | value :DT_BOOL_REF, 110 39 | value :DT_QINT8_REF, 111 40 | value :DT_QUINT8_REF, 112 41 | value :DT_QINT32_REF, 113 42 | value :DT_BFLOAT16_REF, 114 43 | value :DT_QINT16_REF, 115 44 | value :DT_QUINT16_REF, 116 45 | value :DT_UINT16_REF, 117 46 | value :DT_COMPLEX128_REF, 118 47 | value :DT_HALF_REF, 119 48 | value :DT_RESOURCE_REF, 120 49 | end 50 | end 51 | 52 | module Tensorflow 53 | DataType = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DataType").enummodule 54 | end 55 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/function_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/function.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/attr_value_pb' 7 | require 'tensorflow/core/framework/node_def_pb' 8 | require 'tensorflow/core/framework/op_def_pb' 9 | Google::Protobuf::DescriptorPool.generated_pool.build do 10 | add_message "tensorflow.FunctionDefLibrary" do 11 | repeated :function, :message, 1, "tensorflow.FunctionDef" 12 | repeated :gradient, :message, 2, "tensorflow.GradientDef" 13 | end 14 | add_message "tensorflow.FunctionDef" do 15 | optional :signature, :message, 1, "tensorflow.OpDef" 16 | map :attr, :string, :message, 5, "tensorflow.AttrValue" 17 | repeated :node, :message, 2, "tensorflow.FunctionDef.Node" 18 | repeated :node_def, :message, 3, "tensorflow.NodeDef" 19 | map :ret, :string, :string, 4 20 | end 21 | add_message "tensorflow.FunctionDef.Node" do 22 | repeated :ret, :string, 1 23 | optional :op, :string, 2 24 | repeated :arg, :string, 3 25 | repeated :dep, :string, 4 26 | map :attr, :string, :message, 5, "tensorflow.AttrValue" 27 | end 28 | add_message "tensorflow.GradientDef" do 29 | optional :function_name, :string, 1 30 | optional :gradient_func, :string, 2 31 | end 32 | end 33 | 34 | module Tensorflow 35 | FunctionDefLibrary = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FunctionDefLibrary").msgclass 36 | FunctionDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FunctionDef").msgclass 37 | FunctionDef::Node = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FunctionDef.Node").msgclass 38 | GradientDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.GradientDef").msgclass 39 | end 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tensorflow_serving_client 2 | 3 | A Ruby client library for Tensorflow Serving. 4 | 5 | ## Installation 6 | 7 | Add this line to your application's Gemfile: 8 | 9 | ```ruby 10 | gem 'tensorflow_serving_client' 11 | ``` 12 | 13 | And then execute: 14 | 15 | $ bundle 16 | 17 | Or install it yourself as: 18 | 19 | $ gem install tensorflow_serving_client 20 | 21 | ## Usage 22 | 23 | ```ruby 24 | require 'tensorflow_serving_client' 25 | 26 | stub = Tensorflow::Serving::PredictionService::Stub.new('localhost:9000', :this_channel_is_insecure) 27 | 28 | req = Tensorflow::Serving::PredictRequest.new 29 | req.model_spec = Tensorflow::Serving::ModelSpec.new name: 'mnist' 30 | req.inputs['images'] = Tensorflow::TensorProto.new float_val: [0]*784, tensor_shape: Tensorflow::TensorShapeProto.new(dim: [Tensorflow::TensorShapeProto::Dim.new(size: 1),Tensorflow::TensorShapeProto::Dim.new(size: 784)]), dtype: Tensorflow::DataType::DT_FLOAT 31 | 32 | res = stub.predict req 33 | res.outputs 34 | ``` 35 | 36 | ## Development 37 | 38 | After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. 39 | 40 | To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). 41 | 42 | ## Contributing 43 | 44 | Bug reports and pull requests are welcome on GitHub at https://github.com/nubbel/tensorflow_serving_client-ruby. 45 | 46 | 47 | ## License 48 | 49 | The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). 50 | 51 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/attr_value_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/attr_value.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/tensor_pb' 7 | require 'tensorflow/core/framework/tensor_shape_pb' 8 | require 'tensorflow/core/framework/types_pb' 9 | Google::Protobuf::DescriptorPool.generated_pool.build do 10 | add_message "tensorflow.AttrValue" do 11 | oneof :value do 12 | optional :s, :bytes, 2 13 | optional :i, :int64, 3 14 | optional :f, :float, 4 15 | optional :b, :bool, 5 16 | optional :type, :enum, 6, "tensorflow.DataType" 17 | optional :shape, :message, 7, "tensorflow.TensorShapeProto" 18 | optional :tensor, :message, 8, "tensorflow.TensorProto" 19 | optional :list, :message, 1, "tensorflow.AttrValue.ListValue" 20 | optional :func, :message, 10, "tensorflow.NameAttrList" 21 | optional :placeholder, :string, 9 22 | end 23 | end 24 | add_message "tensorflow.AttrValue.ListValue" do 25 | repeated :s, :bytes, 2 26 | repeated :i, :int64, 3 27 | repeated :f, :float, 4 28 | repeated :b, :bool, 5 29 | repeated :type, :enum, 6, "tensorflow.DataType" 30 | repeated :shape, :message, 7, "tensorflow.TensorShapeProto" 31 | repeated :tensor, :message, 8, "tensorflow.TensorProto" 32 | end 33 | add_message "tensorflow.NameAttrList" do 34 | optional :name, :string, 1 35 | map :attr, :string, :message, 2, "tensorflow.AttrValue" 36 | end 37 | end 38 | 39 | module Tensorflow 40 | AttrValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.AttrValue").msgclass 41 | AttrValue::ListValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.AttrValue.ListValue").msgclass 42 | NameAttrList = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.NameAttrList").msgclass 43 | end 44 | -------------------------------------------------------------------------------- /lib/tensorflow/core/example/feature_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/example/feature.proto 3 | 4 | require 'google/protobuf' 5 | 6 | Google::Protobuf::DescriptorPool.generated_pool.build do 7 | add_message "tensorflow.BytesList" do 8 | repeated :value, :bytes, 1 9 | end 10 | add_message "tensorflow.FloatList" do 11 | repeated :value, :float, 1 12 | end 13 | add_message "tensorflow.Int64List" do 14 | repeated :value, :int64, 1 15 | end 16 | add_message "tensorflow.Feature" do 17 | oneof :kind do 18 | optional :bytes_list, :message, 1, "tensorflow.BytesList" 19 | optional :float_list, :message, 2, "tensorflow.FloatList" 20 | optional :int64_list, :message, 3, "tensorflow.Int64List" 21 | end 22 | end 23 | add_message "tensorflow.Features" do 24 | map :feature, :string, :message, 1, "tensorflow.Feature" 25 | end 26 | add_message "tensorflow.FeatureList" do 27 | repeated :feature, :message, 1, "tensorflow.Feature" 28 | end 29 | add_message "tensorflow.FeatureLists" do 30 | map :feature_list, :string, :message, 1, "tensorflow.FeatureList" 31 | end 32 | end 33 | 34 | module Tensorflow 35 | BytesList = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.BytesList").msgclass 36 | FloatList = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FloatList").msgclass 37 | Int64List = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Int64List").msgclass 38 | Feature = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Feature").msgclass 39 | Features = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Features").msgclass 40 | FeatureList = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FeatureList").msgclass 41 | FeatureLists = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FeatureLists").msgclass 42 | end 43 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/cost_graph_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/cost_graph.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/tensor_shape_pb' 7 | require 'tensorflow/core/framework/types_pb' 8 | Google::Protobuf::DescriptorPool.generated_pool.build do 9 | add_message "tensorflow.CostGraphDef" do 10 | repeated :node, :message, 1, "tensorflow.CostGraphDef.Node" 11 | end 12 | add_message "tensorflow.CostGraphDef.Node" do 13 | optional :name, :string, 1 14 | optional :device, :string, 2 15 | optional :id, :int32, 3 16 | repeated :input_info, :message, 4, "tensorflow.CostGraphDef.Node.InputInfo" 17 | repeated :output_info, :message, 5, "tensorflow.CostGraphDef.Node.OutputInfo" 18 | optional :temporary_memory_size, :int64, 6 19 | optional :compute_cost, :int64, 9 20 | optional :is_final, :bool, 7 21 | repeated :control_input, :int32, 8 22 | end 23 | add_message "tensorflow.CostGraphDef.Node.InputInfo" do 24 | optional :preceding_node, :int32, 1 25 | optional :preceding_port, :int32, 2 26 | end 27 | add_message "tensorflow.CostGraphDef.Node.OutputInfo" do 28 | optional :size, :int64, 1 29 | optional :alias_input_port, :int64, 2 30 | optional :shape, :message, 3, "tensorflow.TensorShapeProto" 31 | optional :dtype, :enum, 4, "tensorflow.DataType" 32 | end 33 | end 34 | 35 | module Tensorflow 36 | CostGraphDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CostGraphDef").msgclass 37 | CostGraphDef::Node = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CostGraphDef.Node").msgclass 38 | CostGraphDef::Node::InputInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CostGraphDef.Node.InputInfo").msgclass 39 | CostGraphDef::Node::OutputInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CostGraphDef.Node.OutputInfo").msgclass 40 | end 41 | -------------------------------------------------------------------------------- /lib/tensorflow/core/example/example_parser_configuration_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/example/example_parser_configuration.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/tensor_shape_pb' 7 | require 'tensorflow/core/framework/tensor_pb' 8 | require 'tensorflow/core/framework/types_pb' 9 | Google::Protobuf::DescriptorPool.generated_pool.build do 10 | add_message "tensorflow.VarLenFeatureProto" do 11 | optional :dtype, :enum, 1, "tensorflow.DataType" 12 | optional :values_output_tensor_name, :string, 2 13 | optional :indices_output_tensor_name, :string, 3 14 | optional :shapes_output_tensor_name, :string, 4 15 | end 16 | add_message "tensorflow.FixedLenFeatureProto" do 17 | optional :dtype, :enum, 1, "tensorflow.DataType" 18 | optional :shape, :message, 2, "tensorflow.TensorShapeProto" 19 | optional :default_value, :message, 3, "tensorflow.TensorProto" 20 | optional :values_output_tensor_name, :string, 4 21 | end 22 | add_message "tensorflow.FeatureConfiguration" do 23 | oneof :config do 24 | optional :fixed_len_feature, :message, 1, "tensorflow.FixedLenFeatureProto" 25 | optional :var_len_feature, :message, 2, "tensorflow.VarLenFeatureProto" 26 | end 27 | end 28 | add_message "tensorflow.ExampleParserConfiguration" do 29 | map :feature_map, :string, :message, 1, "tensorflow.FeatureConfiguration" 30 | end 31 | end 32 | 33 | module Tensorflow 34 | VarLenFeatureProto = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.VarLenFeatureProto").msgclass 35 | FixedLenFeatureProto = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FixedLenFeatureProto").msgclass 36 | FeatureConfiguration = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.FeatureConfiguration").msgclass 37 | ExampleParserConfiguration = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.ExampleParserConfiguration").msgclass 38 | end 39 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/step_stats_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/step_stats.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/allocation_description_pb' 7 | require 'tensorflow/core/framework/tensor_description_pb' 8 | Google::Protobuf::DescriptorPool.generated_pool.build do 9 | add_message "tensorflow.AllocatorMemoryUsed" do 10 | optional :allocator_name, :string, 1 11 | optional :total_bytes, :int64, 2 12 | optional :peak_bytes, :int64, 3 13 | end 14 | add_message "tensorflow.NodeOutput" do 15 | optional :slot, :int32, 1 16 | optional :tensor_description, :message, 3, "tensorflow.TensorDescription" 17 | end 18 | add_message "tensorflow.NodeExecStats" do 19 | optional :node_name, :string, 1 20 | optional :all_start_micros, :int64, 2 21 | optional :op_start_rel_micros, :int64, 3 22 | optional :op_end_rel_micros, :int64, 4 23 | optional :all_end_rel_micros, :int64, 5 24 | repeated :memory, :message, 6, "tensorflow.AllocatorMemoryUsed" 25 | repeated :output, :message, 7, "tensorflow.NodeOutput" 26 | optional :timeline_label, :string, 8 27 | optional :scheduled_micros, :int64, 9 28 | optional :thread_id, :uint32, 10 29 | repeated :referenced_tensor, :message, 11, "tensorflow.AllocationDescription" 30 | end 31 | add_message "tensorflow.DeviceStepStats" do 32 | optional :device, :string, 1 33 | repeated :node_stats, :message, 2, "tensorflow.NodeExecStats" 34 | end 35 | add_message "tensorflow.StepStats" do 36 | repeated :dev_stats, :message, 1, "tensorflow.DeviceStepStats" 37 | end 38 | end 39 | 40 | module Tensorflow 41 | AllocatorMemoryUsed = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.AllocatorMemoryUsed").msgclass 42 | NodeOutput = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.NodeOutput").msgclass 43 | NodeExecStats = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.NodeExecStats").msgclass 44 | DeviceStepStats = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeviceStepStats").msgclass 45 | StepStats = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.StepStats").msgclass 46 | end 47 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/log_memory_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/log_memory.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/tensor_description_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | add_message "tensorflow.MemoryLogStep" do 9 | optional :step_id, :int64, 1 10 | optional :handle, :string, 2 11 | end 12 | add_message "tensorflow.MemoryLogTensorAllocation" do 13 | optional :step_id, :int64, 1 14 | optional :kernel_name, :string, 2 15 | optional :tensor, :message, 3, "tensorflow.TensorDescription" 16 | end 17 | add_message "tensorflow.MemoryLogTensorDeallocation" do 18 | optional :allocation_id, :int64, 1 19 | optional :allocator_name, :string, 2 20 | end 21 | add_message "tensorflow.MemoryLogTensorOutput" do 22 | optional :step_id, :int64, 1 23 | optional :kernel_name, :string, 2 24 | optional :index, :int32, 3 25 | optional :tensor, :message, 4, "tensorflow.TensorDescription" 26 | end 27 | add_message "tensorflow.MemoryLogRawAllocation" do 28 | optional :step_id, :int64, 1 29 | optional :operation, :string, 2 30 | optional :num_bytes, :int64, 3 31 | optional :ptr, :uint64, 4 32 | optional :allocation_id, :int64, 5 33 | optional :allocator_name, :string, 6 34 | end 35 | add_message "tensorflow.MemoryLogRawDeallocation" do 36 | optional :step_id, :int64, 1 37 | optional :operation, :string, 2 38 | optional :allocation_id, :int64, 3 39 | optional :allocator_name, :string, 4 40 | optional :deferred, :bool, 5 41 | end 42 | end 43 | 44 | module Tensorflow 45 | MemoryLogStep = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemoryLogStep").msgclass 46 | MemoryLogTensorAllocation = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemoryLogTensorAllocation").msgclass 47 | MemoryLogTensorDeallocation = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemoryLogTensorDeallocation").msgclass 48 | MemoryLogTensorOutput = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemoryLogTensorOutput").msgclass 49 | MemoryLogRawAllocation = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemoryLogRawAllocation").msgclass 50 | MemoryLogRawDeallocation = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemoryLogRawDeallocation").msgclass 51 | end 52 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/op_def_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/op_def.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/attr_value_pb' 7 | require 'tensorflow/core/framework/types_pb' 8 | Google::Protobuf::DescriptorPool.generated_pool.build do 9 | add_message "tensorflow.OpDef" do 10 | optional :name, :string, 1 11 | repeated :input_arg, :message, 2, "tensorflow.OpDef.ArgDef" 12 | repeated :output_arg, :message, 3, "tensorflow.OpDef.ArgDef" 13 | repeated :attr, :message, 4, "tensorflow.OpDef.AttrDef" 14 | optional :deprecation, :message, 8, "tensorflow.OpDeprecation" 15 | optional :summary, :string, 5 16 | optional :description, :string, 6 17 | optional :is_commutative, :bool, 18 18 | optional :is_aggregate, :bool, 16 19 | optional :is_stateful, :bool, 17 20 | optional :allows_uninitialized_input, :bool, 19 21 | end 22 | add_message "tensorflow.OpDef.ArgDef" do 23 | optional :name, :string, 1 24 | optional :description, :string, 2 25 | optional :type, :enum, 3, "tensorflow.DataType" 26 | optional :type_attr, :string, 4 27 | optional :number_attr, :string, 5 28 | optional :type_list_attr, :string, 6 29 | optional :is_ref, :bool, 16 30 | end 31 | add_message "tensorflow.OpDef.AttrDef" do 32 | optional :name, :string, 1 33 | optional :type, :string, 2 34 | optional :default_value, :message, 3, "tensorflow.AttrValue" 35 | optional :description, :string, 4 36 | optional :has_minimum, :bool, 5 37 | optional :minimum, :int64, 6 38 | optional :allowed_values, :message, 7, "tensorflow.AttrValue" 39 | end 40 | add_message "tensorflow.OpDeprecation" do 41 | optional :version, :int32, 1 42 | optional :explanation, :string, 2 43 | end 44 | add_message "tensorflow.OpList" do 45 | repeated :op, :message, 1, "tensorflow.OpDef" 46 | end 47 | end 48 | 49 | module Tensorflow 50 | OpDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.OpDef").msgclass 51 | OpDef::ArgDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.OpDef.ArgDef").msgclass 52 | OpDef::AttrDef = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.OpDef.AttrDef").msgclass 53 | OpDeprecation = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.OpDeprecation").msgclass 54 | OpList = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.OpList").msgclass 55 | end 56 | -------------------------------------------------------------------------------- /lib/tensorflow/core/framework/summary_pb.rb: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: tensorflow/core/framework/summary.proto 3 | 4 | require 'google/protobuf' 5 | 6 | require 'tensorflow/core/framework/tensor_pb' 7 | Google::Protobuf::DescriptorPool.generated_pool.build do 8 | add_message "tensorflow.SummaryDescription" do 9 | optional :type_hint, :string, 1 10 | end 11 | add_message "tensorflow.HistogramProto" do 12 | optional :min, :double, 1 13 | optional :max, :double, 2 14 | optional :num, :double, 3 15 | optional :sum, :double, 4 16 | optional :sum_squares, :double, 5 17 | repeated :bucket_limit, :double, 6 18 | repeated :bucket, :double, 7 19 | end 20 | add_message "tensorflow.Summary" do 21 | repeated :value, :message, 1, "tensorflow.Summary.Value" 22 | end 23 | add_message "tensorflow.Summary.Image" do 24 | optional :height, :int32, 1 25 | optional :width, :int32, 2 26 | optional :colorspace, :int32, 3 27 | optional :encoded_image_string, :bytes, 4 28 | end 29 | add_message "tensorflow.Summary.Audio" do 30 | optional :sample_rate, :float, 1 31 | optional :num_channels, :int64, 2 32 | optional :length_frames, :int64, 3 33 | optional :encoded_audio_string, :bytes, 4 34 | optional :content_type, :string, 5 35 | end 36 | add_message "tensorflow.Summary.Value" do 37 | optional :node_name, :string, 7 38 | optional :tag, :string, 1 39 | oneof :value do 40 | optional :simple_value, :float, 2 41 | optional :obsolete_old_style_histogram, :bytes, 3 42 | optional :image, :message, 4, "tensorflow.Summary.Image" 43 | optional :histo, :message, 5, "tensorflow.HistogramProto" 44 | optional :audio, :message, 6, "tensorflow.Summary.Audio" 45 | optional :tensor, :message, 8, "tensorflow.TensorProto" 46 | end 47 | end 48 | end 49 | 50 | module Tensorflow 51 | SummaryDescription = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SummaryDescription").msgclass 52 | HistogramProto = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.HistogramProto").msgclass 53 | Summary = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Summary").msgclass 54 | Summary::Image = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Summary.Image").msgclass 55 | Summary::Audio = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Summary.Audio").msgclass 56 | Summary::Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Summary.Value").msgclass 57 | end 58 | --------------------------------------------------------------------------------