tensor_stream 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +9 -0
- data/benchmark_ryzen_amd.txt +36 -0
- data/lib/tensor_stream/dynamic_stitch.rb +28 -0
- data/lib/tensor_stream/evaluator/base_evaluator.rb +32 -3
- data/lib/tensor_stream/evaluator/opencl/kernels/floor_div.cl +48 -0
- data/lib/tensor_stream/evaluator/opencl/kernels/mod.cl +3 -0
- data/lib/tensor_stream/evaluator/opencl/kernels/squared_difference.cl +53 -0
- data/lib/tensor_stream/evaluator/opencl/opencl_buffer.rb +1 -2
- data/lib/tensor_stream/evaluator/opencl/opencl_evaluator.rb +44 -24
- data/lib/tensor_stream/evaluator/opencl/opencl_template_helper.rb +2 -0
- data/lib/tensor_stream/evaluator/operation_helpers/array_ops_helper.rb +21 -11
- data/lib/tensor_stream/evaluator/ruby_evaluator.rb +165 -48
- data/lib/tensor_stream/graph_serializers/pbtext.rb +8 -0
- data/lib/tensor_stream/helpers/op_helper.rb +41 -4
- data/lib/tensor_stream/math_gradients.rb +64 -64
- data/lib/tensor_stream/nn/nn_ops.rb +6 -2
- data/lib/tensor_stream/operation.rb +17 -3
- data/lib/tensor_stream/ops.rb +47 -0
- data/lib/tensor_stream/session.rb +9 -1
- data/lib/tensor_stream/tensor.rb +15 -0
- data/lib/tensor_stream/utils.rb +5 -1
- data/lib/tensor_stream/version.rb +1 -1
- data/lib/tensor_stream.rb +1 -0
- data/samples/nearest_neighbor.rb +1 -1
- data/test_samples/raw_neural_net_sample.rb +6 -7
- metadata +8 -3
data/samples/nearest_neighbor.rb
CHANGED
@@ -9,7 +9,7 @@ Project: https://github.com/aymericdamien/TensorFlow-Examples/
|
|
9
9
|
require "bundler/setup"
|
10
10
|
require 'tensor_stream'
|
11
11
|
require 'mnist-learn'
|
12
|
-
require 'tensor_stream/evaluator/opencl_evaluator'
|
12
|
+
require 'tensor_stream/evaluator/opencl/opencl_evaluator'
|
13
13
|
|
14
14
|
tf = TensorStream
|
15
15
|
|
@@ -13,7 +13,7 @@ Project: https://github.com/aymericdamien/TensorFlow-Examples/
|
|
13
13
|
require "bundler/setup"
|
14
14
|
require 'tensor_stream'
|
15
15
|
require 'mnist-learn'
|
16
|
-
require 'tensor_stream/evaluator/opencl_evaluator'
|
16
|
+
require 'tensor_stream/evaluator/opencl/opencl_evaluator'
|
17
17
|
require 'pry-byebug'
|
18
18
|
|
19
19
|
tf = TensorStream
|
@@ -66,7 +66,7 @@ logits = neural_net(X, weights, biases)
|
|
66
66
|
prediction = tf.nn.softmax(logits)
|
67
67
|
|
68
68
|
# Define loss and optimizer
|
69
|
-
loss_op = tf.reduce_mean(tf.nn.
|
69
|
+
loss_op = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(
|
70
70
|
logits: logits, labels: Y))
|
71
71
|
|
72
72
|
optimizer = TensorStream::Train::GradientDescentOptimizer.new(learning_rate)
|
@@ -90,15 +90,14 @@ tf.session do |sess|
|
|
90
90
|
|
91
91
|
batch_x, batch_y = mnist.train.next_batch(batch_size)
|
92
92
|
# Run optimization op (backprop)
|
93
|
-
puts "
|
93
|
+
puts "."
|
94
94
|
sess.run(train_op, feed_dict: { X => batch_x, Y => batch_y })
|
95
|
-
puts "----"
|
96
95
|
if step % display_step == 0 || step == 1
|
97
96
|
# Calculate batch loss and accuracy
|
98
97
|
loss, acc = sess.run([loss_op, accuracy], feed_dict: { X => batch_x, Y => batch_y})
|
99
|
-
print("Step " +
|
100
|
-
|
101
|
-
|
98
|
+
print("Step " + step.to_s + ", Minibatch Loss= " + \
|
99
|
+
loss.to_s + ", Training Accuracy= " + \
|
100
|
+
acc.to_s)
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tensor_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Emmanuel Dayo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -232,12 +232,14 @@ files:
|
|
232
232
|
- benchmark/benchmark.rb
|
233
233
|
- benchmark_intel.txt
|
234
234
|
- benchmark_nvidia.txt
|
235
|
+
- benchmark_ryzen_amd.txt
|
235
236
|
- bin/console
|
236
237
|
- bin/setup
|
237
238
|
- lib/tensor_stream.rb
|
238
239
|
- lib/tensor_stream/control_flow.rb
|
239
240
|
- lib/tensor_stream/debugging/debugging.rb
|
240
241
|
- lib/tensor_stream/device.rb
|
242
|
+
- lib/tensor_stream/dynamic_stitch.rb
|
241
243
|
- lib/tensor_stream/evaluator/base_evaluator.rb
|
242
244
|
- lib/tensor_stream/evaluator/buffer.rb
|
243
245
|
- lib/tensor_stream/evaluator/evaluator.rb
|
@@ -254,10 +256,12 @@ files:
|
|
254
256
|
- lib/tensor_stream/evaluator/opencl/kernels/div.cl.erb
|
255
257
|
- lib/tensor_stream/evaluator/opencl/kernels/exp.cl
|
256
258
|
- lib/tensor_stream/evaluator/opencl/kernels/floor.cl
|
259
|
+
- lib/tensor_stream/evaluator/opencl/kernels/floor_div.cl
|
257
260
|
- lib/tensor_stream/evaluator/opencl/kernels/gemm.cl
|
258
261
|
- lib/tensor_stream/evaluator/opencl/kernels/log.cl
|
259
262
|
- lib/tensor_stream/evaluator/opencl/kernels/log1p.cl
|
260
263
|
- lib/tensor_stream/evaluator/opencl/kernels/max.cl
|
264
|
+
- lib/tensor_stream/evaluator/opencl/kernels/mod.cl
|
261
265
|
- lib/tensor_stream/evaluator/opencl/kernels/mul.cl
|
262
266
|
- lib/tensor_stream/evaluator/opencl/kernels/negate.cl
|
263
267
|
- lib/tensor_stream/evaluator/opencl/kernels/pow.cl
|
@@ -271,6 +275,7 @@ files:
|
|
271
275
|
- lib/tensor_stream/evaluator/opencl/kernels/softmax_grad.cl
|
272
276
|
- lib/tensor_stream/evaluator/opencl/kernels/sqrt.cl
|
273
277
|
- lib/tensor_stream/evaluator/opencl/kernels/square.cl
|
278
|
+
- lib/tensor_stream/evaluator/opencl/kernels/squared_difference.cl
|
274
279
|
- lib/tensor_stream/evaluator/opencl/kernels/sub.cl
|
275
280
|
- lib/tensor_stream/evaluator/opencl/kernels/tan.cl
|
276
281
|
- lib/tensor_stream/evaluator/opencl/kernels/tanh.cl
|
@@ -342,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
347
|
version: '0'
|
343
348
|
requirements: []
|
344
349
|
rubyforge_project:
|
345
|
-
rubygems_version: 2.
|
350
|
+
rubygems_version: 2.7.7
|
346
351
|
signing_key:
|
347
352
|
specification_version: 4
|
348
353
|
summary: A Pure ruby tensorflow implementation
|