torch-rb 0.5.0 → 0.5.1

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: fa3f2b23a31aeaec5f651db7bf30b91d4b3da4cd539645cf75b9bafa0888b1cf
4
- data.tar.gz: 886cdc9f34a7ec5ed758f52c039d5d9fc6f0c7a51ee3bf6ef25f4382e9192225
3
+ metadata.gz: 68b4f1b0599e97803bd0e07efdd7fff96e0e04369005dbd72db190df3cf4e1b4
4
+ data.tar.gz: 302f75c8b43b25ac06e49c7d8047c755a58d38d86e67c6b8df4f00a8579a2676
5
5
  SHA512:
6
- metadata.gz: 1683c37ed188b8ea505b4d2040b4c6f42c75b682a0251ada88982bb4c7b1318c8aa3ebc5b755eb7a46397f5cffcaa46af82e17207f402fcbd7152f44f2e28cab
7
- data.tar.gz: 3ac8ba3b4f854f964a4ffaaa6628ac236d94bca3462aff6775858160beebb869c7823b0aaa0378572d061bc33059b1b5f0de0d8608107161463cff796b753a2d
6
+ metadata.gz: d18a01b8d18f659fb2da9e4cf6e700de260c04f7400ce62e5850d79f03f5e58e5b700730c7bdddab0148e60be080b5b85bb48e53527653372527461da46863d7
7
+ data.tar.gz: 8aaa9e2ee75e2a1a64ae506a59eca35e150bf48568dc4c905fb30df6a61d56ab745383f31525fd3c9e6a259cf33adf154ba8d70476b75fd124b035dbf9b48f4f
@@ -1,3 +1,8 @@
1
+ ## 0.5.1 (2020-10-28)
2
+
3
+ - Fixed error with tensor classes and no arguments
4
+ - Fixed error with `stft` and `clamp` methods
5
+
1
6
  ## 0.5.0 (2020-10-28)
2
7
 
3
8
  - Updated LibTorch to 1.7.0
@@ -112,7 +112,7 @@ def generate_attach_def(name, type, def_method)
112
112
  name
113
113
  end
114
114
 
115
- ruby_name = "_#{ruby_name}" if ["size", "stride", "random!"].include?(ruby_name)
115
+ ruby_name = "_#{ruby_name}" if ["size", "stride", "random!", "stft"].include?(ruby_name)
116
116
 
117
117
  # cast for Ruby < 2.7 https://github.com/thisMagpie/fftw/issues/22#issuecomment-49508900
118
118
  cast = RUBY_VERSION.to_f > 2.7 ? "" : "(VALUE (*)(...)) "
@@ -261,6 +261,8 @@ module Torch
261
261
  Torch._from_blob(bytes, [bytes.bytesize], TensorOptions.new.dtype(DTYPE_TO_ENUM[dtype]))
262
262
  elsif args.size == 1 && args.first.is_a?(Array)
263
263
  Torch.tensor(args.first, dtype: dtype, device: device)
264
+ elsif args.size == 0
265
+ Torch.empty(0, dtype: dtype, device: device)
264
266
  else
265
267
  Torch.empty(*args, dtype: dtype, device: device)
266
268
  end
@@ -434,7 +436,8 @@ module Torch
434
436
  zeros(input.size, **like_options(input, options))
435
437
  end
436
438
 
437
- def stft(input, n_fft, hop_length: nil, win_length: nil, window: nil, center: true, pad_mode: "reflect", normalized: false, onesided: true)
439
+ # center option
440
+ def stft(input, n_fft, hop_length: nil, win_length: nil, window: nil, center: true, pad_mode: "reflect", normalized: false, onesided: true, return_complex: nil)
438
441
  if center
439
442
  signal_dim = input.dim
440
443
  extended_shape = [1] * (3 - signal_dim) + input.size
@@ -442,12 +445,7 @@ module Torch
442
445
  input = NN::F.pad(input.view(extended_shape), [pad, pad], mode: pad_mode)
443
446
  input = input.view(input.shape[-signal_dim..-1])
444
447
  end
445
- _stft(input, n_fft, hop_length, win_length, window, normalized, onesided)
446
- end
447
-
448
- def clamp(tensor, min, max)
449
- tensor = _clamp_min(tensor, min)
450
- _clamp_max(tensor, max)
448
+ _stft(input, n_fft, hop_length, win_length, window, normalized, onesided, return_complex)
451
449
  end
452
450
 
453
451
  private
@@ -174,5 +174,10 @@ module Torch
174
174
  return _random!(0, *args) if args.size == 1
175
175
  _random!(*args)
176
176
  end
177
+
178
+ # center option
179
+ def stft(*args)
180
+ Torch.stft(*args)
181
+ end
177
182
  end
178
183
  end
@@ -1,3 +1,3 @@
1
1
  module Torch
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torch-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice