Class: DNN::Layers::ReLU
- Defined in:
- lib/dnn/core/layers/activations.rb
Instance Attribute Summary
Attributes inherited from Layer
Instance Method Summary collapse
Methods inherited from Layer
#build, #built?, call, #call, #clean, from_hash, #initialize, #load_hash, #output_shape, #to_hash
Constructor Details
This class inherits a constructor from DNN::Layers::Layer
Instance Method Details
#backward(dy) ⇒ Object
63 64 65 |
# File 'lib/dnn/core/layers/activations.rb', line 63 def backward(dy) dy * Xumo::SFloat.cast(@x > 0) end |
#forward(x) ⇒ Object
58 59 60 61 |
# File 'lib/dnn/core/layers/activations.rb', line 58 def forward(x) @x = x Xumo::SFloat.maximum(0, x) end |