ruby-dnn 0.5.2 → 0.5.3
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/lib/dnn/core/activations.rb +4 -5
- data/lib/dnn/core/initializers.rb +4 -2
- data/lib/dnn/core/layers.rb +4 -3
- data/lib/dnn/core/optimizers.rb +4 -2
- data/lib/dnn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 689d64b7f3c1ffbf71c9ac26acc793f13f02d14a75eee4632b178a40c932e488
|
|
4
|
+
data.tar.gz: e8e4346a5fedf03210b3c8fc5538102fa86e27027af25012a41e857bd806b6c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6dd870d71a5b5be041a70acc3ac3e2cad930b0080a350e4f82dc16b4134b8ef8e5bf2800228b59965874f8164fbb3668fec5aa5ce5d671ca52dcb46a201213a
|
|
7
|
+
data.tar.gz: 68378ff6a139bf83e2adbe0095a2d6240eaf9cf187bdd02f6048ef4293974c10af44f89dfc113ce713382d8956e7c67a90e2e83a521feaff8a7ec05a441c1319
|
data/lib/dnn/core/activations.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module DNN
|
|
2
2
|
module Activations
|
|
3
3
|
Layer = Layers::Layer
|
|
4
|
-
OutputLayer = Layers::OutputLayer
|
|
5
4
|
|
|
6
5
|
class Sigmoid < Layer
|
|
7
6
|
def forward(x)
|
|
@@ -75,7 +74,7 @@ module DNN
|
|
|
75
74
|
end
|
|
76
75
|
|
|
77
76
|
|
|
78
|
-
class IdentityMSE < OutputLayer
|
|
77
|
+
class IdentityMSE < Layers::OutputLayer
|
|
79
78
|
def forward(x)
|
|
80
79
|
@out = x
|
|
81
80
|
end
|
|
@@ -91,7 +90,7 @@ module DNN
|
|
|
91
90
|
end
|
|
92
91
|
|
|
93
92
|
|
|
94
|
-
class IdentityMAE < OutputLayer
|
|
93
|
+
class IdentityMAE < Layers::OutputLayer
|
|
95
94
|
def forward(x)
|
|
96
95
|
@out = x
|
|
97
96
|
end
|
|
@@ -110,7 +109,7 @@ module DNN
|
|
|
110
109
|
end
|
|
111
110
|
|
|
112
111
|
|
|
113
|
-
class SoftmaxWithLoss < OutputLayer
|
|
112
|
+
class SoftmaxWithLoss < Layers::OutputLayer
|
|
114
113
|
def forward(x)
|
|
115
114
|
@out = NMath.exp(x) / NMath.exp(x).sum(1).reshape(x.shape[0], 1)
|
|
116
115
|
end
|
|
@@ -126,7 +125,7 @@ module DNN
|
|
|
126
125
|
end
|
|
127
126
|
|
|
128
127
|
|
|
129
|
-
class SigmoidWithLoss < OutputLayer
|
|
128
|
+
class SigmoidWithLoss < Layers::OutputLayer
|
|
130
129
|
include Xumo
|
|
131
130
|
|
|
132
131
|
def initialize
|
data/lib/dnn/core/layers.rb
CHANGED
|
@@ -32,8 +32,10 @@ module DNN
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Layer to a hash.
|
|
35
|
-
def to_hash(
|
|
36
|
-
{name: self.class.name}
|
|
35
|
+
def to_hash(merge_hash = nil)
|
|
36
|
+
hash = {name: self.class.name}
|
|
37
|
+
hash.merge!(merge_hash) if merge_hash
|
|
38
|
+
hash
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
# Get the previous layer.
|
|
@@ -194,7 +196,6 @@ module DNN
|
|
|
194
196
|
end
|
|
195
197
|
|
|
196
198
|
def backward(dout)
|
|
197
|
-
p dout.shape, @x_shape
|
|
198
199
|
dout.reshape(*@x_shape)
|
|
199
200
|
end
|
|
200
201
|
|
data/lib/dnn/core/optimizers.rb
CHANGED
|
@@ -12,8 +12,10 @@ module DNN
|
|
|
12
12
|
# Update layer has params.
|
|
13
13
|
def update(layer) end
|
|
14
14
|
|
|
15
|
-
def to_hash(
|
|
16
|
-
{name: self.class.name, learning_rate: @learning_rate}
|
|
15
|
+
def to_hash(merge_hash = nil)
|
|
16
|
+
hash = {name: self.class.name, learning_rate: @learning_rate}
|
|
17
|
+
hash.merge!(merge_hash) if merge_hash
|
|
18
|
+
hash
|
|
17
19
|
end
|
|
18
20
|
end
|
|
19
21
|
|
data/lib/dnn/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-dnn
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- unagiootoro
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: numo-narray
|