Class: Gsplat::Ops::NormalizeQuaternion

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

Overview

Last-axis quaternion normalization.

Class Method Summary collapse

Methods inherited from Autograd::Function

apply

Class Method Details

.backward(context, gradient) ⇒ Object



82
83
84
# File 'lib/gsplat/ops/tensor_value_ops.rb', line 82

def backward(context, gradient)
  [Math::Quaternion.normalize_vjp(context.saved_values.first, gradient)]
end

.forward(context, value) ⇒ Object



77
78
79
80
# File 'lib/gsplat/ops/tensor_value_ops.rb', line 77

def forward(context, value)
  context.save(value)
  Math::Quaternion.normalize(value)
end