Class: DNN::Activations::Softplus

Inherits:
Layers::Layer show all
Defined in:
lib/dnn/core/activations.rb

Instance Attribute Summary

Attributes inherited from Layers::Layer

#input_shape

Instance Method Summary collapse

Methods inherited from Layers::Layer

#build, #built?, #initialize, #output_shape, #to_hash

Constructor Details

This class inherits a constructor from DNN::Layers::Layer

Instance Method Details

#backward(dout) ⇒ Object



44
45
46
# File 'lib/dnn/core/activations.rb', line 44

def backward(dout)
  dout * (1 / (1 + NMath.exp(-@x)))
end

#forward(x) ⇒ Object



39
40
41
42
# File 'lib/dnn/core/activations.rb', line 39

def forward(x)
  @x = x
  NMath.log(1 + NMath.exp(x))
end