Class: Gsplat::Ops::Eval3dRasterize

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

Overview

Differentiable world-space reference rasterizer with optional normals.

Class Method Summary collapse

Methods inherited from Autograd::Function

apply

Class Method Details

.backward(context, grad_rendered, grad_alphas, grad_normals) ⇒ 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.

Computes a central-difference VJP for the portable eval3d path.



21
22
23
24
25
26
27
28
29
# File 'lib/gsplat/ops/eval3d_rasterize.rb', line 21

def backward(context, grad_rendered, grad_alphas, grad_normals)
  *inputs, options = context.saved_values
  gradient_outputs = [grad_rendered, grad_alphas, grad_normals]
  context.needs_input_grad.each_with_index.map do |needed, input_index|
    next unless needed

    numerical_vjp(inputs, input_index, gradient_outputs, options)
  end
end

.forward(context, means, quats, scales, colors, opacities, backgrounds, **options) ⇒ Object

rubocop:disable Metrics/ParameterLists



11
12
13
14
15
16
17
# File 'lib/gsplat/ops/eval3d_rasterize.rb', line 11

def forward(context, means, quats, scales, colors, opacities, backgrounds, **options)
  # rubocop:enable Metrics/ParameterLists
  context.save(means, quats, scales, colors, opacities, backgrounds, options)
  Backend::RubyEval3dRasterizer.forward(
    means, quats, scales, colors, opacities, backgrounds, **options
  )
end