Class: GRX::NN::LeakyReLU

Inherits:
Module
  • Object
show all
Defined in:
lib/grx/nn.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Module

#call, #load_weights, #parameters, #save_weights, #zero_grad

Constructor Details

#initialize(alpha_arg = nil, alpha: nil) ⇒ LeakyReLU

Returns a new instance of LeakyReLU.



152
153
154
# File 'lib/grx/nn.rb', line 152

def initialize(alpha_arg = nil, alpha: nil)
  @alpha = (alpha || alpha_arg || 0.01).to_f
end

Instance Attribute Details

#alphaObject (readonly)

Returns the value of attribute alpha.



150
151
152
# File 'lib/grx/nn.rb', line 150

def alpha
  @alpha
end

Instance Method Details

#forward(x) ⇒ Object



155
# File 'lib/grx/nn.rb', line 155

def forward(x) = x.leaky_relu(@alpha)

#to_sObject



156
# File 'lib/grx/nn.rb', line 156

def to_s = "LeakyReLU(alpha=#{@alpha})"