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.
@@ -0,0 +1,6 @@
1
+ // generated by rake generate:functions
2
+ // do not edit by hand
3
+
4
+ #pragma once
5
+
6
+ void add_sparse_functions(Rice::Module& m);
@@ -0,0 +1,48 @@
1
+ module Torch
2
+ module NN
3
+ class ParameterList < Module
4
+ include Enumerable
5
+
6
+ def initialize(parameters)
7
+ super()
8
+ @initialized = true
9
+ unless parameters.nil?
10
+ concat(parameters)
11
+ end
12
+ end
13
+
14
+ def length
15
+ @parameters.length
16
+ end
17
+ alias_method :count, :length
18
+ alias_method :size, :length
19
+
20
+ def concat(parameters)
21
+ unless parameters.is_a?(Enumerable)
22
+ raise TypeError, "ParameterList#concat should be called with an enumerable, but got #{parameters.class.name}"
23
+ end
24
+ offset = length
25
+ parameters.each_with_index do |param, i|
26
+ register_parameter((offset + i).to_s, param)
27
+ end
28
+ self
29
+ end
30
+
31
+ def each(&block)
32
+ if block_given?
33
+ @parameters.values.each(&block)
34
+ else
35
+ to_enum(:each)
36
+ end
37
+ end
38
+
39
+ def [](idx)
40
+ if idx.is_a?(Range)
41
+ self.class.new(@parameters.values[idx])
42
+ else
43
+ @parameters[idx.to_s]
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
data/lib/torch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Torch
2
- VERSION = "0.9.2"
2
+ VERSION = "0.10.0"
3
3
  end
data/lib/torch.rb CHANGED
@@ -40,6 +40,7 @@ require "torch/nn/utils"
40
40
  # nn containers
41
41
  require "torch/nn/module"
42
42
  require "torch/nn/module_list"
43
+ require "torch/nn/parameter_list"
43
44
  require "torch/nn/sequential"
44
45
 
45
46
  # nn convolution layers
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.9.2
4
+ version: 0.10.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: 2022-02-03 00:00:00.000000000 Z
11
+ date: 2022-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -52,6 +52,7 @@ files:
52
52
  - ext/torch/random.cpp
53
53
  - ext/torch/ruby_arg_parser.cpp
54
54
  - ext/torch/ruby_arg_parser.h
55
+ - ext/torch/sparse_functions.h
55
56
  - ext/torch/special.cpp
56
57
  - ext/torch/special_functions.h
57
58
  - ext/torch/templates.h
@@ -149,6 +150,7 @@ files:
149
150
  - lib/torch/nn/nll_loss.rb
150
151
  - lib/torch/nn/pairwise_distance.rb
151
152
  - lib/torch/nn/parameter.rb
153
+ - lib/torch/nn/parameter_list.rb
152
154
  - lib/torch/nn/poisson_nll_loss.rb
153
155
  - lib/torch/nn/prelu.rb
154
156
  - lib/torch/nn/reflection_pad1d.rb
@@ -227,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
229
  - !ruby/object:Gem::Version
228
230
  version: '0'
229
231
  requirements: []
230
- rubygems_version: 3.3.3
232
+ rubygems_version: 3.3.7
231
233
  signing_key:
232
234
  specification_version: 4
233
235
  summary: Deep learning for Ruby, powered by LibTorch