Class: DNN::Activations::ReLU
Instance Method Summary collapse
Instance Method Details
#backward(dout) ⇒ Object
37 38 39 40 41 |
# File 'lib/dnn/core/activations.rb', line 37 def backward(dout) @x[@x > 0] = 1 @x[@x <= 0] = 0 dout * @x end |
#forward(x) ⇒ Object
31 32 33 34 35 |
# File 'lib/dnn/core/activations.rb', line 31 def forward(x) @x = x.clone x[x < 0] = 0 x end |