Class: NN::ReLU
- Inherits:
-
Object
- Object
- NN::ReLU
- Defined in:
- lib/nn.rb
Instance Method Summary collapse
Instance Method Details
permalink #backward(dout) ⇒ Object
[View source]
331 332 333 334 335 |
# File 'lib/nn.rb', line 331 def backward(dout) @x[@x > 0] = 1.0 @x[@x <= 0] = 0.0 dout * @x end |
permalink #forward(x) ⇒ Object
[View source]
325 326 327 328 329 |
# File 'lib/nn.rb', line 325 def forward(x) @x = x.clone x[x < 0] = 0 x end |