tensor_stream 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tensor_stream.rb +1 -0
- data/lib/tensor_stream/placeholder.rb +1 -1
- data/lib/tensor_stream/utils.rb +1 -13
- data/lib/tensor_stream/utils/data_type_utils.rb +15 -0
- data/lib/tensor_stream/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 408dd69cf3211817d31734564f9a51c9ff9fdfca9ab7f207994f67b2b6d82303
|
4
|
+
data.tar.gz: f07f0b3ebc776dbd1e836968d5e8c97b9730519c6d57251f14cf7a08581b77a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '079a28b96e99180438059036db170dccbb8437188893031a607fcdebc8e66d6ea6678f1da83bd2bf2a8515434e061867e02f9342d00f5a8aadbceb141465ed09'
|
7
|
+
data.tar.gz: 1f8556098e4fa005a36e2884a079b9ea862aeef0c077623215430b69201a6e7e56b3fd4e33036f54a5c554cbf17fffe71a792f1984f4ac6fbcb116a14104453e
|
data/lib/tensor_stream.rb
CHANGED
@@ -2,6 +2,7 @@ require "tensor_stream/version"
|
|
2
2
|
require "deep_merge"
|
3
3
|
require "matrix"
|
4
4
|
require "concurrent"
|
5
|
+
require "tensor_stream/utils/data_type_utils"
|
5
6
|
require "tensor_stream/exceptions"
|
6
7
|
require "tensor_stream/helpers/op_helper"
|
7
8
|
require "tensor_stream/helpers/string_helper"
|
@@ -4,7 +4,7 @@ module TensorStream
|
|
4
4
|
def initialize(data_type, rank, shape, options = {})
|
5
5
|
setup_initial_state(options)
|
6
6
|
|
7
|
-
@data_type = data_type.to_sym
|
7
|
+
@data_type = DataTypeUtils.norm_dtype(data_type.to_sym)
|
8
8
|
@rank = rank
|
9
9
|
@shape = TensorShape.new(shape, rank)
|
10
10
|
@value = nil
|
data/lib/tensor_stream/utils.rb
CHANGED
@@ -279,7 +279,7 @@ module TensorStream
|
|
279
279
|
end
|
280
280
|
|
281
281
|
def check_data_types(*args)
|
282
|
-
unique_types = args.select { |a| a.is_a?(Tensor) }. map { |a| norm_dtype(a.data_type) }.uniq
|
282
|
+
unique_types = args.select { |a| a.is_a?(Tensor) }. map { |a| DataTypeUtils.norm_dtype(a.data_type) }.uniq
|
283
283
|
|
284
284
|
if unique_types.size > 1
|
285
285
|
raise TensorStream::ValueError, "Value Error: Tensor conversion requested dtypes are different -> #{unique_types}"
|
@@ -295,17 +295,5 @@ module TensorStream
|
|
295
295
|
coerced_type = check_data_types(*args)
|
296
296
|
args.map { |a| a.is_a?(Tensor) ? a : convert_to_tensor(a, dtype: coerced_type) }
|
297
297
|
end
|
298
|
-
|
299
|
-
def norm_dtype(dtype)
|
300
|
-
dtype = dtype.to_sym
|
301
|
-
case dtype
|
302
|
-
when :int
|
303
|
-
:int32
|
304
|
-
when :float
|
305
|
-
:float32
|
306
|
-
else
|
307
|
-
dtype
|
308
|
-
end
|
309
|
-
end
|
310
298
|
end
|
311
299
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tensor_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Emmanuel Dayo
|
@@ -376,6 +376,7 @@ files:
|
|
376
376
|
- lib/tensor_stream/trainer.rb
|
377
377
|
- lib/tensor_stream/types.rb
|
378
378
|
- lib/tensor_stream/utils.rb
|
379
|
+
- lib/tensor_stream/utils/data_type_utils.rb
|
379
380
|
- lib/tensor_stream/utils/freezer.rb
|
380
381
|
- lib/tensor_stream/variable.rb
|
381
382
|
- lib/tensor_stream/variable_scope.rb
|