Sha256: 9c256b517f7b703f7ef2b2723b65441e256e516965eb612219a56c3e4d19746d
Contents?: true
Size: 621 Bytes
Versions: 5
Compression:
Stored size: 621 Bytes
Contents
module DNN class Link attr_accessor :prev attr_accessor :layer def initialize(prev = nil, layer = nil) @prev = prev @layer = layer end def backward(dy) dy = @layer.backward(dy) @prev&.backward(dy) end end class TwoInputLink attr_accessor :prev1 attr_accessor :prev2 attr_accessor :layer def initialize(prev1 = nil, prev2 = nil, layer = nil) @prev1 = prev1 @prev2 = prev2 @layer = layer end def backward(dy) dy1, dy2 =* @layer.backward(dy) @prev1&.backward(dy1) @prev2&.backward(dy2) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ruby-dnn-0.13.4 | lib/dnn/core/link.rb |
ruby-dnn-0.13.3 | lib/dnn/core/link.rb |
ruby-dnn-0.13.2 | lib/dnn/core/link.rb |
ruby-dnn-0.13.1 | lib/dnn/core/link.rb |
ruby-dnn-0.13.0 | lib/dnn/core/link.rb |