torchdrivesim.rendering.nvdiffrast

Nvdiffrast-based renderers, equivalent to those based on PyTorch3D but sometimes faster. This module imports correctly if nvdiffrast is missing, but the renderer will raise the NvdiffrastNotFound exception.

Attributes

Exceptions

NvdiffrastNotFound

Nvdiffrast is not installed.

Classes

NvdiffrastRendererConfig

Configuration of nvdiffrast-based renderer.

NvdiffrastRenderer

Similar to PyTorch3DRenderer, and producing indistinguishable images, but sometimes faster.

Functions

get_glctx_session(device[, opengl])

Module Contents

torchdrivesim.rendering.nvdiffrast.is_available = True[source]
torchdrivesim.rendering.nvdiffrast.logger[source]
torchdrivesim.rendering.nvdiffrast.glctx_sessions[source]
exception torchdrivesim.rendering.nvdiffrast.NvdiffrastNotFound[source]

Bases: ImportError

Nvdiffrast is not installed.

torchdrivesim.rendering.nvdiffrast.get_glctx_session(device, opengl=True)[source]
class torchdrivesim.rendering.nvdiffrast.NvdiffrastRendererConfig[source]

Bases: torchdrivesim.rendering.base.RendererConfig

Configuration of nvdiffrast-based renderer.

backend: str = 'nvdiffrast'[source]
antialias: bool = False[source]
opengl: bool = False[source]
max_minibatch_size: int | None = None[source]
class torchdrivesim.rendering.nvdiffrast.NvdiffrastRenderer(cfg: NvdiffrastRendererConfig, *args, **kwargs)[source]

Bases: torchdrivesim.rendering.base.BirdviewRenderer

Similar to PyTorch3DRenderer, and producing indistinguishable images, but sometimes faster. Note that nvdiffrast requires separate installation and is subject to its own license terms.

cfg: NvdiffrastRendererConfig[source]
glctx[source]
render_mesh(mesh: torchdrivesim.mesh.BirdviewMesh, res: torchdrivesim.utils.Resolution, cameras: torchdrivesim.rendering.base.Cameras) torch.Tensor[source]

Renders a given mesh, producing BxHxWxC tensor image of float RGB values in [0,255] range.