tensorflow-ruby 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +18 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +104 -0
  5. data/lib/datasets/download_manager.rb +49 -0
  6. data/lib/datasets/images/mnist.rb +54 -0
  7. data/lib/datasets/resource.rb +19 -0
  8. data/lib/tensorflow-ruby.rb +182 -0
  9. data/lib/tensorflow.rb +1 -0
  10. data/lib/tensorflow/batchable_type_spec.rb +4 -0
  11. data/lib/tensorflow/core/framework/allocation_description_pb.rb +21 -0
  12. data/lib/tensorflow/core/framework/api_def_pb.rb +59 -0
  13. data/lib/tensorflow/core/framework/attr_value_pb.rb +46 -0
  14. data/lib/tensorflow/core/framework/cost_graph_pb.rb +49 -0
  15. data/lib/tensorflow/core/framework/device_attributes_pb.rb +37 -0
  16. data/lib/tensorflow/core/framework/function_pb.rb +38 -0
  17. data/lib/tensorflow/core/framework/graph_pb.rb +22 -0
  18. data/lib/tensorflow/core/framework/graph_transfer_info_pb.rb +73 -0
  19. data/lib/tensorflow/core/framework/kernel_def_pb.rb +31 -0
  20. data/lib/tensorflow/core/framework/log_memory_pb.rb +53 -0
  21. data/lib/tensorflow/core/framework/node_def_pb.rb +27 -0
  22. data/lib/tensorflow/core/framework/op_def_pb.rb +58 -0
  23. data/lib/tensorflow/core/framework/reader_base_pb.rb +19 -0
  24. data/lib/tensorflow/core/framework/remote_fused_graph_execute_info_pb.rb +30 -0
  25. data/lib/tensorflow/core/framework/resource_handle_pb.rb +28 -0
  26. data/lib/tensorflow/core/framework/step_stats_pb.rb +72 -0
  27. data/lib/tensorflow/core/framework/summary_pb.rb +71 -0
  28. data/lib/tensorflow/core/framework/tensor_description_pb.rb +21 -0
  29. data/lib/tensorflow/core/framework/tensor_pb.rb +41 -0
  30. data/lib/tensorflow/core/framework/tensor_shape_pb.rb +22 -0
  31. data/lib/tensorflow/core/framework/tensor_slice_pb.rb +23 -0
  32. data/lib/tensorflow/core/framework/types_pb.rb +62 -0
  33. data/lib/tensorflow/core/framework/variable_pb.rb +45 -0
  34. data/lib/tensorflow/core/framework/versions_pb.rb +18 -0
  35. data/lib/tensorflow/core/lib/core/error_codes_pb.rb +35 -0
  36. data/lib/tensorflow/core/protobuf/cluster_pb.rb +21 -0
  37. data/lib/tensorflow/core/protobuf/config_pb.rb +180 -0
  38. data/lib/tensorflow/core/protobuf/control_flow_pb.rb +48 -0
  39. data/lib/tensorflow/core/protobuf/conv_autotuning_pb.rb +29 -0
  40. data/lib/tensorflow/core/protobuf/critical_section_pb.rb +21 -0
  41. data/lib/tensorflow/core/protobuf/debug_pb.rb +38 -0
  42. data/lib/tensorflow/core/protobuf/device_properties_pb.rb +33 -0
  43. data/lib/tensorflow/core/protobuf/eager_service_pb.rb +112 -0
  44. data/lib/tensorflow/core/protobuf/graph_debug_info_pb.rb +29 -0
  45. data/lib/tensorflow/core/protobuf/master_pb.rb +123 -0
  46. data/lib/tensorflow/core/protobuf/master_service_pb.rb +15 -0
  47. data/lib/tensorflow/core/protobuf/meta_graph_pb.rb +95 -0
  48. data/lib/tensorflow/core/protobuf/named_tensor_pb.rb +18 -0
  49. data/lib/tensorflow/core/protobuf/queue_runner_pb.rb +21 -0
  50. data/lib/tensorflow/core/protobuf/replay_log_pb.rb +48 -0
  51. data/lib/tensorflow/core/protobuf/rewriter_config_pb.rb +81 -0
  52. data/lib/tensorflow/core/protobuf/saved_model_pb.rb +18 -0
  53. data/lib/tensorflow/core/protobuf/saved_object_graph_pb.rb +87 -0
  54. data/lib/tensorflow/core/protobuf/saver_pb.rb +28 -0
  55. data/lib/tensorflow/core/protobuf/struct_pb.rb +81 -0
  56. data/lib/tensorflow/core/protobuf/tensor_bundle_pb.rb +37 -0
  57. data/lib/tensorflow/core/protobuf/tensorflow_server_pb.rb +22 -0
  58. data/lib/tensorflow/core/protobuf/trace_events_pb.rb +39 -0
  59. data/lib/tensorflow/core/protobuf/trackable_object_graph_pb.rb +40 -0
  60. data/lib/tensorflow/core/protobuf/transport_options_pb.rb +16 -0
  61. data/lib/tensorflow/core/protobuf/verifier_config_pb.rb +23 -0
  62. data/lib/tensorflow/core/protobuf/worker_pb.rb +246 -0
  63. data/lib/tensorflow/core/protobuf/worker_service_pb.rb +15 -0
  64. data/lib/tensorflow/core/util/event_pb.rb +93 -0
  65. data/lib/tensorflow/core/util/memmapped_file_system_pb.rb +22 -0
  66. data/lib/tensorflow/core/util/saved_tensor_slice_pb.rb +40 -0
  67. data/lib/tensorflow/data/batch_dataset.rb +18 -0
  68. data/lib/tensorflow/data/dataset.rb +106 -0
  69. data/lib/tensorflow/data/fixed_length_record_dataset.rb +27 -0
  70. data/lib/tensorflow/data/iterator.rb +76 -0
  71. data/lib/tensorflow/data/map_dataset.rb +17 -0
  72. data/lib/tensorflow/data/repeat_dataset.rb +16 -0
  73. data/lib/tensorflow/data/shuffle_dataset.rb +23 -0
  74. data/lib/tensorflow/data/tensor_dataset.rb +19 -0
  75. data/lib/tensorflow/data/tensor_slice_dataset.rb +15 -0
  76. data/lib/tensorflow/data/tf_record_dataset.rb +18 -0
  77. data/lib/tensorflow/data/zip_dataset.rb +24 -0
  78. data/lib/tensorflow/decorators.rb +53 -0
  79. data/lib/tensorflow/eager/context.rb +120 -0
  80. data/lib/tensorflow/eager/operation.rb +219 -0
  81. data/lib/tensorflow/eager/tensor_handle.rb +87 -0
  82. data/lib/tensorflow/error.rb +54 -0
  83. data/lib/tensorflow/execution_context.rb +62 -0
  84. data/lib/tensorflow/extensions/arg_def.rb +58 -0
  85. data/lib/tensorflow/extensions/array.rb +17 -0
  86. data/lib/tensorflow/extensions/boolean.rb +25 -0
  87. data/lib/tensorflow/extensions/narray.rb +7 -0
  88. data/lib/tensorflow/ffi.rb +291 -0
  89. data/lib/tensorflow/graph/function.rb +33 -0
  90. data/lib/tensorflow/graph/function_def.rb +62 -0
  91. data/lib/tensorflow/graph/gradients.rb +120 -0
  92. data/lib/tensorflow/graph/graph.rb +252 -0
  93. data/lib/tensorflow/graph/graph_def_options.rb +24 -0
  94. data/lib/tensorflow/graph/graph_keys.rb +50 -0
  95. data/lib/tensorflow/graph/operation.rb +176 -0
  96. data/lib/tensorflow/graph/operation_attr.rb +153 -0
  97. data/lib/tensorflow/graph/operation_description.rb +255 -0
  98. data/lib/tensorflow/graph/operation_output.rb +49 -0
  99. data/lib/tensorflow/graph/session.rb +156 -0
  100. data/lib/tensorflow/keras/datasets/boston_housing.rb +32 -0
  101. data/lib/tensorflow/keras/datasets/cifar10.rb +11 -0
  102. data/lib/tensorflow/keras/datasets/cifar100.rb +11 -0
  103. data/lib/tensorflow/keras/datasets/fashion_mnist.rb +44 -0
  104. data/lib/tensorflow/keras/datasets/imdb.rb +30 -0
  105. data/lib/tensorflow/keras/datasets/mnist.rb +18 -0
  106. data/lib/tensorflow/keras/datasets/reuters.rb +28 -0
  107. data/lib/tensorflow/keras/layers/conv.rb +14 -0
  108. data/lib/tensorflow/keras/layers/conv2d.rb +11 -0
  109. data/lib/tensorflow/keras/layers/dense.rb +68 -0
  110. data/lib/tensorflow/keras/layers/dropout.rb +27 -0
  111. data/lib/tensorflow/keras/layers/flatten.rb +25 -0
  112. data/lib/tensorflow/keras/losses/sparse_categorical_crossentropy.rb +14 -0
  113. data/lib/tensorflow/keras/metrics/mean.rb +30 -0
  114. data/lib/tensorflow/keras/metrics/sparse_categorical_accuracy.rb +17 -0
  115. data/lib/tensorflow/keras/model.rb +6 -0
  116. data/lib/tensorflow/keras/models/sequential.rb +56 -0
  117. data/lib/tensorflow/keras/optimizers/adam.rb +8 -0
  118. data/lib/tensorflow/keras/preprocessing/image.rb +22 -0
  119. data/lib/tensorflow/keras/utils.rb +83 -0
  120. data/lib/tensorflow/name_scope.rb +57 -0
  121. data/lib/tensorflow/op_def_builder.rb +49 -0
  122. data/lib/tensorflow/ops/audio.rb +13 -0
  123. data/lib/tensorflow/ops/bitwise.rb +29 -0
  124. data/lib/tensorflow/ops/control.rb +13 -0
  125. data/lib/tensorflow/ops/gradients.rb +21 -0
  126. data/lib/tensorflow/ops/image.rb +218 -0
  127. data/lib/tensorflow/ops/io.rb +123 -0
  128. data/lib/tensorflow/ops/linalg.rb +131 -0
  129. data/lib/tensorflow/ops/math.rb +493 -0
  130. data/lib/tensorflow/ops/nn.rb +286 -0
  131. data/lib/tensorflow/ops/operators.rb +31 -0
  132. data/lib/tensorflow/ops/ops.rb +102 -0
  133. data/lib/tensorflow/ops/random.rb +18 -0
  134. data/lib/tensorflow/ops/raw_ops.rb +5179 -0
  135. data/lib/tensorflow/ops/raw_ops.rb.erb +38 -0
  136. data/lib/tensorflow/printers/graph.erb +80 -0
  137. data/lib/tensorflow/printers/graph.rb +26 -0
  138. data/lib/tensorflow/printers/graph_def.erb +109 -0
  139. data/lib/tensorflow/printers/graph_def.rb +26 -0
  140. data/lib/tensorflow/python_compatiblity.rb +55 -0
  141. data/lib/tensorflow/resource_summary_writer.rb +78 -0
  142. data/lib/tensorflow/status.rb +49 -0
  143. data/lib/tensorflow/stream_executor/dnn_pb.rb +90 -0
  144. data/lib/tensorflow/strings.rb +100 -0
  145. data/lib/tensorflow/summary.rb +13 -0
  146. data/lib/tensorflow/tensor.rb +133 -0
  147. data/lib/tensorflow/tensor_data.rb +310 -0
  148. data/lib/tensorflow/tensor_mixin.rb +32 -0
  149. data/lib/tensorflow/tensor_spec.rb +10 -0
  150. data/lib/tensorflow/tensorflow/core/util/event_pb.rb +93 -0
  151. data/lib/tensorflow/train/gradient_descent_optimizer.rb +33 -0
  152. data/lib/tensorflow/train/optimizer.rb +158 -0
  153. data/lib/tensorflow/type_spec.rb +4 -0
  154. data/lib/tensorflow/variable.rb +127 -0
  155. data/lib/tensorflow/version.rb +3 -0
  156. metadata +308 -0
