class DNN::Layers::Sum
Attributes
axis[R]
keepdims[R]
Public Class Methods
new(axis: 0, keepdims: true)
click to toggle source
Calls superclass method
DNN::Layers::Layer::new
# File lib/dnn/core/layers/math_layers.rb, line 200 def initialize(axis: 0, keepdims: true) super() @axis = axis @keepdims = keepdims end
Public Instance Methods
backward_node(dy)
click to toggle source
# File lib/dnn/core/layers/math_layers.rb, line 215 def backward_node(dy) MathUtils.broadcast_to(dy, @x_shape) end
forward_node(x)
click to toggle source
# File lib/dnn/core/layers/math_layers.rb, line 206 def forward_node(x) @x_shape = x.shape if @axis x.sum(axis: @axis, keepdims: true) else x.sum end end
load_hash(hash)
click to toggle source
# File lib/dnn/core/layers/math_layers.rb, line 223 def load_hash(hash) initialize(axis: hash[:axis], keepdims: hash[:keepdims]) end
to_hash()
click to toggle source
Calls superclass method
DNN::Layers::Layer#to_hash
# File lib/dnn/core/layers/math_layers.rb, line 219 def to_hash super(axis: @axis, keepdims: @keepdims) end