Class: Gsplat::Ops::RasterizeToPixels
- Inherits:
-
Autograd::Function
- Object
- Autograd::Function
- Gsplat::Ops::RasterizeToPixels
- Defined in:
- lib/gsplat/ops/rasterize_to_pixels.rb
Overview
Tile-accelerated alpha compositor.
Class Method Summary collapse
-
.backward(context, grad_render_colors, grad_render_alphas) ⇒ Object
private
Propagates pixel color and alpha gradients to projected attributes.
-
.forward(context, means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids, absgrad:) ⇒ Object
rubocop:disable Metrics/ParameterLists.
Methods inherited from Autograd::Function
Class Method Details
.backward(context, grad_render_colors, grad_render_alphas) ⇒ 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 pixel color and alpha gradients to projected attributes.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/gsplat/ops/rasterize_to_pixels.rb', line 41 def backward(context, grad_render_colors, grad_render_alphas) saved = context.saved_values means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, offsets, flatten_ids, render_alphas, last_ids, absgrad = saved gradients, means2d_absgrad = Backend.dispatch( :rasterize_to_pixels_backward, means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, offsets, flatten_ids, render_alphas, last_ids, grad_render_colors, grad_render_alphas, absgrad: absgrad ) if absgrad && context.inputs[0].is_a?(Autograd::Variable) context.inputs[0].accumulate_absgrad(means2d_absgrad) end [*gradients, nil, nil, nil, nil, nil, nil] end |
.forward(context, means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids, absgrad:) ⇒ Object
rubocop:disable Metrics/ParameterLists
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gsplat/ops/rasterize_to_pixels.rb', line 15 def forward(context, means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids, absgrad:) # rubocop:enable Metrics/ParameterLists render_colors, render_alphas, last_ids = Backend.dispatch( :rasterize_to_pixels_forward, means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids ) context.save( means2d, conics, colors, opacities, backgrounds, masks, width, height, tile_size, isect_offsets, flatten_ids, render_alphas, last_ids, absgrad ) [render_colors, render_alphas] end |