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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c66c4a398833de1008fefcd0f9392b194a930f884ed494769a27e524450ab290
4
- data.tar.gz: 334ec92a8608270d9ffc1f34cc65591753a68fc8b7ddb4ea0ded8ad923264e6c
3
+ metadata.gz: 408dd69cf3211817d31734564f9a51c9ff9fdfca9ab7f207994f67b2b6d82303
4
+ data.tar.gz: f07f0b3ebc776dbd1e836968d5e8c97b9730519c6d57251f14cf7a08581b77a3
5
5
  SHA512:
6
- metadata.gz: 92de43776651b67337a701aa89f25738c476c20fc389b51599d1a6038345cb0f08a7b0a7bd122d57f64be368292d41debeb278d784add5bfff5f7a1261cd8c62
7
- data.tar.gz: 393e9e2ff6467e88174c0b199b025beddec8cb0738da42711686818684df7628cdaff402b9227d934193301f52e9da314aa2e4f421b052750785e3df784d158e
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
@@ -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
@@ -0,0 +1,15 @@
1
+ module TensorStream
2
+ class DataTypeUtils
3
+ def self.norm_dtype(dtype)
4
+ dtype = dtype.to_sym
5
+ case dtype
6
+ when :int
7
+ :int32
8
+ when :float
9
+ :float32
10
+ else
11
+ dtype
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module TensorStream
2
- VERSION = "1.0.2".freeze
2
+ VERSION = "1.0.3".freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
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.2
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