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