irtk.renderer.RenderFunction

class irtk.renderer.RenderFunction(*args: Any, **kwargs: Any)

Custom autograd function for rendering.

This class defines the forward and backward passes for the rendering process, allowing for automatic differentiation through the rendering operation.

__init__(*args: Any, **kwargs: Any) None
static backward(ctx: Any, grad_out: torch.Tensor) tuple

Performs the backward pass of the rendering operation.

Parameters:
  • ctx – Context object with saved information from the forward pass.

  • grad_out – Gradient of the loss with respect to the output of the forward pass.

Returns:

Gradients with respect to the inputs of the forward pass.

Return type:

tuple

static forward(ctx: Any, connector: Connector, scene: Scene, render_options: dict[str, Any], sensor_ids: List[int] | torch.Tensor, integrator_id: int, *params: Any) torch.Tensor

Performs the forward pass of the rendering operation.

Parameters:
  • ctx – Context object to save information for the backward pass.

  • connector – The connector object used for rendering.

  • scene – The scene to be rendered.

  • render_options – Options for the rendering process.

  • sensor_ids – List of sensor IDs to render from.

  • integrator_id – ID of the integrator to use.

  • *params – Additional parameters required for rendering.

Returns:

The rendered image(s) as a tensor.

Return type:

torch.Tensor