Class: DNN::Layers::Pow
- Includes:
- LayerNode
- Defined in:
- lib/dnn/core/layers/math_layers.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
- #backward_node(dy) ⇒ Object
- #forward_node(x) ⇒ Object
-
#initialize(index) ⇒ Pow
constructor
A new instance of Pow.
Methods included from LayerNode
Methods inherited from Layer
#build, #built?, #call, call, #clean, #forward, from_hash, #load_hash, #output_shape, #to_hash
Constructor Details
#initialize(index) ⇒ Pow
Returns a new instance of Pow.
88 89 90 91 |
# File 'lib/dnn/core/layers/math_layers.rb', line 88 def initialize(index) super() @index = index end |
Instance Method Details
#backward_node(dy) ⇒ Object
98 99 100 |
# File 'lib/dnn/core/layers/math_layers.rb', line 98 def backward_node(dy) @index * @x**(@index - 1) end |
#forward_node(x) ⇒ Object
93 94 95 96 |
# File 'lib/dnn/core/layers/math_layers.rb', line 93 def forward_node(x) @x = x x**@index end |