Class: Gsplat::Ops::Sigmoid

Inherits:
Autograd::Function show all
Defined in:
lib/gsplat/ops/tensor_value_ops.rb

Overview

Elementwise logistic activation.

Class Method Summary collapse

Methods inherited from Autograd::Function

apply

Class Method Details

.backward(context, gradient) ⇒ Object



67
68
69
70
# File 'lib/gsplat/ops/tensor_value_ops.rb', line 67

def backward(context, gradient)
  output = context.saved_values.first
  [gradient * output * (1.0 - output)]
end

.forward(context, value) ⇒ Object



61
62
63
64
65
# File 'lib/gsplat/ops/tensor_value_ops.rb', line 61

def forward(context, value)
  output = 1.0 / (1.0 + Numo::NMath.exp(-value))
  context.save(output)
  output
end