@@ -0,0 +1,23 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: tensorflow/core/protobuf/verifier_config.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("tensorflow/core/protobuf/verifier_config.proto", :syntax => :proto3) do
8
+ add_message "tensorflow.VerifierConfig" do
9
+ optional :verification_timeout_in_ms, :int64, 1
10
+ optional :structure_verifier, :enum, 2, "tensorflow.VerifierConfig.Toggle"
11
+ end
12
+ add_enum "tensorflow.VerifierConfig.Toggle" do
13
+ value :DEFAULT, 0
14
+ value :ON, 1
15
+ value :OFF, 2
16
+ end
17
+ end
18
+ end
19
+
20
+ module Tensorflow
21
+ VerifierConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.VerifierConfig").msgclass
22
+ VerifierConfig::Toggle = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.VerifierConfig.Toggle").enummodule
23
+ end
@@ -0,0 +1,246 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: tensorflow/core/protobuf/worker.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/any_pb'
7
+ require 'tensorflow/core/framework/cost_graph_pb'
8
+ require 'tensorflow/core/framework/device_attributes_pb'
9
+ require 'tensorflow/core/framework/graph_pb'
10
+ require 'tensorflow/core/framework/step_stats_pb'
11
+ require 'tensorflow/core/framework/tensor_pb'
12
+ require 'tensorflow/core/framework/tensor_shape_pb'
13
+ require 'tensorflow/core/framework/types_pb'
14
+ require 'tensorflow/core/lib/core/error_codes_pb'
15
+ require 'tensorflow/core/protobuf/config_pb'
16
+ require 'tensorflow/core/protobuf/debug_pb'
17
+ require 'tensorflow/core/protobuf/named_tensor_pb'
18
+ require 'tensorflow/core/protobuf/tensorflow_server_pb'
19
+ Google::Protobuf::DescriptorPool.generated_pool.build do
20
+ add_file("tensorflow/core/protobuf/worker.proto", :syntax => :proto3) do
21
+ add_message "tensorflow.GetStatusRequest" do
22
+ end
23
+ add_message "tensorflow.GetStatusResponse" do
24
+ repeated :device_attributes, :message, 1, "tensorflow.DeviceAttributes"
25
+ end
26
+ add_message "tensorflow.CreateWorkerSessionRequest" do
27
+ optional :session_handle, :string, 1
28
+ optional :server_def, :message, 2, "tensorflow.ServerDef"
29
+ optional :isolate_session_state, :bool, 3
30
+ repeated :cluster_device_attributes, :message, 4, "tensorflow.DeviceAttributes"
31
+ end
32
+ add_message "tensorflow.CreateWorkerSessionResponse" do
33
+ end
34
+ add_message "tensorflow.DeleteWorkerSessionRequest" do
35
+ optional :session_handle, :string, 1
36
+ end
37
+ add_message "tensorflow.DeleteWorkerSessionResponse" do
38
+ end
39
+ add_message "tensorflow.RegisterGraphRequest" do
40
+ optional :session_handle, :string, 1
41
+ optional :create_worker_session_called, :bool, 6
42
+ optional :graph_def, :message, 2, "tensorflow.GraphDef"
43
+ optional :has_control_flow, :bool, 3
44
+ optional :graph_options, :message, 4, "tensorflow.GraphOptions"
45
+ optional :debug_options, :message, 5, "tensorflow.DebugOptions"
46
+ optional :collective_graph_key, :int64, 7
47
+ end
48
+ add_message "tensorflow.RegisterGraphResponse" do
49
+ optional :graph_handle, :string, 1
50
+ end
51
+ add_message "tensorflow.DeregisterGraphRequest" do
52
+ optional :session_handle, :string, 2
53
+ optional :create_worker_session_called, :bool, 3
54
+ optional :graph_handle, :string, 1
55
+ end
56
+ add_message "tensorflow.DeregisterGraphResponse" do
57
+ end
58
+ add_message "tensorflow.CleanupAllRequest" do
59
+ repeated :container, :string, 1
60
+ end
61
+ add_message "tensorflow.CleanupAllResponse" do
62
+ end
63
+ add_message "tensorflow.ExecutorOpts" do
64
+ optional :record_costs, :bool, 1
65
+ optional :record_timeline, :bool, 3
66
+ optional :record_partition_graphs, :bool, 4
67
+ optional :report_tensor_allocations_upon_oom, :bool, 5
68
+ end
69
+ add_message "tensorflow.RunGraphRequest" do
70
+ optional :session_handle, :string, 8
71
+ optional :create_worker_session_called, :bool, 10
72
+ optional :graph_handle, :string, 1
73
+ optional :step_id, :int64, 2
74
+ optional :exec_opts, :message, 5, "tensorflow.ExecutorOpts"
75
+ repeated :send, :message, 3, "tensorflow.NamedTensorProto"
76
+ repeated :recv_key, :string, 4
77
+ optional :is_partial, :bool, 6
78
+ optional :is_last_partial_run, :bool, 7
79
+ optional :store_errors_in_response_body, :bool, 9
80
+ optional :request_id, :int64, 11
81
+ end
82
+ add_message "tensorflow.RunGraphResponse" do
83
+ repeated :recv, :message, 1, "tensorflow.NamedTensorProto"
84
+ optional :step_stats, :message, 2, "tensorflow.StepStats"
85
+ optional :cost_graph, :message, 3, "tensorflow.CostGraphDef"
86
+ repeated :partition_graph, :message, 4, "tensorflow.GraphDef"
87
+ optional :status_code, :enum, 5, "tensorflow.error.Code"
88
+ optional :status_error_message, :string, 6
89
+ end
90
+ add_message "tensorflow.CleanupGraphRequest" do
91
+ optional :step_id, :int64, 1
92
+ end
93
+ add_message "tensorflow.CleanupGraphResponse" do
94
+ end
95
+ add_message "tensorflow.RecvTensorRequest" do
96
+ optional :step_id, :int64, 1
97
+ optional :rendezvous_key, :string, 2
98
+ optional :dma_ok, :bool, 3
99
+ optional :client_locality, :message, 4, "tensorflow.DeviceLocality"
100
+ optional :server_locality, :message, 5, "tensorflow.DeviceLocality"
101
+ optional :transport_options, :message, 6, "google.protobuf.Any"
102
+ optional :request_id, :int64, 7
103
+ end
104
+ add_message "tensorflow.RecvTensorResponse" do
105
+ optional :tensor, :message, 1, "tensorflow.TensorProto"
106
+ optional :is_dead, :bool, 2
107
+ optional :send_start_micros, :int64, 3
108
+ optional :transport_options, :message, 4, "google.protobuf.Any"
109
+ optional :require_ack, :bool, 5
110
+ end
111
+ add_message "tensorflow.MarkRecvFinishedRequest" do
112
+ optional :request_id, :int64, 1
113
+ end
114
+ add_message "tensorflow.MarkRecvFinishedResponse" do
115
+ end
116
+ add_message "tensorflow.LoggingRequest" do
117
+ optional :enable_rpc_logging, :bool, 1
118
+ optional :disable_rpc_logging, :bool, 4
119
+ optional :clear, :bool, 2
120
+ repeated :fetch_step_id, :int64, 3
121
+ end
122
+ add_message "tensorflow.LabeledStepStats" do
123
+ optional :step_id, :int64, 1
124
+ optional :step_stats, :message, 2, "tensorflow.StepStats"
125
+ end
126
+ add_message "tensorflow.LoggingResponse" do
127
+ repeated :step, :message, 1, "tensorflow.LabeledStepStats"
128
+ end
129
+ add_message "tensorflow.TraceOpts" do
130
+ optional :duration, :double, 1
131
+ optional :use_step_profiler, :bool, 2
132
+ optional :use_kernel_profiler, :bool, 3
133
+ optional :use_extended_profiler, :bool, 4
134
+ optional :use_gpu_profiler, :bool, 5
135
+ optional :use_sample_profiler, :bool, 6
136
+ end
137
+ add_message "tensorflow.TracingRequest" do
138
+ optional :options, :message, 1, "tensorflow.TraceOpts"
139
+ end
140
+ add_message "tensorflow.TracingResponse" do
141
+ end
142
+ add_message "tensorflow.RecvBufRequest" do
143
+ optional :step_id, :int64, 1
144
+ optional :buf_rendezvous_key, :string, 2
145
+ optional :num_bytes, :int64, 3
146
+ optional :buf_ptr, :fixed64, 4
147
+ optional :client_locality, :message, 5, "tensorflow.DeviceLocality"
148
+ optional :server_locality, :message, 6, "tensorflow.DeviceLocality"
149
+ optional :transport_options, :message, 7, "google.protobuf.Any"
150
+ optional :src_device, :string, 8
151
+ optional :dst_device, :string, 9
152
+ optional :request_id, :int64, 10
153
+ optional :src_incarnation, :uint64, 11
154
+ end
155
+ add_message "tensorflow.RecvBufResponse" do
156
+ optional :buf_ptr, :fixed64, 1
157
+ optional :num_bytes, :int64, 2
158
+ optional :is_dead, :bool, 3
159
+ optional :transport_options, :message, 4, "google.protobuf.Any"
160
+ optional :send_start_micros, :int64, 5
161
+ optional :require_ack, :bool, 6
162
+ end
163
+ add_message "tensorflow.CompleteGroupRequest" do
164
+ optional :group_key, :int32, 1
165
+ optional :group_size, :int32, 2
166
+ optional :device_type, :string, 3
167
+ repeated :device_name, :string, 4
168
+ optional :collective_type, :int32, 5
169
+ end
170
+ add_message "tensorflow.CompleteGroupResponse" do
171
+ optional :group_key, :int32, 1
172
+ optional :group_size, :int32, 2
173
+ optional :device_type, :string, 3
174
+ optional :num_tasks, :int32, 4
175
+ repeated :device_name, :string, 5
176
+ repeated :task_name, :string, 6
177
+ optional :communicator_key, :bytes, 7
178
+ end
179
+ add_message "tensorflow.CompleteInstanceRequest" do
180
+ optional :name, :string, 1
181
+ optional :type, :int32, 2
182
+ optional :data_type, :enum, 3, "tensorflow.DataType"
183
+ optional :shape, :message, 4, "tensorflow.TensorShapeProto"
184
+ optional :group_key, :int32, 5
185
+ optional :group_size, :int32, 6
186
+ optional :instance_key, :int32, 7
187
+ optional :device_type, :string, 8
188
+ repeated :subdiv_offset, :int32, 9
189
+ optional :device, :string, 10
190
+ optional :is_source, :bool, 11
191
+ end
192
+ add_message "tensorflow.CompleteInstanceResponse" do
193
+ optional :instance_key, :int32, 1
194
+ optional :source_rank, :int32, 2
195
+ end
196
+ add_message "tensorflow.GetStepSequenceRequest" do
197
+ repeated :graph_key, :int64, 1
198
+ end
199
+ add_message "tensorflow.StepSequence" do
200
+ optional :graph_key, :int64, 1
201
+ optional :next_step_id, :int64, 2
202
+ end
203
+ add_message "tensorflow.GetStepSequenceResponse" do
204
+ repeated :step_sequence, :message, 1, "tensorflow.StepSequence"
205
+ end
206
+ end
207
+ end
208
+
209
+ module Tensorflow
210
+ GetStatusRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.GetStatusRequest").msgclass
211
+ GetStatusResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.GetStatusResponse").msgclass
212
+ CreateWorkerSessionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CreateWorkerSessionRequest").msgclass
213
+ CreateWorkerSessionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CreateWorkerSessionResponse").msgclass
214
+ DeleteWorkerSessionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeleteWorkerSessionRequest").msgclass
215
+ DeleteWorkerSessionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeleteWorkerSessionResponse").msgclass
216
+ RegisterGraphRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RegisterGraphRequest").msgclass
217
+ RegisterGraphResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RegisterGraphResponse").msgclass
218
+ DeregisterGraphRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeregisterGraphRequest").msgclass
219
+ DeregisterGraphResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.DeregisterGraphResponse").msgclass
220
+ CleanupAllRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CleanupAllRequest").msgclass
221
+ CleanupAllResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CleanupAllResponse").msgclass
222
+ ExecutorOpts = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.ExecutorOpts").msgclass
223
+ RunGraphRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RunGraphRequest").msgclass
224
+ RunGraphResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RunGraphResponse").msgclass
225
+ CleanupGraphRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CleanupGraphRequest").msgclass
226
+ CleanupGraphResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CleanupGraphResponse").msgclass
227
+ RecvTensorRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RecvTensorRequest").msgclass
228
+ RecvTensorResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RecvTensorResponse").msgclass
229
+ MarkRecvFinishedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MarkRecvFinishedRequest").msgclass
230
+ MarkRecvFinishedResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MarkRecvFinishedResponse").msgclass
231
+ LoggingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.LoggingRequest").msgclass
232
+ LabeledStepStats = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.LabeledStepStats").msgclass
233
+ LoggingResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.LoggingResponse").msgclass
234
+ TraceOpts = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TraceOpts").msgclass
235
+ TracingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TracingRequest").msgclass
236
+ TracingResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TracingResponse").msgclass
237
+ RecvBufRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RecvBufRequest").msgclass
238
+ RecvBufResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RecvBufResponse").msgclass
239
+ CompleteGroupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CompleteGroupRequest").msgclass
240
+ CompleteGroupResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CompleteGroupResponse").msgclass
241
+ CompleteInstanceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CompleteInstanceRequest").msgclass
242
+ CompleteInstanceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.CompleteInstanceResponse").msgclass
243
+ GetStepSequenceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.GetStepSequenceRequest").msgclass
244
+ StepSequence = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.StepSequence").msgclass
245
+ GetStepSequenceResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.GetStepSequenceResponse").msgclass
246
+ end
@@ -0,0 +1,15 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: tensorflow/core/protobuf/worker_service.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'tensorflow/core/protobuf/worker_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_file("tensorflow/core/protobuf/worker_service.proto", :syntax => :proto3) do
9
+ end
10
+ end
11
+
12
+ module Tensorflow
13
+ module Grpc
14
+ end
15
+ end
@@ -0,0 +1,93 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: tensorflow/core/util/event.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'tensorflow/core/framework/summary_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_file("tensorflow/core/util/event.proto", :syntax => :proto3) do
9
+ add_message "tensorflow.Event" do
10
+ optional :wall_time, :double, 1
11
+ optional :step, :int64, 2
12
+ oneof :what do
13
+ optional :file_version, :string, 3
14
+ optional :graph_def, :bytes, 4
15
+ optional :summary, :message, 5, "tensorflow.Summary"
16
+ optional :log_message, :message, 6, "tensorflow.LogMessage"
17
+ optional :session_log, :message, 7, "tensorflow.SessionLog"
18
+ optional :tagged_run_metadata, :message, 8, "tensorflow.TaggedRunMetadata"
19
+ optional :meta_graph_def, :bytes, 9
20
+ end
21
+ end
22
+ add_message "tensorflow.LogMessage" do
23
+ optional :level, :enum, 1, "tensorflow.LogMessage.Level"
24
+ optional :message, :string, 2
25
+ end
26
+ add_enum "tensorflow.LogMessage.Level" do
27
+ value :UNKNOWN, 0
28
+ value :DEBUGGING, 10
29
+ value :INFO, 20
30
+ value :WARN, 30
31
+ value :ERROR, 40
32
+ value :FATAL, 50
33
+ end
34
+ add_message "tensorflow.SessionLog" do
35
+ optional :status, :enum, 1, "tensorflow.SessionLog.SessionStatus"
36
+ optional :checkpoint_path, :string, 2
37
+ optional :msg, :string, 3
38
+ end
39
+ add_enum "tensorflow.SessionLog.SessionStatus" do
40
+ value :STATUS_UNSPECIFIED, 0
41
+ value :START, 1
42
+ value :STOP, 2
43
+ value :CHECKPOINT, 3
44
+ end
45
+ add_message "tensorflow.TaggedRunMetadata" do
46
+ optional :tag, :string, 1
47
+ optional :run_metadata, :bytes, 2
48
+ end
49
+ add_message "tensorflow.WatchdogConfig" do
50
+ optional :timeout_ms, :int64, 1
51
+ end
52
+ add_message "tensorflow.RequestedExitCode" do
53
+ optional :exit_code, :int32, 1
54
+ end
55
+ add_message "tensorflow.WorkerHeartbeatRequest" do
56
+ optional :shutdown_mode, :enum, 1, "tensorflow.WorkerShutdownMode"
57
+ optional :watchdog_config, :message, 2, "tensorflow.WatchdogConfig"
58
+ optional :exit_code, :message, 3, "tensorflow.RequestedExitCode"
59
+ end
60
+ add_message "tensorflow.WorkerHeartbeatResponse" do
61
+ optional :health_status, :enum, 1, "tensorflow.WorkerHealth"
62
+ repeated :worker_log, :message, 2, "tensorflow.Event"
63
+ optional :hostname, :string, 3
64
+ end
65
+ add_enum "tensorflow.WorkerHealth" do
66
+ value :OK, 0
67
+ value :RECEIVED_SHUTDOWN_SIGNAL, 1
68
+ value :INTERNAL_ERROR, 2
69
+ value :SHUTTING_DOWN, 3
70
+ end
71
+ add_enum "tensorflow.WorkerShutdownMode" do
72
+ value :DEFAULT, 0
73
+ value :NOT_CONFIGURED, 1
74
+ value :WAIT_FOR_COORDINATOR, 2
75
+ value :SHUTDOWN_AFTER_TIMEOUT, 3
76
+ end
77
+ end
78
+ end
79
+
80
+ module Tensorflow
81
+ Event = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.Event").msgclass
82
+ LogMessage = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.LogMessage").msgclass
83
+ LogMessage::Level = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.LogMessage.Level").enummodule
84
+ SessionLog = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SessionLog").msgclass
85
+ SessionLog::SessionStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SessionLog.SessionStatus").enummodule
86
+ TaggedRunMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.TaggedRunMetadata").msgclass
87
+ WatchdogConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.WatchdogConfig").msgclass
88
+ RequestedExitCode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.RequestedExitCode").msgclass
89
+ WorkerHeartbeatRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.WorkerHeartbeatRequest").msgclass
90
+ WorkerHeartbeatResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.WorkerHeartbeatResponse").msgclass
91
+ WorkerHealth = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.WorkerHealth").enummodule
92
+ WorkerShutdownMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.WorkerShutdownMode").enummodule
93
+ end
@@ -0,0 +1,22 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: tensorflow/core/util/memmapped_file_system.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_file("tensorflow/core/util/memmapped_file_system.proto", :syntax => :proto3) do
8
+ add_message "tensorflow.MemmappedFileSystemDirectoryElement" do
9
+ optional :offset, :uint64, 1
10
+ optional :name, :string, 2
11
+ optional :length, :uint64, 3
12
+ end
13
+ add_message "tensorflow.MemmappedFileSystemDirectory" do
14
+ repeated :element, :message, 1, "tensorflow.MemmappedFileSystemDirectoryElement"
15
+ end
16
+ end
17
+ end
18
+
19
+ module Tensorflow
20
+ MemmappedFileSystemDirectoryElement = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemmappedFileSystemDirectoryElement").msgclass
21
+ MemmappedFileSystemDirectory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.MemmappedFileSystemDirectory").msgclass
22
+ end
@@ -0,0 +1,40 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: tensorflow/core/util/saved_tensor_slice.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'tensorflow/core/framework/tensor_shape_pb'
7
+ require 'tensorflow/core/framework/tensor_slice_pb'
8
+ require 'tensorflow/core/framework/tensor_pb'
9
+ require 'tensorflow/core/framework/types_pb'
10
+ require 'tensorflow/core/framework/versions_pb'
11
+ Google::Protobuf::DescriptorPool.generated_pool.build do
12
+ add_file("tensorflow/core/util/saved_tensor_slice.proto", :syntax => :proto3) do
13
+ add_message "tensorflow.SavedSliceMeta" do
14
+ optional :name, :string, 1
15
+ optional :shape, :message, 2, "tensorflow.TensorShapeProto"
16
+ optional :type, :enum, 3, "tensorflow.DataType"
17
+ repeated :slice, :message, 4, "tensorflow.TensorSliceProto"
18
+ end
19
+ add_message "tensorflow.SavedTensorSliceMeta" do
20
+ repeated :tensor, :message, 1, "tensorflow.SavedSliceMeta"
21
+ optional :versions, :message, 2, "tensorflow.VersionDef"
22
+ end
23
+ add_message "tensorflow.SavedSlice" do
24
+ optional :name, :string, 1
25
+ optional :slice, :message, 2, "tensorflow.TensorSliceProto"
26
+ optional :data, :message, 3, "tensorflow.TensorProto"
27
+ end
28
+ add_message "tensorflow.SavedTensorSlices" do
29
+ optional :meta, :message, 1, "tensorflow.SavedTensorSliceMeta"
30
+ optional :data, :message, 2, "tensorflow.SavedSlice"
31
+ end
32
+ end
33
+ end
34
+
35
+ module Tensorflow
36
+ SavedSliceMeta = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SavedSliceMeta").msgclass
37
+ SavedTensorSliceMeta = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SavedTensorSliceMeta").msgclass
38
+ SavedSlice = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SavedSlice").msgclass
39
+ SavedTensorSlices = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("tensorflow.SavedTensorSlices").msgclass
40
+ end
@@ -0,0 +1,18 @@
1
+ module Tensorflow
2
+ module Data
3
+ class BatchDataset < Dataset
4
+ def initialize(input_dataset, batch_size, drop_remainder)
5
+ @input_dataset = input_dataset
6
+ @output_types = input_dataset.output_types
7
+ @output_shapes = input_dataset.output_shapes.map do |shape|
8
+ shape.unshift(-1)
9
+ end
10
+
11
+ batch_size = Tensor.new(batch_size, dtype: :int64)
12
+ variant_tensor = RawOps.batch_dataset_v2(input_dataset.variant_tensor, batch_size, drop_remainder,
13
+ output_types: @output_types, output_shapes: @output_shapes)
14
+ super(variant_tensor)
15
+ end
16
+ end
17
+ end
18
+ end