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, #compute_output_shape, #forward, from_hash, #load_hash, #to_hash
Constructor Details
#initialize(index) ⇒ Pow
Returns a new instance of Pow.
166 167 168 169 |
# File 'lib/dnn/core/layers/math_layers.rb', line 166 def initialize(index) super() @index = index end |
Instance Method Details
#backward_node(dy) ⇒ Object
176 177 178 |
# File 'lib/dnn/core/layers/math_layers.rb', line 176 def backward_node(dy) dy * @index * @x**(@index - 1) end |
#forward_node(x) ⇒ Object
171 172 173 174 |
# File 'lib/dnn/core/layers/math_layers.rb', line 171 def forward_node(x) @x = x x**@index end |