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