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.
109 110 111 112 |
# File 'lib/dnn/core/layers/math_layers.rb', line 109 def initialize(index) super() @index = index end |
Instance Method Details
#backward_node(dy) ⇒ Object
119 120 121 |
# File 'lib/dnn/core/layers/math_layers.rb', line 119 def backward_node(dy) dy * @index * @x**(@index - 1) end |
#forward_node(x) ⇒ Object
114 115 116 117 |
# File 'lib/dnn/core/layers/math_layers.rb', line 114 def forward_node(x) @x = x x**@index end |