torch-rb 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +3 -1
- data/codegen/function.rb +2 -2
- data/codegen/generate_functions.rb +5 -1
- data/codegen/native_functions.yaml +951 -362
- data/ext/torch/sparse_functions.h +6 -0
- data/lib/torch/nn/parameter_list.rb +48 -0
- data/lib/torch/version.rb +1 -1
- data/lib/torch.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7884d0bd8ffd23e775b3a1ca59e536bc18cd79c6bbe2736a9802a2b1693d40de
|
4
|
+
data.tar.gz: 10849c8a248a70eca7178ca3529fa7428fc3d8e5cfe2ca774b0be6cb5e75eb9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d81587eae00527e9d1e4a65b62a686dbdab27eed9401539faddf553d3a0730ad7394b01bac615bdd0474d1a6602cd0a3117e1d7cb3a3f1d5fbf8bd989fa39e59
|
7
|
+
data.tar.gz: d581d07821f103ee69267bc8e6b15d5094d8b8ef004917af947e2570649e7fbe750c9893d40600b62ee970646654fc545a270e7a59adb764be2ba73f1fa18b62
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,6 +7,7 @@ Check out:
|
|
7
7
|
- [TorchVision](https://github.com/ankane/torchvision) for computer vision tasks
|
8
8
|
- [TorchText](https://github.com/ankane/torchtext) for text and NLP tasks
|
9
9
|
- [TorchAudio](https://github.com/ankane/torchaudio) for audio tasks
|
10
|
+
- [TorchRec](https://github.com/ankane/torchrec-ruby) for recommendation systems
|
10
11
|
|
11
12
|
[](https://github.com/ankane/torch.rb/actions)
|
12
13
|
|
@@ -408,7 +409,8 @@ Here’s the list of compatible versions.
|
|
408
409
|
|
409
410
|
Torch.rb | LibTorch
|
410
411
|
--- | ---
|
411
|
-
0.
|
412
|
+
0.10.0+ | 1.11.0+
|
413
|
+
0.9.0-0.9.2 | 1.10.0-1.10.2
|
412
414
|
0.8.0-0.8.3 | 1.9.0-1.9.1
|
413
415
|
0.6.0-0.7.0 | 1.8.0-1.8.1
|
414
416
|
0.5.0-0.5.3 | 1.7.0-1.7.1
|
data/codegen/function.rb
CHANGED
@@ -37,7 +37,7 @@ class Function
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def parse_func
|
40
|
-
input, output = func.
|
40
|
+
input, _, output = func.rpartition(/\s+->\s+/)
|
41
41
|
[generate_params(input), generate_retvals(output)]
|
42
42
|
end
|
43
43
|
|
@@ -52,7 +52,7 @@ class Function
|
|
52
52
|
next
|
53
53
|
end
|
54
54
|
|
55
|
-
type, name = i.
|
55
|
+
type, _, name = i.rpartition(/\s+/)
|
56
56
|
|
57
57
|
if name.include?("=")
|
58
58
|
name, default = name.split("=", 2)
|
@@ -14,6 +14,7 @@ def generate_functions
|
|
14
14
|
generate_files("fft", :define_singleton_method, functions[:fft])
|
15
15
|
generate_files("linalg", :define_singleton_method, functions[:linalg])
|
16
16
|
generate_files("special", :define_singleton_method, functions[:special])
|
17
|
+
generate_files("sparse", :define_singleton_method, functions[:sparse])
|
17
18
|
end
|
18
19
|
|
19
20
|
def load_functions
|
@@ -47,6 +48,7 @@ def group_functions(functions)
|
|
47
48
|
linalg_functions, other_functions = other_functions.partition { |f| f.python_module == "linalg" }
|
48
49
|
fft_functions, other_functions = other_functions.partition { |f| f.python_module == "fft" }
|
49
50
|
special_functions, other_functions = other_functions.partition { |f| f.python_module == "special" }
|
51
|
+
sparse_functions, other_functions = other_functions.partition { |f| f.python_module == "sparse" }
|
50
52
|
unexpected_functions, other_functions = other_functions.partition { |f| f.python_module }
|
51
53
|
torch_functions = other_functions.select { |f| f.variants.include?("function") }
|
52
54
|
tensor_functions = other_functions.select { |f| f.variants.include?("method") }
|
@@ -62,7 +64,8 @@ def group_functions(functions)
|
|
62
64
|
nn: nn_functions,
|
63
65
|
linalg: linalg_functions,
|
64
66
|
fft: fft_functions,
|
65
|
-
special: special_functions
|
67
|
+
special: special_functions,
|
68
|
+
sparse: sparse_functions
|
66
69
|
}
|
67
70
|
end
|
68
71
|
|
@@ -136,6 +139,7 @@ def generate_attach_def(name, type, def_method)
|
|
136
139
|
ruby_name = ruby_name.sub(/\Afft_/, "") if type == "fft"
|
137
140
|
ruby_name = ruby_name.sub(/\Alinalg_/, "") if type == "linalg"
|
138
141
|
ruby_name = ruby_name.sub(/\Aspecial_/, "") if type == "special"
|
142
|
+
ruby_name = ruby_name.sub(/\Asparse_/, "") if type == "sparse"
|
139
143
|
ruby_name = name if name.start_with?("__")
|
140
144
|
|
141
145
|
# cast for Ruby < 2.7 https://github.com/thisMagpie/fftw/issues/22#issuecomment-49508900
|