torch-rb 0.16.0 → 0.17.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: 8442fc0f85d6f2465258a54e5aefbe03d23a7c0e58753e06855bfebd2f4de802
4
- data.tar.gz: ac0efb89f9b6d413498bfb1c2e84336aa728047dd013d00fa736449e5be82617
3
+ metadata.gz: cd28e938ac0d61829d538f4a36e9f3377f06257ab08fd3ec8d8e3912194a101a
4
+ data.tar.gz: 7bbb0c98e783c4a02e4ca46a1835c591fff3630c84d1a44abf1ef8df75c45de7
5
5
  SHA512:
6
- metadata.gz: 6830efe74de98fc8a8d23e7308795a60ee60fff72b3f82fa7cb92815f4efe52fdf3637e0821490f5e3e8c2c8731043f52f5aff20cfb01db1340be0962fed18db
7
- data.tar.gz: 3e50976e5add37b4158956c76e3c922167911492acda9e171af42ad39d5abe946c36427e545d9fc820a2800e3df0523b0068ce76b804d0c05a6f1e2ad495de01
6
+ metadata.gz: 38415fe461d01d11d620d2072012ea6a86ad000e5d25920af3d2d4cd05c3b088479cb60a2bd2b6dc013da51e3f744913b3d734fc949ac2708b825c3c041f8c52
7
+ data.tar.gz: 2c54b30ccfa91f9b7576f7927377c03a9d82b7ff8aaf561e92ad89b2b00a2e7e3e08c268d606e6609cbaa13d2dc2e5e11c8329bf1b3475af7025a21dc8a1921f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.17.0 (2024-07-26)
2
+
3
+ - Updated LibTorch to 2.4.0
4
+ - Added `normalize` method
5
+ - Added support for tensor indexing with arrays
6
+
1
7
  ## 0.16.0 (2024-06-12)
2
8
 
3
9
  - Updated LibTorch to 2.3.0
data/README.md CHANGED
@@ -26,7 +26,7 @@ Add this line to your application’s Gemfile:
26
26
  gem "torch-rb"
27
27
  ```
28
28
 
29
- It can take 5-10 minutes to compile the extension.
29
+ It can take 5-10 minutes to compile the extension. Windows is not currently supported.
30
30
 
31
31
  ## Getting Started
32
32
 
@@ -410,6 +410,7 @@ Here’s the list of compatible versions.
410
410
 
411
411
  Torch.rb | LibTorch
412
412
  --- | ---
413
+ 0.17.x | 2.4.x
413
414
  0.16.x | 2.3.x
414
415
  0.15.x | 2.2.x
415
416
  0.14.x | 2.1.x
@@ -155,10 +155,10 @@ def generate_attach_def(name, type, def_method)
155
155
  end
156
156
 
157
157
  ruby_name = "_#{ruby_name}" if ["size", "stride", "random!"].include?(ruby_name)
158
- ruby_name = ruby_name.sub(/\Afft_/, "") if type == "fft"
159
- ruby_name = ruby_name.sub(/\Alinalg_/, "") if type == "linalg"
160
- ruby_name = ruby_name.sub(/\Aspecial_/, "") if type == "special"
161
- ruby_name = ruby_name.sub(/\Asparse_/, "") if type == "sparse"
158
+ ruby_name = ruby_name.delete_prefix("fft_") if type == "fft"
159
+ ruby_name = ruby_name.delete_prefix("linalg_") if type == "linalg"
160
+ ruby_name = ruby_name.delete_prefix("special_") if type == "special"
161
+ ruby_name = ruby_name.delete_prefix("sparse_") if type == "sparse"
162
162
  ruby_name = name if name.start_with?("__")
163
163
 
164
164
  "rb_#{def_method}(m, \"#{ruby_name}\", #{full_name(name, type)}, -1);"
@@ -216,7 +216,7 @@ def add_dispatch(function, def_method)
216
216
  out_code = generate_dispatch(function["out"], def_method)
217
217
  out_index = function["out"].out_index
218
218
 
219
- return "if (_r.isNone(#{out_index})) {
219
+ "if (_r.isNone(#{out_index})) {
220
220
  #{indent(base_code)}
221
221
  } else {
222
222
  #{indent(out_code)}
@@ -439,7 +439,7 @@ def generate_function_params(function, params, remove_self)
439
439
  else
440
440
  "#{func}Optional"
441
441
  end
442
- end
442
+ end
443
443
 
444
444
  "_r.#{func}(#{param[:position]})"
445
445
  end