torch-rb 0.9.0 → 0.10.0

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: '09221364dad232f1b76129fe9dc9407675cc2afbd03bd1339c736d4eec752df7'
4
- data.tar.gz: a37a0584aed809009ebd74e7c0da9430481ccabf1ac915d2468ee7511c249588
3
+ metadata.gz: 7884d0bd8ffd23e775b3a1ca59e536bc18cd79c6bbe2736a9802a2b1693d40de
4
+ data.tar.gz: 10849c8a248a70eca7178ca3529fa7428fc3d8e5cfe2ca774b0be6cb5e75eb9b
5
5
  SHA512:
6
- metadata.gz: c220d35971b9ce3e5a7a80f6a5d1ae4324f3524d0e0171c680deced66fe2f29342a46eecb1a4447d84a401a677c7bb1ef910a0c7ee6c925ea4b578b7e5712772
7
- data.tar.gz: 807fe2907de1caac92da6dddb0154b7971dda3aa0ee2c53f6b3046732f4bf3c02310e59a6441efa0fdf1ad3d0ddb5dcd7a3c1a946adbfbea73b6b30f10a71487
6
+ metadata.gz: d81587eae00527e9d1e4a65b62a686dbdab27eed9401539faddf553d3a0730ad7394b01bac615bdd0474d1a6602cd0a3117e1d7cb3a3f1d5fbf8bd989fa39e59
7
+ data.tar.gz: d581d07821f103ee69267bc8e6b15d5094d8b8ef004917af947e2570649e7fbe750c9893d40600b62ee970646654fc545a270e7a59adb764be2ba73f1fa18b62
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 0.10.0 (2022-03-13)
2
+
3
+ - Updated LibTorch to 1.11.0
4
+ - Added `ParameterList`
5
+
6
+ ## 0.9.2 (2022-02-03)
7
+
8
+ - Added support for setting `nil` gradient
9
+ - Added checks when setting gradient
10
+ - Fixed precision with `Torch.tensor` method
11
+ - Fixed memory issue when creating tensor for `ByteStorage`
12
+
13
+ ## 0.9.1 (2022-02-02)
14
+
15
+ - Moved `like` methods to C++
16
+ - Fixed memory issue
17
+
1
18
  ## 0.9.0 (2021-10-23)
2
19
 
3
20
  - Updated LibTorch to 1.10.0
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
  [![Build Status](https://github.com/ankane/torch.rb/workflows/build/badge.svg?branch=master)](https://github.com/ankane/torch.rb/actions)
12
13
 
@@ -21,10 +22,10 @@ brew install libtorch
21
22
  Add this line to your application’s Gemfile:
22
23
 
23
24
  ```ruby
24
- gem 'torch-rb'
25
+ gem "torch-rb"
25
26
  ```
26
27
 
27
- It can take a few minutes to compile the extension.
28
+ It can take 5-10 minutes to compile the extension.
28
29
 
29
30
  ## Getting Started
30
31
 
@@ -79,7 +80,7 @@ b = Torch.zeros(2, 3)
79
80
 
80
81
  Each tensor has four properties
81
82
 
82
- - `dtype` - the data type - `:uint8`, `:int8`, `:int16`, `:int32`, `:int64`, `:float32`, `float64`, or `:bool`
83
+ - `dtype` - the data type - `:uint8`, `:int8`, `:int16`, `:int32`, `:int64`, `:float32`, `:float64`, or `:bool`
83
84
  - `layout` - `:strided` (dense) or `:sparse`
84
85
  - `device` - the compute device, like CPU or GPU
85
86
  - `requires_grad` - whether or not to record gradients
@@ -408,7 +409,8 @@ Here’s the list of compatible versions.
408
409
 
409
410
  Torch.rb | LibTorch
410
411
  --- | ---
411
- 0.9.0+ | 1.10.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.split(/\s*->\s*/)
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.split(/\s+/)
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