torch-rb 0.12.2 → 0.13.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.
@@ -14,4 +14,8 @@ void init_backends(Rice::Module& m) {
14
14
  Rice::define_module_under(rb_mBackends, "MKL")
15
15
  .add_handler<torch::Error>(handle_error)
16
16
  .define_singleton_function("available?", &torch::hasMKL);
17
+
18
+ Rice::define_module_under(rb_mBackends, "MPS")
19
+ .add_handler<torch::Error>(handle_error)
20
+ .define_singleton_function("available?", &torch::hasMPS);
17
21
  }
data/ext/torch/tensor.cpp CHANGED
@@ -35,17 +35,17 @@ std::vector<TensorIndex> index_vector(Array a) {
35
35
  if (obj.is_instance_of(rb_cInteger)) {
36
36
  indices.push_back(Rice::detail::From_Ruby<int64_t>().convert(obj.value()));
37
37
  } else if (obj.is_instance_of(rb_cRange)) {
38
- torch::optional<int64_t> start_index = torch::nullopt;
39
- torch::optional<int64_t> stop_index = torch::nullopt;
38
+ torch::optional<c10::SymInt> start_index = torch::nullopt;
39
+ torch::optional<c10::SymInt> stop_index = torch::nullopt;
40
40
 
41
41
  Object begin = obj.call("begin");
42
42
  if (!begin.is_nil()) {
43
- start_index = Rice::detail::From_Ruby<int64_t>().convert(begin.value());
43
+ start_index = c10::SymInt(Rice::detail::From_Ruby<int64_t>().convert(begin.value()));
44
44
  }
45
45
 
46
46
  Object end = obj.call("end");
47
47
  if (!end.is_nil()) {
48
- stop_index = Rice::detail::From_Ruby<int64_t>().convert(end.value());
48
+ stop_index = c10::SymInt(Rice::detail::From_Ruby<int64_t>().convert(end.value()));
49
49
  }
50
50
 
51
51
  Object exclude_end = obj.call("exclude_end?");
data/ext/torch/utils.h CHANGED
@@ -6,7 +6,7 @@
6
6
  #include <rice/stl.hpp>
7
7
 
8
8
  static_assert(
9
- TORCH_VERSION_MAJOR == 1 && TORCH_VERSION_MINOR == 13,
9
+ TORCH_VERSION_MAJOR == 2 && TORCH_VERSION_MINOR == 0,
10
10
  "Incompatible LibTorch version"
11
11
  );
12
12
 
data/lib/torch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Torch
2
- VERSION = "0.12.2"
2
+ VERSION = "0.13.0"
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.12.2
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-31 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -230,14 +230,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
230
230
  requirements:
231
231
  - - ">="
232
232
  - !ruby/object:Gem::Version
233
- version: '2.7'
233
+ version: '3'
234
234
  required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  requirements:
236
236
  - - ">="
237
237
  - !ruby/object:Gem::Version
238
238
  version: '0'
239
239
  requirements: []
240
- rubygems_version: 3.4.1
240
+ rubygems_version: 3.4.10
241
241
  signing_key:
242
242
  specification_version: 4
243
243
  summary: Deep learning for Ruby, powered by LibTorch