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 +4 -4
- data/CHANGELOG.md +5 -0
- data/codegen/generate_functions.rb +1 -1
- data/lib/torch.rb +5 -7
- data/lib/torch/tensor.rb +5 -0
- data/lib/torch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68b4f1b0599e97803bd0e07efdd7fff96e0e04369005dbd72db190df3cf4e1b4
|
4
|
+
data.tar.gz: 302f75c8b43b25ac06e49c7d8047c755a58d38d86e67c6b8df4f00a8579a2676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18a01b8d18f659fb2da9e4cf6e700de260c04f7400ce62e5850d79f03f5e58e5b700730c7bdddab0148e60be080b5b85bb48e53527653372527461da46863d7
|
7
|
+
data.tar.gz: 8aaa9e2ee75e2a1a64ae506a59eca35e150bf48568dc4c905fb30df6a61d56ab745383f31525fd3c9e6a259cf33adf154ba8d70476b75fd124b035dbf9b48f4f
|
data/CHANGELOG.md
CHANGED
@@ -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 (*)(...)) "
|
data/lib/torch.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/torch/tensor.rb
CHANGED
data/lib/torch/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rice
|