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,218 @@
1
+ module Tensorflow
2
+ module Image
3
+ class << self
4
+ # def adjust_brightness
5
+ # end
6
+
7
+ def adjust_contrast(images, contrast_factor, min_value, max_value)
8
+ RawOps.adjust_contrast(images, contrast_factor, min_value, max_value)
9
+ end
10
+
11
+ # def adjust_gamma
12
+ # end
13
+
14
+ def adjust_hue(images, delta)
15
+ RawOps.adjust_hue(images, delta)
16
+ end
17
+
18
+ # def adjust_jpeg_quality
19
+ # end
20
+
21
+ def adjust_saturation(images, scale)
22
+ RawOps.adjust_saturation(images, scale)
23
+ end
24
+
25
+ # def central_crop
26
+ # end
27
+
28
+ def combined_non_max_suppression(boxes, scores, max_output_size_per_class, max_total_size, iou_threshold, score_threshold, pad_per_class: nil, clip_boxes: nil)
29
+ RawOps.combined_non_max_suppression(boxes, scores, max_output_size_per_class, max_total_size, iou_threshold, score_threshold, pad_per_class: pad_per_class, clip_boxes: clip_boxes)
30
+ end
31
+
32
+ # def convert_image_dtype
33
+ # end
34
+
35
+ def crop_and_resize(image, boxes, box_ind, crop_size, method: nil, extrapolation_value: nil)
36
+ RawOps.crop_and_resize(image, boxes, box_ind, crop_size, method: method, extrapolation_value: extrapolation_value)
37
+ end
38
+
39
+ # def crop_to_bounding_box
40
+ # end
41
+
42
+ def decode_and_crop_jpeg(contents, crop_window, channels: nil, ratio: nil, fancy_upscaling: nil, try_recover_truncated: nil, acceptable_fraction: nil, dct_method: nil)
43
+ RawOps.decode_and_crop_jpeg(contents, crop_window, channels: channels, ratio: ratio, fancy_upscaling: fancy_upscaling, try_recover_truncated: try_recover_truncated, acceptable_fraction: acceptable_fraction, dct_method: dct_method)
44
+ end
45
+
46
+ def decode_bmp(contents, channels: nil)
47
+ RawOps.decode_bmp(contents: contents, channels: channels)
48
+ end
49
+
50
+ def decode_gif(contents)
51
+ RawOps.decode_gif(contents: contents)
52
+ end
53
+
54
+ # def decode_image
55
+ # end
56
+
57
+ def decode_jpeg(contents, channels: nil, ratio: nil, fancy_upscaling: nil, try_recover_truncated: nil, acceptable_fraction: nil, dct_method: nil)
58
+ RawOps.decode_jpeg(contents, channels: channels, ratio: ratio, fancy_upscaling: fancy_upscaling, try_recover_truncated: try_recover_truncated, acceptable_fraction: acceptable_fraction, dct_method: dct_method)
59
+ end
60
+
61
+ def decode_png(contents, channels: nil, dtype: nil)
62
+ RawOps.decode_png(contents, channels: channels, dtype: dtype)
63
+ end
64
+
65
+ def draw_bounding_boxes(images, boxes)
66
+ RawOps.draw_bounding_boxes(images, boxes)
67
+ end
68
+
69
+ def encode_jpeg(image, format: nil, quality: nil, progressive: nil, optimize_size: nil, chroma_downsampling: nil, density_unit: nil, x_density: nil, y_density: nil, xmp_metadata: nil)
70
+ RawOps.encode_jpeg(image, format: format, quality: quality, progressive: progressive, optimize_size: optimize_size, chroma_downsampling: chroma_downsampling, density_unit: density_unit, x_density: x_density, y_density: y_density, xmp_metadata: xmp_metadata)
71
+ end
72
+
73
+ def encode_png(image, compression: nil)
74
+ RawOps.encode_png(image, compression: compression)
75
+ end
76
+
77
+ def extract_glimpse(input, size, offsets, centered: nil, normalized: nil, uniform_noise: nil, noise: nil)
78
+ RawOps.extract_glimpse(input, size, offsets, centered: centered, normalized: normalized, uniform_noise: uniform_noise, noise: noise)
79
+ end
80
+
81
+ def extract_jpeg_shape(contents, output_type: nil)
82
+ RawOps.extract_jpeg_shape(contents: contents, output_type: output_type)
83
+ end
84
+
85
+ # def extract_patches
86
+ # end
87
+
88
+ # def flip_left_right
89
+ # end
90
+
91
+ # def flip_up_down
92
+ # end
93
+
94
+ # def grayscale_to_rgb
95
+ # end
96
+
97
+ def hsv_to_rgb(images)
98
+ RawOps.hsv_to_rgb(images: images)
99
+ end
100
+
101
+ # def image_gradients
102
+ # end
103
+
104
+ def is_jpeg(contents)
105
+ substr = Strings.substr(contents, 0, 3)
106
+ Math.equal(substr, "\xff\xd8\xff")
107
+ end
108
+
109
+ def non_max_suppression(boxes, scores, max_output_size, iou_threshold: nil)
110
+ RawOps.non_max_suppression(boxes, scores, max_output_size, iou_threshold: iou_threshold)
111
+ end
112
+
113
+ # def non_max_suppression_overlaps
114
+ # end
115
+
116
+ # def non_max_suppression_padded
117
+ # end
118
+
119
+ # def non_max_suppression_with_scores
120
+ # end
121
+
122
+ # def pad_to_bounding_box
123
+ # end
124
+
125
+ # def per_image_standardization
126
+ # end
127
+
128
+ # def psnr
129
+ # end
130
+
131
+ # def random_brightness
132
+ # end
133
+
134
+ # def random_contrast
135
+ # end
136
+
137
+ def random_crop(image, size, seed: nil, seed2: nil)
138
+ RawOps.random_crop(image, size, seed: seed, seed2: seed2)
139
+ end
140
+
141
+ # def random_flip_left_right
142
+ # end
143
+
144
+ # def random_flip_up_down
145
+ # end
146
+
147
+ # def random_hue
148
+ # end
149
+
150
+ # def random_jpeg_quality
151
+ # end
152
+
153
+ # def random_saturation
154
+ # end
155
+
156
+ def resize(images, size)
157
+ images = Tensor.from_value(images)
158
+
159
+ batch = images.shape.size != 3
160
+ images = Tensorflow.expand_dims(images, 0) unless batch
161
+
162
+ # TODO support more methods
163
+ images = RawOps.resize_bilinear(images, size)
164
+
165
+ images = Tensorflow.squeeze(images, axis: [0]) unless batch
166
+
167
+ images
168
+ end
169
+
170
+ # def resize_with_crop_or_pad
171
+ # end
172
+
173
+ # def resize_with_pad
174
+ # end
175
+
176
+ # def rgb_to_grayscale
177
+ # end
178
+
179
+ def rgb_to_hsv(images)
180
+ RawOps.rgb_to_hsv(images: images)
181
+ end
182
+
183
+ # def rgb_to_yiq
184
+ # end
185
+
186
+ # def rgb_to_yuv
187
+ # end
188
+
189
+ # def rot90
190
+ # end
191
+
192
+ def sample_distorted_bounding_box(image_size, bounding_boxes, seed: nil, seed2: nil, min_object_covered: nil, aspect_ratio_range: nil, area_range: nil, max_attempts: nil, use_image_if_no_bounding_boxes: nil)
193
+ RawOps.sample_distorted_bounding_box(image_size, bounding_boxes, seed: seed, seed2: seed2, min_object_covered: min_object_covered, aspect_ratio_range: aspect_ratio_range, area_range: area_range, max_attempts: max_attempts, use_image_if_no_bounding_boxes: use_image_if_no_bounding_boxes)
194
+ end
195
+
196
+ # def sobel_edges
197
+ # end
198
+
199
+ # def ssim
200
+ # end
201
+
202
+ # def ssim_multiscale
203
+ # end
204
+
205
+ # def total_variation
206
+ # end
207
+
208
+ # def transpose
209
+ # end
210
+
211
+ # def yiq_to_rgb
212
+ # end
213
+
214
+ # def yuv_to_rgb
215
+ # end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,123 @@
1
+ module Tensorflow
2
+ module IO
3
+ def self.decode_and_crop_jpeg(contents, crop_window, channels: nil, ratio: nil, fancy_upscaling: nil, try_recover_truncated: nil, acceptable_fraction: nil, dct_method: nil)
4
+ RawOps.decode_and_crop_jpeg(contents, crop_window, channels: channels, ratio: ratio, fancy_upscaling: fancy_upscaling, try_recover_truncated: try_recover_truncated, acceptable_fraction: acceptable_fraction, dct_method: dct_method)
5
+ end
6
+
7
+ def self.decode_base64(input)
8
+ RawOps.decode_base64(input)
9
+ end
10
+
11
+ def self.decode_bmp(contents, channels: nil)
12
+ RawOps.decode_bmp(contents, channels: channels)
13
+ end
14
+
15
+ def self.decode_compressed(bytes, compression_type: nil)
16
+ RawOps.decode_compressed(bytes, compression_type: compression_type)
17
+ end
18
+
19
+ def self.decode_csv(records, record_defaults, field_delim: nil, use_quote_delim: nil, na_value: nil, select_cols: nil)
20
+ RawOps.decode_csv(records, record_defaults, field_delim: field_delim, use_quote_delim: use_quote_delim, na_value: na_value, select_cols: select_cols)
21
+ end
22
+
23
+ def self.decode_gif(contents)
24
+ RawOps.decode_gif(contents: contents)
25
+ end
26
+
27
+ # def self.decode_image
28
+ # end
29
+
30
+ def self.decode_jpeg(contents, channels: nil, ratio: nil, fancy_upscaling: nil, try_recover_truncated: nil, acceptable_fraction: nil, dct_method: nil)
31
+ RawOps.decode_jpeg(contents: contents, channels: channels, ratio: ratio, fancy_upscaling: fancy_upscaling, try_recover_truncated: try_recover_truncated, acceptable_fraction: acceptable_fraction, dct_method: dct_method)
32
+ end
33
+
34
+ def self.decode_json_example(json_examples)
35
+ RawOps.decode_json_example(json_examples: json_examples)
36
+ end
37
+
38
+ def self.decode_png(contents, channels: nil, dtype: nil)
39
+ RawOps.decode_png(contents: contents, channels: channels, dtype: dtype)
40
+ end
41
+
42
+ # def self.decode_proto
43
+ # end
44
+
45
+ def self.decode_raw(bytes, out_type, little_endian: nil)
46
+ RawOps.decode_raw(bytes, out_type: out_type, little_endian: little_endian)
47
+ end
48
+
49
+ def self.deserialize_many_sparse(serialized_sparse, dtype: nil)
50
+ RawOps.deserialize_many_sparse(serialized_sparse: serialized_sparse, dtype: dtype)
51
+ end
52
+
53
+ def self.encode_base64(input, pad: nil)
54
+ RawOps.encode_base64(input: input, pad: pad)
55
+ end
56
+
57
+ def self.encode_jpeg(image, format: nil, quality: nil, progressive: nil, optimize_size: nil, chroma_downsampling: nil, density_unit: nil, x_density: nil, y_density: nil, xmp_metadata: nil)
58
+ RawOps.encode_jpeg(image: image, format: format, quality: quality, progressive: progressive, optimize_size: optimize_size, chroma_downsampling: chroma_downsampling, density_unit: density_unit, x_density: x_density, y_density: y_density, xmp_metadata: xmp_metadata)
59
+ end
60
+
61
+ def self.encode_proto(sizes, values, field_names: nil, message_type: nil, descriptor_source: nil)
62
+ RawOps.encode_proto(sizes, values, field_names: field_names, message_type: message_type, descriptor_source: descriptor_source)
63
+ end
64
+
65
+ def self.extract_jpeg_shape(contents, output_type: nil)
66
+ RawOps.extract_jpeg_shape(contents: contents, output_type: output_type)
67
+ end
68
+
69
+ def self.is_jpeg(contents)
70
+ Image.is_jpeg(contents)
71
+ end
72
+
73
+ # def self.match_filenames_once
74
+ # end
75
+
76
+ def self.matching_files(pattern)
77
+ RawOps.matching_files(pattern: pattern)
78
+ end
79
+
80
+ def self.parse_example(serialized, names, sparse_keys, dense_keys, dense_defaults, sparse_types: nil, dense_shapes: nil)
81
+ RawOps.parse_example(serialized, names, sparse_keys, dense_keys, dense_defaults, sparse_types: sparse_types, dense_shapes: dense_shapes)
82
+ end
83
+
84
+ def self.parse_sequence_example(serialized, debug_name, context_dense_defaults, feature_list_dense_missing_assumed_empty: nil, context_sparse_keys: nil, context_dense_keys: nil, feature_list_sparse_keys: nil, feature_list_dense_keys: nil, context_sparse_types: nil, feature_list_dense_types: nil, context_dense_shapes: nil, feature_list_sparse_types: nil, feature_list_dense_shapes: nil)
85
+ RawOps.parse_sequence_example(serialized, debug_name, context_dense_defaults, feature_list_dense_missing_assumed_empty: feature_list_dense_missing_assumed_empty, context_sparse_keys: context_sparse_keys, context_dense_keys: context_dense_keys, feature_list_sparse_keys: feature_list_sparse_keys, feature_list_dense_keys: feature_list_dense_keys, context_sparse_types: context_sparse_types, feature_list_dense_types: feature_list_dense_types, context_dense_shapes: context_dense_shapes, feature_list_sparse_types: feature_list_sparse_types, feature_list_dense_shapes: feature_list_dense_shapes)
86
+ end
87
+
88
+ def self.parse_single_example(serialized, dense_defaults, num_sparse: nil, sparse_keys: nil, dense_keys: nil, sparse_types: nil, dense_shapes: nil)
89
+ RawOps.parse_single_example(serialized, dense_defaults, num_sparse: num_sparse, sparse_keys: sparse_keys, dense_keys: dense_keys, sparse_types: sparse_types, dense_shapes: dense_shapes)
90
+ end
91
+
92
+ def self.parse_single_sequence_example(serialized, feature_list_dense_missing_assumed_empty, context_sparse_keys, context_dense_keys, feature_list_sparse_keys, feature_list_dense_keys, context_dense_defaults, debug_name, context_sparse_types: nil, feature_list_dense_types: nil, context_dense_shapes: nil, feature_list_sparse_types: nil, feature_list_dense_shapes: nil)
93
+ RawOps.parse_single_sequence_example(serialized, feature_list_dense_missing_assumed_empty, context_sparse_keys, context_dense_keys, feature_list_sparse_keys, feature_list_dense_keys, context_dense_defaults, debug_name)
94
+ end
95
+
96
+ def self.parse_tensor(serialized, out_type: nil)
97
+ RawOps.parse_tensor(serialized: serialized, out_type: out_type)
98
+ end
99
+
100
+ def self.read_file(filename)
101
+ RawOps.read_file(filename)
102
+ end
103
+
104
+ def self.serialize_many_sparse(sparse_indices, sparse_values, sparse_shape, out_type: nil)
105
+ RawOps.serialize_many_sparse(sparse_indices, sparse_values, sparse_shape, out_type: out_type)
106
+ end
107
+
108
+ def self.serialize_sparse(sparse_indices, sparse_values, sparse_shape, out_type: nil)
109
+ RawOps.serialize_sparse(sparse_indices, sparse_values, sparse_shape, out_type: out_type)
110
+ end
111
+
112
+ def self.serialize_tensor(tensor)
113
+ RawOps.serialize_tensor(tensor)
114
+ end
115
+
116
+ def self.write_file(filename, contents)
117
+ RawOps.write_file(filename, contents)
118
+ end
119
+
120
+ # def self.write_graph
121
+ # end
122
+ end
123
+ end
@@ -0,0 +1,131 @@
1
+ module Tensorflow
2
+ module Linalg
3
+ # def self.adjoint
4
+ # end
5
+
6
+ # def self.band_part
7
+ # end
8
+
9
+ def self.cholesky(input)
10
+ RawOps.cholesky(input: input)
11
+ end
12
+
13
+ # def self.cholesky_solve
14
+ # end
15
+
16
+ def self.cross(a, b)
17
+ RawOps.cross(a, b)
18
+ end
19
+
20
+ # def self.det
21
+ # end
22
+
23
+ def self.diag(diagonal)
24
+ RawOps.diag(diagonal: diagonal)
25
+ end
26
+
27
+ def self.diag_part(input)
28
+ RawOps.diag_part(input: input)
29
+ end
30
+
31
+ # def self.eigh
32
+ # end
33
+
34
+ # def self.eigvalsh
35
+ # end
36
+
37
+ # def self.einsum
38
+ # end
39
+
40
+ # def self.expm
41
+ # end
42
+
43
+ def self.eye(num_rows, num_columns: nil)
44
+ num_columns ||= num_rows
45
+ zeros = Tensorflow.zeros([num_rows, num_columns])
46
+ ones = Tensorflow.ones([num_rows])
47
+ RawOps.matrix_set_diag(zeros, ones)
48
+ end
49
+
50
+ # def self.global_norm
51
+ # end
52
+
53
+ def self.inv(x)
54
+ RawOps.inv(x: x)
55
+ end
56
+
57
+ # def self.l2_normalize
58
+ # end
59
+
60
+ # def self.logdet
61
+ # end
62
+
63
+ # def self.logm
64
+ # end
65
+
66
+ # def self.lstsq
67
+ # end
68
+
69
+ def self.lu(input, output_idx_type: nil)
70
+ RawOps.lu(input: input, output_idx_type: output_idx_type)
71
+ end
72
+
73
+ def self.matmul(a, b, transpose_a: false, transpose_b: false)
74
+ RawOps.mat_mul(a, b, transpose_a: transpose_a, transpose_b: transpose_b)
75
+ end
76
+
77
+ # def self.matrix_transpose
78
+ # end
79
+
80
+ # def self.matvec
81
+ # end
82
+
83
+ # def self.norm
84
+ # end
85
+
86
+ # def self.normalize
87
+ # end
88
+
89
+ def self.qr(input, full_matrices: nil)
90
+ RawOps.qr(input: input, full_matrices: full_matrices)
91
+ end
92
+
93
+ # def self.set_diag
94
+ # end
95
+
96
+ # def self.slogdet
97
+ # end
98
+
99
+ # def self.solve
100
+ # end
101
+
102
+ # def self.sqrtm
103
+ # end
104
+
105
+ def self.svd(input, compute_uv: nil, full_matrices: nil)
106
+ RawOps.svd(input: input, compute_uv: compute_uv, full_matrices: full_matrices)
107
+ end
108
+
109
+ # def self.tensor_diag
110
+ # end
111
+
112
+ # def self.tensor_diag_part
113
+ # end
114
+
115
+ # def self.tensordot
116
+ # end
117
+
118
+ # def self.trace
119
+ # end
120
+
121
+ # def self.triangular_solve
122
+ # end
123
+
124
+ # def self.tridiagonal_matmul
125
+ # end
126
+
127
+ def self.tridiagonal_solve(diagonals, rhs, partial_pivoting: nil)
128
+ RawOps.tridiagonal_solve(diagonals, rhs, partial_pivoting: partial_pivoting)
129
+ end
130
+ end
131
+ end