Class: Gsplat::Ops::SphericalHarmonics
- Inherits:
-
Autograd::Function
- Object
- Autograd::Function
- Gsplat::Ops::SphericalHarmonics
- Defined in:
- lib/gsplat/ops/spherical_harmonics.rb
Overview
Evaluates real SH bases through degree four.
Class Method Summary collapse
-
.backward(context, grad_output) ⇒ Object
private
Propagates an SH value gradient to directions and coefficients.
-
.forward(context, degree, directions, coefficients, masks: nil) ⇒ Object
private
Evaluates SH and stores inputs for its analytic VJP.
Methods inherited from Autograd::Function
Class Method Details
.backward(context, grad_output) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Propagates an SH value gradient to directions and coefficients.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gsplat/ops/spherical_harmonics.rb', line 26 def backward(context, grad_output) degree, directions, coefficients, masks = context.saved_values grad_directions, grad_coefficients = Backend.dispatch( :spherical_harmonics_backward, degree, directions, coefficients, grad_output, masks: masks, grad_dirs: context.needs_input_grad.fetch(1), grad_coeffs: context.needs_input_grad.fetch(2) ) [nil, grad_directions, grad_coefficients] end |
.forward(context, degree, directions, coefficients, masks: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Evaluates SH and stores inputs for its analytic VJP.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gsplat/ops/spherical_harmonics.rb', line 13 def forward(context, degree, directions, coefficients, masks: nil) context.save(degree, directions, coefficients, masks) Backend.dispatch( :spherical_harmonics_forward, degree, directions, coefficients, masks: masks ) end |