Functional API

The fvdb.functional module provides a pure-function alternative to the equivalent methods on Grid and GridBatch. Every operation is available as a standalone function that takes the grid as its first argument, mirroring the design of torch.nn.functional.

Each operation has two variants:

Tip

Most users should prefer the methods on Grid and GridBatch directly. The functional API is useful when building custom operations or when you need explicit control over the single-grid vs. batched code path.

Coordinate Transforms

fvdb.functional.voxel_to_world_batch(grid: GridBatch, ijk: JaggedTensor) JaggedTensor[source]

Transform voxel-space coordinates to world-space positions for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch supplying the voxel-to-world transforms.

  • ijk (JaggedTensor) – Voxel-space coordinates, shape (B, -1, 3).

Returns:

result (JaggedTensor) – World-space coordinates, shape (B, -1, 3).

fvdb.functional.voxel_to_world_single(grid: Grid, ijk: torch.Tensor) torch.Tensor[source]

Transform voxel-space coordinates to world-space positions for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The grid supplying the voxel-to-world transform.

  • ijk (torch.Tensor) – Voxel-space coordinates, shape (N, 3).

Returns:

result (torch.Tensor) – World-space coordinates, shape (N, 3).

fvdb.functional.world_to_voxel_batch(grid: GridBatch, points: JaggedTensor) JaggedTensor[source]

Transform world-space coordinates to voxel-space positions for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch supplying the world-to-voxel transforms.

  • points (JaggedTensor) – World-space positions, shape (B, -1, 3).

Returns:

result (JaggedTensor) – Voxel-space coordinates, shape (B, -1, 3).

fvdb.functional.world_to_voxel_single(grid: Grid, points: torch.Tensor) torch.Tensor[source]

Transform world-space coordinates to voxel-space positions for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The grid supplying the world-to-voxel transform.

  • points (torch.Tensor) – World-space positions, shape (N, 3).

Returns:

result (torch.Tensor) – Voxel-space coordinates, shape (N, 3).

Interpolation and Splatting

fvdb.functional.sample_trilinear_batch(grid: GridBatch, points: JaggedTensor, voxel_data: JaggedTensor) JaggedTensor[source]

Sample voxel data at world-space points using trilinear interpolation for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • points (JaggedTensor) – World-space query points, shape (B, -1, 3).

  • voxel_data (JaggedTensor) – Per-voxel feature data.

Returns:

result (JaggedTensor) – Interpolated values at each query point.

fvdb.functional.sample_trilinear_single(grid: Grid, points: torch.Tensor, voxel_data: torch.Tensor) torch.Tensor[source]

Sample voxel data at world-space points using trilinear interpolation for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • points (torch.Tensor) – World-space query points, shape (N, 3).

  • voxel_data (torch.Tensor) – Per-voxel feature data.

Returns:

result (torch.Tensor) – Interpolated values at each query point.

fvdb.functional.sample_trilinear_with_grad_batch(grid: GridBatch, points: JaggedTensor, voxel_data: JaggedTensor) tuple[JaggedTensor, JaggedTensor][source]

Sample with trilinear interpolation and return spatial gradients for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • points (JaggedTensor) – World-space query points, shape (B, -1, 3).

  • voxel_data (JaggedTensor) – Per-voxel feature data.

Returns:
  • values (JaggedTensor) – Interpolated values at each query point.

  • gradients (JaggedTensor) – Spatial gradients at each query point.

fvdb.functional.sample_trilinear_with_grad_single(grid: Grid, points: torch.Tensor, voxel_data: torch.Tensor) tuple[torch.Tensor, torch.Tensor][source]

Sample with trilinear interpolation and return spatial gradients for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • points (torch.Tensor) – World-space query points, shape (N, 3).

  • voxel_data (torch.Tensor) – Per-voxel feature data.

Returns:
  • values (torch.Tensor) – Interpolated values at each query point.

  • gradients (torch.Tensor) – Spatial gradients at each query point.

fvdb.functional.sample_bezier_batch(grid: GridBatch, points: JaggedTensor, voxel_data: JaggedTensor) JaggedTensor[source]

Sample voxel data at world-space points using Bezier interpolation for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • points (JaggedTensor) – World-space query points, shape (B, -1, 3).

  • voxel_data (JaggedTensor) – Per-voxel feature data.

Returns:

result (JaggedTensor) – Interpolated values at each query point.

fvdb.functional.sample_bezier_single(grid: Grid, points: torch.Tensor, voxel_data: torch.Tensor) torch.Tensor[source]

Sample voxel data at world-space points using Bezier interpolation for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • points (torch.Tensor) – World-space query points, shape (N, 3).

  • voxel_data (torch.Tensor) – Per-voxel feature data.

Returns:

result (torch.Tensor) – Interpolated values at each query point.

fvdb.functional.sample_bezier_with_grad_batch(grid: GridBatch, points: JaggedTensor, voxel_data: JaggedTensor) tuple[JaggedTensor, JaggedTensor][source]

Sample with Bezier interpolation and return spatial gradients for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • points (JaggedTensor) – World-space query points, shape (B, -1, 3).

  • voxel_data (JaggedTensor) – Per-voxel feature data.

Returns:
  • values (JaggedTensor) – Interpolated values at each query point.

  • gradients (JaggedTensor) – Spatial gradients at each query point.

fvdb.functional.sample_bezier_with_grad_single(grid: Grid, points: torch.Tensor, voxel_data: torch.Tensor) tuple[torch.Tensor, torch.Tensor][source]

Sample with Bezier interpolation and return spatial gradients for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • points (torch.Tensor) – World-space query points, shape (N, 3).

  • voxel_data (torch.Tensor) – Per-voxel feature data.

Returns:
  • values (torch.Tensor) – Interpolated values at each query point.

  • gradients (torch.Tensor) – Spatial gradients at each query point.

fvdb.functional.splat_trilinear_batch(grid: GridBatch, points: JaggedTensor, points_data: JaggedTensor) JaggedTensor[source]

Splat point data into voxels using trilinear weights for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • points (JaggedTensor) – World-space point positions, shape (B, -1, 3).

  • points_data (JaggedTensor) – Per-point feature data to splat.

Returns:

result (JaggedTensor) – Accumulated voxel data.

fvdb.functional.splat_trilinear_single(grid: Grid, points: torch.Tensor, points_data: torch.Tensor) torch.Tensor[source]

Splat point data into voxels using trilinear weights for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • points (torch.Tensor) – World-space point positions, shape (N, 3).

  • points_data (torch.Tensor) – Per-point feature data to splat.

Returns:

result (torch.Tensor) – Accumulated voxel data.

fvdb.functional.splat_bezier_batch(grid: GridBatch, points: JaggedTensor, points_data: JaggedTensor) JaggedTensor[source]

Splat point data into voxels using Bezier weights for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • points (JaggedTensor) – World-space point positions, shape (B, -1, 3).

  • points_data (JaggedTensor) – Per-point feature data to splat.

Returns:

result (JaggedTensor) – Accumulated voxel data.

fvdb.functional.splat_bezier_single(grid: Grid, points: torch.Tensor, points_data: torch.Tensor) torch.Tensor[source]

Splat point data into voxels using Bezier weights for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • points (torch.Tensor) – World-space point positions, shape (N, 3).

  • points_data (torch.Tensor) – Per-point feature data to splat.

Returns:

result (torch.Tensor) – Accumulated voxel data.

Pooling and Refinement

fvdb.functional.max_pool_batch(grid: GridBatch, pool_factor: NumericMaxRank1, data: JaggedTensor, stride: NumericMaxRank1 = 0, coarse_grid: GridBatch | None = None) tuple[JaggedTensor, GridBatch][source]

Max-pool voxel data on a grid batch, reducing resolution by pool_factor.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The fine grid batch.

  • pool_factor (NumericMaxRank1) – Pooling factor per axis, broadcastable to (3,).

  • data (JaggedTensor) – Per-voxel feature data on the fine grid.

  • stride (NumericMaxRank1) – Pooling stride per axis. Default 0 uses pool_factor.

  • coarse_grid (GridBatch | None) – Optional pre-computed coarse grid batch.

Returns:
  • pooled_data (JaggedTensor) – Pooled feature data on the coarse grid.

  • coarse_grid (GridBatch) – The coarse grid batch.

fvdb.functional.max_pool_single(grid: Grid, pool_factor: NumericMaxRank1, data: torch.Tensor, stride: NumericMaxRank1 = 0, coarse_grid: Grid | None = None) tuple[torch.Tensor, Grid][source]

Max-pool voxel data on a single grid, reducing resolution by pool_factor.

Supports backpropagation.

Parameters:
  • grid (Grid) – The fine single grid.

  • pool_factor (NumericMaxRank1) – Pooling factor per axis, broadcastable to (3,).

  • data (torch.Tensor) – Per-voxel feature data on the fine grid.

  • stride (NumericMaxRank1) – Pooling stride per axis. Default 0 uses pool_factor.

  • coarse_grid (Grid | None) – Optional pre-computed coarse grid.

Returns:
  • pooled_data (torch.Tensor) – Pooled feature data on the coarse grid.

  • coarse_grid (Grid) – The coarse grid.

See also

max_pool_batch()

fvdb.functional.avg_pool_batch(grid: GridBatch, pool_factor: NumericMaxRank1, data: JaggedTensor, stride: NumericMaxRank1 = 0, coarse_grid: GridBatch | None = None) tuple[JaggedTensor, GridBatch][source]

Average-pool voxel data on a grid batch, reducing resolution by pool_factor.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The fine grid batch.

  • pool_factor (NumericMaxRank1) – Pooling factor per axis, broadcastable to (3,).

  • data (JaggedTensor) – Per-voxel feature data on the fine grid.

  • stride (NumericMaxRank1) – Pooling stride per axis. Default 0 uses pool_factor.

  • coarse_grid (GridBatch | None) – Optional pre-computed coarse grid batch.

Returns:
  • pooled_data (JaggedTensor) – Pooled feature data on the coarse grid.

  • coarse_grid (GridBatch) – The coarse grid batch.

fvdb.functional.avg_pool_single(grid: Grid, pool_factor: NumericMaxRank1, data: torch.Tensor, stride: NumericMaxRank1 = 0, coarse_grid: Grid | None = None) tuple[torch.Tensor, Grid][source]

Average-pool voxel data on a single grid, reducing resolution by pool_factor.

Supports backpropagation.

Parameters:
  • grid (Grid) – The fine single grid.

  • pool_factor (NumericMaxRank1) – Pooling factor per axis, broadcastable to (3,).

  • data (torch.Tensor) – Per-voxel feature data on the fine grid.

  • stride (NumericMaxRank1) – Pooling stride per axis. Default 0 uses pool_factor.

  • coarse_grid (Grid | None) – Optional pre-computed coarse grid.

Returns:
  • pooled_data (torch.Tensor) – Pooled feature data on the coarse grid.

  • coarse_grid (Grid) – The coarse grid.

See also

avg_pool_batch()

fvdb.functional.refine_batch(grid: GridBatch, subdiv_factor: NumericMaxRank1, data: JaggedTensor, mask: JaggedTensor | None = None, refined: GridBatch | None = None) tuple[JaggedTensor, GridBatch][source]

Refine (upsample) voxel data by subdividing each voxel on a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The coarse grid batch.

  • subdiv_factor (NumericMaxRank1) – Subdivision factor per axis, broadcastable to (3,).

  • data (JaggedTensor) – Per-voxel feature data on the coarse grid.

  • mask (JaggedTensor | None) – Optional boolean mask selecting voxels to refine.

  • refined (GridBatch | None) – Optional pre-computed fine grid batch.

Returns:
  • refined_data (JaggedTensor) – Refined feature data on the fine grid.

  • fine_grid (GridBatch) – The fine grid batch.

See also

refine_single()

fvdb.functional.refine_single(grid: Grid, subdiv_factor: NumericMaxRank1, data: torch.Tensor, mask: torch.Tensor | None = None, refined: Grid | None = None) tuple[torch.Tensor, Grid][source]

Refine (upsample) voxel data by subdividing each voxel on a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The coarse single grid.

  • subdiv_factor (NumericMaxRank1) – Subdivision factor per axis, broadcastable to (3,).

  • data (torch.Tensor) – Per-voxel feature data on the coarse grid.

  • mask (torch.Tensor | None) – Optional boolean mask selecting voxels to refine.

  • refined (Grid | None) – Optional pre-computed fine grid.

Returns:
  • refined_data (torch.Tensor) – Refined feature data on the fine grid.

  • fine_grid (Grid) – The fine grid.

See also

refine_batch()

Spatial Queries

fvdb.functional.points_in_grid_batch(grid: GridBatch, points: JaggedTensor) JaggedTensor[source]

Check if world-space points are located within active voxels of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to test against.

  • points (JaggedTensor) – World-space points, shape (B, -1, 3).

Returns:

mask (JaggedTensor) – Boolean mask indicating which points are in active voxels.

fvdb.functional.points_in_grid_single(grid: Grid, points: torch.Tensor) torch.Tensor[source]

Check if world-space points are located within active voxels of a single grid.

Parameters:
  • grid (Grid) – The single grid to test against.

  • points (torch.Tensor) – World-space points, shape (N, 3).

Returns:

mask (torch.Tensor) – Boolean mask indicating which points are in active voxels.

fvdb.functional.coords_in_grid_batch(grid: GridBatch, ijk: JaggedTensor) JaggedTensor[source]

Check which voxel-space coordinates lie on active voxels of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to test against.

  • ijk (JaggedTensor) – Voxel coordinates with integer dtype.

Returns:

mask (JaggedTensor) – Boolean mask indicating which coordinates correspond to active voxels.

fvdb.functional.coords_in_grid_single(grid: Grid, ijk: torch.Tensor) torch.Tensor[source]

Check which voxel-space coordinates lie on active voxels of a single grid.

Parameters:
  • grid (Grid) – The single grid to test against.

  • ijk (torch.Tensor) – Voxel coordinates with integer dtype.

Returns:

mask (torch.Tensor) – Boolean mask indicating which coordinates correspond to active voxels.

fvdb.functional.cubes_in_grid_batch(grid: GridBatch, cube_centers: JaggedTensor, cube_min: NumericMaxRank1 = 0.0, cube_max: NumericMaxRank1 = 0.0) JaggedTensor[source]

Check if axis-aligned cubes are fully contained within active voxels of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to test against.

  • cube_centers (JaggedTensor) – World-space cube centers, shape (B, -1, 3).

  • cube_min (NumericMaxRank1) – Minimum offsets from center, broadcastable to (3,).

  • cube_max (NumericMaxRank1) – Maximum offsets from center, broadcastable to (3,).

Returns:

mask (JaggedTensor) – Boolean mask indicating which cubes are fully contained.

fvdb.functional.cubes_in_grid_single(grid: Grid, cube_centers: torch.Tensor, cube_min: NumericMaxRank1 = 0.0, cube_max: NumericMaxRank1 = 0.0) torch.Tensor[source]

Check if axis-aligned cubes are fully contained within active voxels of a single grid.

Parameters:
  • grid (Grid) – The single grid to test against.

  • cube_centers (torch.Tensor) – World-space cube centers, shape (N, 3).

  • cube_min (NumericMaxRank1) – Minimum offsets from center, broadcastable to (3,).

  • cube_max (NumericMaxRank1) – Maximum offsets from center, broadcastable to (3,).

Returns:

mask (torch.Tensor) – Boolean mask indicating which cubes are fully contained.

fvdb.functional.cubes_intersect_grid_batch(grid: GridBatch, cube_centers: JaggedTensor, cube_min: NumericMaxRank1 = 0.0, cube_max: NumericMaxRank1 = 0.0) JaggedTensor[source]

Check if axis-aligned cubes intersect any active voxels of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to test against.

  • cube_centers (JaggedTensor) – World-space cube centers, shape (B, -1, 3).

  • cube_min (NumericMaxRank1) – Minimum offsets from center, broadcastable to (3,).

  • cube_max (NumericMaxRank1) – Maximum offsets from center, broadcastable to (3,).

Returns:

mask (JaggedTensor) – Boolean mask indicating which cubes intersect the grid.

fvdb.functional.cubes_intersect_grid_single(grid: Grid, cube_centers: torch.Tensor, cube_min: NumericMaxRank1 = 0.0, cube_max: NumericMaxRank1 = 0.0) torch.Tensor[source]

Check if axis-aligned cubes intersect any active voxels of a single grid.

Parameters:
  • grid (Grid) – The single grid to test against.

  • cube_centers (torch.Tensor) – World-space cube centers, shape (N, 3).

  • cube_min (NumericMaxRank1) – Minimum offsets from center, broadcastable to (3,).

  • cube_max (NumericMaxRank1) – Maximum offsets from center, broadcastable to (3,).

Returns:

mask (torch.Tensor) – Boolean mask indicating which cubes intersect the grid.

fvdb.functional.ijk_to_index_batch(grid: GridBatch, ijk: JaggedTensor, cumulative: bool = False) JaggedTensor[source]

Convert voxel-space coordinates to linear indices in a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to index into.

  • ijk (JaggedTensor) – Voxel coordinates with integer dtype.

  • cumulative (bool) – If True, return indices cumulative across the batch.

Returns:

indices (JaggedTensor) – Linear indices (-1 for inactive coordinates).

fvdb.functional.ijk_to_index_single(grid: Grid, ijk: torch.Tensor, cumulative: bool = False) torch.Tensor[source]

Convert voxel-space coordinates to linear indices in a single grid.

Parameters:
  • grid (Grid) – The single grid to index into.

  • ijk (torch.Tensor) – Voxel coordinates with integer dtype.

  • cumulative (bool) – If True, return indices cumulative across the batch.

Returns:

indices (torch.Tensor) – Linear indices (-1 for inactive coordinates).

fvdb.functional.ijk_to_inv_index_batch(grid: GridBatch, ijk: JaggedTensor, cumulative: bool = False) JaggedTensor[source]

Get the inverse permutation of ijk_to_index_batch() for a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to index into.

  • ijk (JaggedTensor) – Voxel coordinates with integer dtype.

  • cumulative (bool) – If True, return indices cumulative across the batch.

Returns:

indices (JaggedTensor) – Inverse permutation indices.

fvdb.functional.ijk_to_inv_index_single(grid: Grid, ijk: torch.Tensor, cumulative: bool = False) torch.Tensor[source]

Get the inverse permutation of ijk_to_index_single() for a single grid.

Parameters:
  • grid (Grid) – The single grid to index into.

  • ijk (torch.Tensor) – Voxel coordinates with integer dtype.

  • cumulative (bool) – If True, return indices cumulative across the batch.

Returns:

indices (torch.Tensor) – Inverse permutation indices.

fvdb.functional.neighbor_indexes_batch(grid: GridBatch, ijk: JaggedTensor, extent: int, bitshift: int = 0) JaggedTensor[source]

Get linear indices of neighboring voxels in an N-ring neighborhood for a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to query.

  • ijk (JaggedTensor) – Voxel coordinates with integer dtype.

  • extent (int) – Neighborhood ring size.

  • bitshift (int) – Optional bit shift applied to input coordinates. Default 0.

Returns:

indices (JaggedTensor) – Neighbor indices; -1 for inactive neighbors.

fvdb.functional.neighbor_indexes_single(grid: Grid, ijk: torch.Tensor, extent: int, bitshift: int = 0) torch.Tensor[source]

Get linear indices of neighboring voxels in an N-ring neighborhood for a single grid.

Parameters:
  • grid (Grid) – The single grid to query.

  • ijk (torch.Tensor) – Voxel coordinates with integer dtype.

  • extent (int) – Neighborhood ring size.

  • bitshift (int) – Optional bit shift applied to input coordinates. Default 0.

Returns:

indices (torch.Tensor) – Neighbor indices; -1 for inactive neighbors.

fvdb.functional.active_grid_coords_batch(grid: GridBatch) JaggedTensor[source]

Return the voxel coordinates of every active voxel in a grid batch, in index order.

Parameters:

grid (GridBatch) – The grid batch to query.

Returns:

ijk (JaggedTensor) – Voxel coordinates, shape (B, -1, 3).

fvdb.functional.active_grid_coords_single(grid: Grid) torch.Tensor[source]

Return the voxel coordinates of every active voxel in a single grid, in index order.

Parameters:

grid (Grid) – The single grid to query.

Returns:

ijk (torch.Tensor) – Voxel coordinates, shape (N, 3).

Dense–Sparse Conversion

fvdb.functional.inject_from_dense_cminor_batch(grid: GridBatch, dense_data: torch.Tensor, dense_origin: NumericMaxRank1 = 0) JaggedTensor[source]

Inject values from a dense tensor (XYZC order) into sparse voxel data for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • dense_data (torch.Tensor) – Dense input tensor, shape (B, X, Y, Z, C*).

  • dense_origin (NumericMaxRank1) – Voxel-space origin of the dense tensor.

Returns:

result (JaggedTensor) – Sparse voxel data extracted from the dense tensor.

fvdb.functional.inject_from_dense_cminor_single(grid: Grid, dense_data: torch.Tensor, dense_origin: NumericMaxRank1 = 0) torch.Tensor[source]

Inject values from a dense tensor (XYZC order) into sparse voxel data for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • dense_data (torch.Tensor) – Dense input tensor, shape (1, X, Y, Z, C*).

  • dense_origin (NumericMaxRank1) – Voxel-space origin of the dense tensor.

Returns:

result (torch.Tensor) – Sparse voxel data extracted from the dense tensor.

fvdb.functional.inject_from_dense_cmajor_batch(grid: GridBatch, dense_data: torch.Tensor, dense_origin: NumericMaxRank1 = 0) JaggedTensor[source]

Inject values from a dense tensor (CXYZ order) into sparse voxel data for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • dense_data (torch.Tensor) – Dense input tensor, shape (B, C*, X, Y, Z).

  • dense_origin (NumericMaxRank1) – Voxel-space origin of the dense tensor.

Returns:

result (JaggedTensor) – Sparse voxel data extracted from the dense tensor.

fvdb.functional.inject_from_dense_cmajor_single(grid: Grid, dense_data: torch.Tensor, dense_origin: NumericMaxRank1 = 0) torch.Tensor[source]

Inject values from a dense tensor (CXYZ order) into sparse voxel data for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • dense_data (torch.Tensor) – Dense input tensor, shape (1, C*, X, Y, Z).

  • dense_origin (NumericMaxRank1) – Voxel-space origin of the dense tensor.

Returns:

result (torch.Tensor) – Sparse voxel data extracted from the dense tensor.

fvdb.functional.inject_to_dense_cminor_batch(grid: GridBatch, sparse_data: JaggedTensor, min_coord: NumericMaxRank1 | NumericMaxRank2 | None = None, grid_size: NumericMaxRank1 | None = None) torch.Tensor[source]

Write sparse voxel data into a dense tensor (XYZC order) for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • sparse_data (JaggedTensor) – Per-voxel feature data.

  • min_coord (NumericMaxRank1 | NumericMaxRank2 | None) – Minimum voxel coordinate for the dense grid.

  • grid_size (NumericMaxRank1 | None) – Size of the dense grid, broadcastable to (3,).

Returns:

result (torch.Tensor) – Dense tensor, shape (B, X, Y, Z, C*).

fvdb.functional.inject_to_dense_cminor_single(grid: Grid, sparse_data: torch.Tensor, min_coord: NumericMaxRank1 | None = None, grid_size: NumericMaxRank1 | None = None) torch.Tensor[source]

Write sparse voxel data into a dense tensor (XYZC order) for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • sparse_data (torch.Tensor) – Per-voxel feature data.

  • min_coord (NumericMaxRank1 | None) – Minimum voxel coordinate for the dense grid.

  • grid_size (NumericMaxRank1 | None) – Size of the dense grid, broadcastable to (3,).

Returns:

result (torch.Tensor) – Dense tensor, shape (1, X, Y, Z, C*).

fvdb.functional.inject_to_dense_cmajor_batch(grid: GridBatch, sparse_data: JaggedTensor, min_coord: NumericMaxRank1 | NumericMaxRank2 | None = None, grid_size: NumericMaxRank1 | None = None) torch.Tensor[source]

Write sparse voxel data into a dense tensor (CXYZ order) for a grid batch.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • sparse_data (JaggedTensor) – Per-voxel feature data.

  • min_coord (NumericMaxRank1 | NumericMaxRank2 | None) – Minimum voxel coordinate for the dense grid.

  • grid_size (NumericMaxRank1 | None) – Size of the dense grid, broadcastable to (3,).

Returns:

result (torch.Tensor) – Dense tensor, shape (B, C*, X, Y, Z).

fvdb.functional.inject_to_dense_cmajor_single(grid: Grid, sparse_data: torch.Tensor, min_coord: NumericMaxRank1 | None = None, grid_size: NumericMaxRank1 | None = None) torch.Tensor[source]

Write sparse voxel data into a dense tensor (CXYZ order) for a single grid.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • sparse_data (torch.Tensor) – Per-voxel feature data.

  • min_coord (NumericMaxRank1 | None) – Minimum voxel coordinate for the dense grid.

  • grid_size (NumericMaxRank1 | None) – Size of the dense grid, broadcastable to (3,).

Returns:

result (torch.Tensor) – Dense tensor, shape (1, C*, X, Y, Z).

Grid-to-Grid Injection

fvdb.functional.inject_batch(dst_grid: GridBatch, src_grid: GridBatch, src: JaggedTensor, dst: JaggedTensor | None = None, default_value: float | int | bool = 0) JaggedTensor[source]

Inject data from src_grid into dst_grid in voxel space for grid batches.

Supports backpropagation.

Parameters:
  • dst_grid (GridBatch) – The destination grid batch.

  • src_grid (GridBatch) – The source grid batch.

  • src (JaggedTensor) – Source per-voxel data.

  • dst (JaggedTensor | None) – Optional destination buffer; created with default_value if None.

  • default_value (float | int | bool) – Fill value for unmatched voxels. Default 0.

Returns:

result (JaggedTensor) – Destination data with injected values.

See also

inject_single()

fvdb.functional.inject_single(dst_grid: Grid, src_grid: Grid, src: torch.Tensor, dst: torch.Tensor | None = None, default_value: float | int | bool = 0) torch.Tensor[source]

Inject data from src_grid into dst_grid in voxel space for single grids.

Supports backpropagation.

Parameters:
  • dst_grid (Grid) – The destination single grid.

  • src_grid (Grid) – The source single grid.

  • src (torch.Tensor) – Source per-voxel data.

  • dst (torch.Tensor | None) – Optional destination buffer; created with default_value if None.

  • default_value (float | int | bool) – Fill value for unmatched voxels. Default 0.

Returns:

result (torch.Tensor) – Destination data with injected values.

See also

inject_batch()

fvdb.functional.inject_from_ijk_batch(grid: GridBatch, src_ijk: JaggedTensor, src: JaggedTensor, dst: JaggedTensor | None = None, default_value: float | int | bool = 0) JaggedTensor[source]

Inject data from source voxel coordinates into a grid batch’s voxel data.

Supports backpropagation.

Parameters:
  • grid (GridBatch) – The grid batch to inject into.

  • src_ijk (JaggedTensor) – Source voxel coordinates, shape (B, -1, 3).

  • src (JaggedTensor) – Source per-voxel data.

  • dst (JaggedTensor | None) – Optional destination buffer; created with default_value if None.

  • default_value (float | int | bool) – Fill value for unmatched voxels. Default 0.

Returns:

result (JaggedTensor) – Destination data with injected values.

fvdb.functional.inject_from_ijk_single(grid: Grid, src_ijk: torch.Tensor, src: torch.Tensor, dst: torch.Tensor | None = None, default_value: float | int | bool = 0) torch.Tensor[source]

Inject data from source voxel coordinates into a single grid’s voxel data.

Supports backpropagation.

Parameters:
  • grid (Grid) – The single grid to inject into.

  • src_ijk (torch.Tensor) – Source voxel coordinates, shape (N, 3).

  • src (torch.Tensor) – Source per-voxel data.

  • dst (torch.Tensor | None) – Optional destination buffer; created with default_value if None.

  • default_value (float | int | bool) – Fill value for unmatched voxels. Default 0.

Returns:

result (torch.Tensor) – Destination data with injected values.

Ray Operations

fvdb.functional.voxels_along_rays_batch(grid: GridBatch, ray_origins: JaggedTensor, ray_directions: JaggedTensor, max_voxels: int, eps: float = 0.0, return_ijk: bool = False, cumulative: bool = False) tuple[JaggedTensor, JaggedTensor][source]

Enumerate voxels intersected by rays using a DDA traversal on a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to trace through.

  • ray_origins (JaggedTensor) – Ray origin positions, shape (B, -1, 3).

  • ray_directions (JaggedTensor) – Ray direction vectors, shape (B, -1, 3).

  • max_voxels (int) – Maximum number of voxels to return per ray.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

  • return_ijk (bool) – If True, return voxel coordinates instead of linear indices.

  • cumulative (bool) – If True, return cumulative indices across the batch.

Returns:
  • voxels (JaggedTensor) – Voxel coordinates or linear indices per ray hit.

  • distances (JaggedTensor) – (t_entry, t_exit) pairs per ray hit.

fvdb.functional.voxels_along_rays_single(grid: Grid, ray_origins: torch.Tensor, ray_directions: torch.Tensor, max_voxels: int, eps: float = 0.0, return_ijk: bool = False) tuple[JaggedTensor, JaggedTensor][source]

Enumerate voxels intersected by rays using a DDA traversal on a single grid.

Parameters:
  • grid (Grid) – The single grid to trace through.

  • ray_origins (torch.Tensor) – Ray origin positions, shape (N, 3).

  • ray_directions (torch.Tensor) – Ray direction vectors, shape (N, 3).

  • max_voxels (int) – Maximum number of voxels to return per ray.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

  • return_ijk (bool) – If True, return voxel coordinates instead of linear indices.

Returns:
  • voxels (JaggedTensor) – Voxel coordinates or linear indices per ray hit.

  • distances (JaggedTensor) – (t_entry, t_exit) pairs per ray hit.

fvdb.functional.segments_along_rays_batch(grid: GridBatch, ray_origins: JaggedTensor, ray_directions: JaggedTensor, max_segments: int, eps: float = 0.0) JaggedTensor[source]

Return continuous segments of ray traversal through a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to trace through.

  • ray_origins (JaggedTensor) – Ray origin positions, shape (B, -1, 3).

  • ray_directions (JaggedTensor) – Ray direction vectors, shape (B, -1, 3).

  • max_segments (int) – Maximum number of segments to return per ray.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

segments (JaggedTensor) – (t_start, t_end) pairs per ray segment.

fvdb.functional.segments_along_rays_single(grid: Grid, ray_origins: torch.Tensor, ray_directions: torch.Tensor, max_segments: int, eps: float = 0.0) JaggedTensor[source]

Return continuous segments of ray traversal through a single grid.

Parameters:
  • grid (Grid) – The single grid to trace through.

  • ray_origins (torch.Tensor) – Ray origin positions, shape (N, 3).

  • ray_directions (torch.Tensor) – Ray direction vectors, shape (N, 3).

  • max_segments (int) – Maximum number of segments to return per ray.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

segments (JaggedTensor) – (t_start, t_end) pairs per ray segment.

fvdb.functional.uniform_ray_samples_batch(grid: GridBatch, ray_origins: JaggedTensor, ray_directions: JaggedTensor, t_min: JaggedTensor, t_max: JaggedTensor, step_size: float, cone_angle: float = 0.0, include_end_segments: bool = True, return_midpoints: bool = False, eps: float = 0.0) JaggedTensor[source]

Generate uniformly spaced samples along rays that intersect active voxels of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to sample through.

  • ray_origins (JaggedTensor) – Ray origin positions, shape (B, -1, 3).

  • ray_directions (JaggedTensor) – Ray direction vectors, shape (B, -1, 3).

  • t_min (JaggedTensor) – Minimum ray distances per ray.

  • t_max (JaggedTensor) – Maximum ray distances per ray.

  • step_size (float) – Distance between consecutive samples.

  • cone_angle (float) – Cone angle for mip-mapping. Default 0.0.

  • include_end_segments (bool) – Include segment endpoints. Default True.

  • return_midpoints (bool) – Return midpoints instead of boundaries. Default False.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

samples (JaggedTensor) – Sample distances along each ray.

fvdb.functional.uniform_ray_samples_single(grid: Grid, ray_origins: torch.Tensor, ray_directions: torch.Tensor, t_min: torch.Tensor, t_max: torch.Tensor, step_size: float, cone_angle: float = 0.0, include_end_segments: bool = True, return_midpoints: bool = False, eps: float = 0.0) JaggedTensor[source]

Generate uniformly spaced samples along rays that intersect active voxels of a single grid.

Parameters:
  • grid (Grid) – The single grid to sample through.

  • ray_origins (torch.Tensor) – Ray origin positions, shape (N, 3).

  • ray_directions (torch.Tensor) – Ray direction vectors, shape (N, 3).

  • t_min (torch.Tensor) – Minimum ray distances per ray.

  • t_max (torch.Tensor) – Maximum ray distances per ray.

  • step_size (float) – Distance between consecutive samples.

  • cone_angle (float) – Cone angle for mip-mapping. Default 0.0.

  • include_end_segments (bool) – Include segment endpoints. Default True.

  • return_midpoints (bool) – Return midpoints instead of boundaries. Default False.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

samples (JaggedTensor) – Sample distances along each ray.

fvdb.functional.ray_implicit_intersection_batch(grid: GridBatch, ray_origins: JaggedTensor, ray_directions: JaggedTensor, grid_scalars: JaggedTensor, eps: float = 0.0) JaggedTensor[source]

Find ray intersections with an implicit surface defined by grid scalars on a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch defining the implicit surface topology.

  • ray_origins (JaggedTensor) – Ray origin positions, shape (B, -1, 3).

  • ray_directions (JaggedTensor) – Ray direction vectors, shape (B, -1, 3).

  • grid_scalars (JaggedTensor) – Per-voxel scalar values defining the implicit surface.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

distances (JaggedTensor) – Intersection distance per ray, or -1 if no intersection.

fvdb.functional.ray_implicit_intersection_single(grid: Grid, ray_origins: torch.Tensor, ray_directions: torch.Tensor, grid_scalars: torch.Tensor, eps: float = 0.0) torch.Tensor[source]

Find ray intersections with an implicit surface defined by grid scalars on a single grid.

Parameters:
  • grid (Grid) – The single grid defining the implicit surface topology.

  • ray_origins (torch.Tensor) – Ray origin positions, shape (N, 3).

  • ray_directions (torch.Tensor) – Ray direction vectors, shape (N, 3).

  • grid_scalars (torch.Tensor) – Per-voxel scalar values defining the implicit surface.

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

distances (torch.Tensor) – Intersection distance per ray, or -1 if no intersection.

fvdb.functional.rays_intersect_voxels_batch(grid: GridBatch, ray_origins: JaggedTensor, ray_directions: JaggedTensor, eps: float = 0.0) JaggedTensor[source]

Check whether rays hit any voxels in a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to test against.

  • ray_origins (JaggedTensor) – Ray origin positions, shape (B, -1, 3).

  • ray_directions (JaggedTensor) – Ray direction vectors, shape (B, -1, 3).

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

hit (JaggedTensor) – Boolean mask indicating whether each ray hit a voxel.

fvdb.functional.rays_intersect_voxels_single(grid: Grid, ray_origins: torch.Tensor, ray_directions: torch.Tensor, eps: float = 0.0) torch.Tensor[source]

Check whether rays hit any voxels in a single grid.

Parameters:
  • grid (Grid) – The single grid to test against.

  • ray_origins (torch.Tensor) – Ray origin positions, shape (N, 3).

  • ray_directions (torch.Tensor) – Ray direction vectors, shape (N, 3).

  • eps (float) – Small offset to avoid self-intersection. Default 0.0.

Returns:

hit (torch.Tensor) – Boolean mask indicating whether each ray hit a voxel.

Meshing and TSDF Integration

fvdb.functional.marching_cubes_batch(grid: GridBatch, field: JaggedTensor, level: float = 0.0) tuple[JaggedTensor, JaggedTensor, JaggedTensor][source]

Extract isosurface meshes using marching cubes on a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch defining the sparse topology.

  • field (JaggedTensor) – Per-voxel scalar field values.

  • level (float) – Isovalue at which to extract the surface. Default 0.0.

Returns:
  • vertices (JaggedTensor) – Mesh vertex positions, shape (B, -1, 3).

  • faces (JaggedTensor) – Triangle face indices.

  • normals (JaggedTensor) – Per-vertex normals.

fvdb.functional.marching_cubes_single(grid: Grid, field: torch.Tensor, level: float = 0.0) tuple[torch.Tensor, torch.Tensor, torch.Tensor][source]

Extract isosurface mesh using marching cubes on a single grid.

Parameters:
  • grid (Grid) – The single grid defining the sparse topology.

  • field (torch.Tensor) – Per-voxel scalar field values.

  • level (float) – Isovalue at which to extract the surface. Default 0.0.

Returns:
  • vertices (torch.Tensor) – Mesh vertex positions, shape (N, 3).

  • faces (torch.Tensor) – Triangle face indices.

  • normals (torch.Tensor) – Per-vertex normals.

fvdb.functional.integrate_tsdf_batch(grid: GridBatch, truncation_distance: float, projection_matrices: torch.Tensor, cam_to_world_matrices: torch.Tensor, tsdf: JaggedTensor, weights: JaggedTensor, depth_images: torch.Tensor, weight_images: torch.Tensor | None = None) tuple[GridBatch, JaggedTensor, JaggedTensor][source]

Integrate depth images into a TSDF volume for a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch defining the TSDF topology.

  • truncation_distance (float) – TSDF truncation distance.

  • projection_matrices (torch.Tensor) – Camera projection matrices.

  • cam_to_world_matrices (torch.Tensor) – Camera-to-world transform matrices.

  • tsdf (JaggedTensor) – Current TSDF values.

  • weights (JaggedTensor) – Current integration weights.

  • depth_images (torch.Tensor) – Depth images to integrate.

  • weight_images (torch.Tensor | None) – Optional per-pixel weight images.

Returns:
  • updated_grid (GridBatch) – The updated grid batch.

  • updated_tsdf (JaggedTensor) – Updated TSDF values.

  • updated_weights (JaggedTensor) – Updated integration weights.

fvdb.functional.integrate_tsdf_single(grid: Grid, truncation_distance: float, projection_matrices: torch.Tensor, cam_to_world_matrices: torch.Tensor, tsdf: torch.Tensor, weights: torch.Tensor, depth_images: torch.Tensor, weight_images: torch.Tensor | None = None) tuple[Grid, torch.Tensor, torch.Tensor][source]

Integrate depth images into a TSDF volume for a single grid.

Parameters:
  • grid (Grid) – The single grid defining the TSDF topology.

  • truncation_distance (float) – TSDF truncation distance.

  • projection_matrices (torch.Tensor) – Camera projection matrices.

  • cam_to_world_matrices (torch.Tensor) – Camera-to-world transform matrices.

  • tsdf (torch.Tensor) – Current TSDF values.

  • weights (torch.Tensor) – Current integration weights.

  • depth_images (torch.Tensor) – Depth images to integrate.

  • weight_images (torch.Tensor | None) – Optional per-pixel weight images.

Returns:
  • updated_grid (Grid) – The updated grid.

  • updated_tsdf (torch.Tensor) – Updated TSDF values.

  • updated_weights (torch.Tensor) – Updated integration weights.

fvdb.functional.integrate_tsdf_with_features_batch(grid: GridBatch, truncation_distance: float, projection_matrices: torch.Tensor, cam_to_world_matrices: torch.Tensor, tsdf: JaggedTensor, features: JaggedTensor, weights: JaggedTensor, depth_images: torch.Tensor, feature_images: torch.Tensor, weight_images: torch.Tensor | None = None) tuple[GridBatch, JaggedTensor, JaggedTensor, JaggedTensor][source]

Integrate depth and feature images into a TSDF volume with features for a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch defining the TSDF topology.

  • truncation_distance (float) – TSDF truncation distance.

  • projection_matrices (torch.Tensor) – Camera projection matrices.

  • cam_to_world_matrices (torch.Tensor) – Camera-to-world transform matrices.

  • tsdf (JaggedTensor) – Current TSDF values.

  • features (JaggedTensor) – Current per-voxel features.

  • weights (JaggedTensor) – Current integration weights.

  • depth_images (torch.Tensor) – Depth images to integrate.

  • feature_images (torch.Tensor) – Feature images to integrate.

  • weight_images (torch.Tensor | None) – Optional per-pixel weight images.

Returns:
  • updated_grid (GridBatch) – The updated grid batch.

  • updated_tsdf (JaggedTensor) – Updated TSDF values.

  • updated_weights (JaggedTensor) – Updated integration weights.

  • updated_features (JaggedTensor) – Updated per-voxel features.

fvdb.functional.integrate_tsdf_with_features_single(grid: Grid, truncation_distance: float, projection_matrices: torch.Tensor, cam_to_world_matrices: torch.Tensor, tsdf: torch.Tensor, features: torch.Tensor, weights: torch.Tensor, depth_images: torch.Tensor, feature_images: torch.Tensor, weight_images: torch.Tensor | None = None) tuple[Grid, torch.Tensor, torch.Tensor, torch.Tensor][source]

Integrate depth and feature images into a TSDF volume with features for a single grid.

Parameters:
  • grid (Grid) – The single grid defining the TSDF topology.

  • truncation_distance (float) – TSDF truncation distance.

  • projection_matrices (torch.Tensor) – Camera projection matrices.

  • cam_to_world_matrices (torch.Tensor) – Camera-to-world transform matrices.

  • tsdf (torch.Tensor) – Current TSDF values.

  • features (torch.Tensor) – Current per-voxel features.

  • weights (torch.Tensor) – Current integration weights.

  • depth_images (torch.Tensor) – Depth images to integrate.

  • feature_images (torch.Tensor) – Feature images to integrate.

  • weight_images (torch.Tensor | None) – Optional per-pixel weight images.

Returns:
  • updated_grid (Grid) – The updated grid.

  • updated_tsdf (torch.Tensor) – Updated TSDF values.

  • updated_weights (torch.Tensor) – Updated integration weights.

  • updated_features (torch.Tensor) – Updated per-voxel features.

Grid Topology

fvdb.functional.coarsened_grid_batch(grid: GridBatch, coarsening_factor: NumericMaxRank1) GridBatch[source]

Return a coarsened version of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to coarsen.

  • coarsening_factor (NumericMaxRank1) – Factor per axis, broadcastable to (3,).

Returns:

result (GridBatch) – The coarsened grid batch.

fvdb.functional.coarsened_grid_single(grid: Grid, coarsening_factor: NumericMaxRank1) Grid[source]

Return a coarsened version of a single grid.

Parameters:
  • grid (Grid) – The single grid to coarsen.

  • coarsening_factor (NumericMaxRank1) – Factor per axis, broadcastable to (3,).

Returns:

result (Grid) – The coarsened grid.

fvdb.functional.refined_grid_batch(grid: GridBatch, subdiv_factor: NumericMaxRank1, mask: JaggedTensor | None = None) GridBatch[source]

Return a refined (subdivided) version of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to refine.

  • subdiv_factor (NumericMaxRank1) – Subdivision factor per axis, broadcastable to (3,).

  • mask (JaggedTensor | None) – Optional boolean mask selecting voxels to refine.

Returns:

result (GridBatch) – The refined grid batch.

fvdb.functional.refined_grid_single(grid: Grid, subdiv_factor: NumericMaxRank1, mask: torch.Tensor | None = None) Grid[source]

Return a refined (subdivided) version of a single grid.

Parameters:
  • grid (Grid) – The single grid to refine.

  • subdiv_factor (NumericMaxRank1) – Subdivision factor per axis, broadcastable to (3,).

  • mask (torch.Tensor | None) – Optional boolean mask selecting voxels to refine.

Returns:

result (Grid) – The refined grid.

fvdb.functional.dual_grid_batch(grid: GridBatch, exclude_border: bool = False) GridBatch[source]

Return the dual grid of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch.

  • exclude_border (bool) – If True, exclude border voxels from the dual.

Returns:

result (GridBatch) – The dual grid batch.

fvdb.functional.dual_grid_single(grid: Grid, exclude_border: bool = False) Grid[source]

Return the dual grid of a single grid.

Parameters:
  • grid (Grid) – The single grid.

  • exclude_border (bool) – If True, exclude border voxels from the dual.

Returns:

result (Grid) – The dual grid.

fvdb.functional.dilated_grid_batch(grid: GridBatch, dilation: int) GridBatch[source]

Return a dilated version of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch to dilate.

  • dilation (int) – Number of voxels to dilate by.

Returns:

result (GridBatch) – The dilated grid batch.

fvdb.functional.dilated_grid_single(grid: Grid, dilation: int) Grid[source]

Return a dilated version of a single grid.

Parameters:
  • grid (Grid) – The single grid to dilate.

  • dilation (int) – Number of voxels to dilate by.

Returns:

result (Grid) – The dilated grid.

fvdb.functional.merged_grid_batch(grid: GridBatch, other: GridBatch) GridBatch[source]

Return the union of two grid batches.

Parameters:
Returns:

result (GridBatch) – Grid batch containing the union of active voxels.

fvdb.functional.merged_grid_single(grid: Grid, other: Grid) Grid[source]

Return the union of two single grids.

Parameters:
  • grid (Grid) – The first single grid.

  • other (Grid) – The second single grid.

Returns:

result (Grid) – Grid containing the union of active voxels.

fvdb.functional.pruned_grid_batch(grid: GridBatch, mask: JaggedTensor) GridBatch[source]

Return a grid batch containing only voxels where mask is True.

Parameters:
  • grid (GridBatch) – The grid batch to prune.

  • mask (JaggedTensor) – Boolean mask selecting voxels to keep.

Returns:

result (GridBatch) – The pruned grid batch.

fvdb.functional.pruned_grid_single(grid: Grid, mask: torch.Tensor) Grid[source]

Return a single grid containing only voxels where mask is True.

Parameters:
  • grid (Grid) – The single grid to prune.

  • mask (torch.Tensor) – Boolean mask selecting voxels to keep.

Returns:

result (Grid) – The pruned grid.

fvdb.functional.clipped_grid_batch(grid: GridBatch, ijk_min: NumericMaxRank2, ijk_max: NumericMaxRank2) GridBatch[source]

Return a grid batch clipped to the voxel-space range [ijk_min, ijk_max].

Parameters:
  • grid (GridBatch) – The grid batch to clip.

  • ijk_min (NumericMaxRank2) – Minimum voxel coordinate bound.

  • ijk_max (NumericMaxRank2) – Maximum voxel coordinate bound.

Returns:

result (GridBatch) – The clipped grid batch.

fvdb.functional.clipped_grid_single(grid: Grid, ijk_min: NumericMaxRank1, ijk_max: NumericMaxRank1) Grid[source]

Return a single grid clipped to the voxel-space range [ijk_min, ijk_max].

Parameters:
  • grid (Grid) – The single grid to clip.

  • ijk_min (NumericMaxRank1) – Minimum voxel coordinate bound.

  • ijk_max (NumericMaxRank1) – Maximum voxel coordinate bound.

Returns:

result (Grid) – The clipped grid.

fvdb.functional.clip_batch(grid: GridBatch, features: JaggedTensor, ijk_min: NumericMaxRank2, ijk_max: NumericMaxRank2) tuple[JaggedTensor, GridBatch][source]

Clip a grid batch and its features to the voxel-space range [ijk_min, ijk_max].

Supports backpropagation on features.

Parameters:
  • grid (GridBatch) – The grid batch to clip.

  • features (JaggedTensor) – Per-voxel feature data.

  • ijk_min (NumericMaxRank2) – Minimum voxel coordinate bound.

  • ijk_max (NumericMaxRank2) – Maximum voxel coordinate bound.

Returns:
  • clipped_features (JaggedTensor) – Features for the clipped voxels.

  • clipped_grid (GridBatch) – The clipped grid batch.

See also

clip_single()

fvdb.functional.clip_single(grid: Grid, features: torch.Tensor, ijk_min: NumericMaxRank1, ijk_max: NumericMaxRank1) tuple[torch.Tensor, Grid][source]

Clip a single grid and its features to the voxel-space range [ijk_min, ijk_max].

Supports backpropagation on features.

Parameters:
  • grid (Grid) – The single grid to clip.

  • features (torch.Tensor) – Per-voxel feature data.

  • ijk_min (NumericMaxRank1) – Minimum voxel coordinate bound.

  • ijk_max (NumericMaxRank1) – Maximum voxel coordinate bound.

Returns:
  • clipped_features (torch.Tensor) – Features for the clipped voxels.

  • clipped_grid (Grid) – The clipped grid.

See also

clip_batch()

fvdb.functional.contiguous_batch(grid: GridBatch) GridBatch[source]

Return a contiguous copy of a grid batch.

Parameters:

grid (GridBatch) – The grid batch.

Returns:

result (GridBatch) – A contiguous copy of the grid batch.

fvdb.functional.contiguous_single(grid: Grid) Grid[source]

Return a contiguous copy of a single grid.

Parameters:

grid (Grid) – The single grid.

Returns:

result (Grid) – A contiguous copy of the grid.

fvdb.functional.clone_grid_batch(grid: GridBatch, device: torch.device) GridBatch[source]

Clone a grid batch to the specified device.

Parameters:
  • grid (GridBatch) – The grid batch to clone.

  • device (torch.device) – Target device.

Returns:

result (GridBatch) – A clone of the grid batch on the target device.

fvdb.functional.clone_grid_single(grid: Grid, device: torch.device) Grid[source]

Clone a single grid to the specified device.

Parameters:
  • grid (Grid) – The single grid to clone.

  • device (torch.device) – Target device.

Returns:

result (Grid) – A clone of the grid on the target device.

fvdb.functional.conv_grid_batch(grid: GridBatch, kernel_size: NumericMaxRank1, stride: NumericMaxRank1 = 1) GridBatch[source]

Return the output grid for a convolution on a grid batch.

Parameters:
  • grid (GridBatch) – The input grid batch.

  • kernel_size (NumericMaxRank1) – Convolution kernel size, broadcastable to (3,).

  • stride (NumericMaxRank1) – Convolution stride, broadcastable to (3,).

Returns:

result (GridBatch) – The output grid batch for the convolution.

fvdb.functional.conv_grid_single(grid: Grid, kernel_size: NumericMaxRank1, stride: NumericMaxRank1 = 1) Grid[source]

Return the output grid for a convolution on a single grid.

Parameters:
  • grid (Grid) – The input single grid.

  • kernel_size (NumericMaxRank1) – Convolution kernel size, broadcastable to (3,).

  • stride (NumericMaxRank1) – Convolution stride, broadcastable to (3,).

Returns:

result (Grid) – The output grid for the convolution.

fvdb.functional.conv_transpose_grid_batch(grid: GridBatch, kernel_size: NumericMaxRank1, stride: NumericMaxRank1 = 1) GridBatch[source]

Return the output grid for a transposed convolution on a grid batch.

Parameters:
  • grid (GridBatch) – The input grid batch.

  • kernel_size (NumericMaxRank1) – Kernel size, broadcastable to (3,).

  • stride (NumericMaxRank1) – Stride, broadcastable to (3,).

Returns:

result (GridBatch) – The output grid batch for the transposed convolution.

fvdb.functional.conv_transpose_grid_single(grid: Grid, kernel_size: NumericMaxRank1, stride: NumericMaxRank1 = 1) Grid[source]

Return the output grid for a transposed convolution on a single grid.

Parameters:
  • grid (Grid) – The input single grid.

  • kernel_size (NumericMaxRank1) – Kernel size, broadcastable to (3,).

  • stride (NumericMaxRank1) – Stride, broadcastable to (3,).

Returns:

result (Grid) – The output grid for the transposed convolution.

Space-Filling Curves

fvdb.functional.morton_batch(grid: GridBatch, offset: torch.Tensor | NumericMaxRank1 | None = None) JaggedTensor[source]

Return Morton (Z-order) codes for active voxels in a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (JaggedTensor) – Morton codes per active voxel.

See also

morton_single()

fvdb.functional.morton_single(grid: Grid, offset: torch.Tensor | NumericMaxRank1 | None = None) torch.Tensor[source]

Return Morton (Z-order) codes for active voxels in a single grid.

Parameters:
  • grid (Grid) – The single grid.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (torch.Tensor) – Morton codes per active voxel.

See also

morton_batch()

fvdb.functional.morton_zyx_batch(grid: GridBatch, offset: torch.Tensor | NumericMaxRank1 | None = None) JaggedTensor[source]

Return transposed Morton codes (zyx interleaving) for a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (JaggedTensor) – Transposed Morton codes per active voxel.

fvdb.functional.morton_zyx_single(grid: Grid, offset: torch.Tensor | NumericMaxRank1 | None = None) torch.Tensor[source]

Return transposed Morton codes (zyx interleaving) for a single grid.

Parameters:
  • grid (Grid) – The single grid.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (torch.Tensor) – Transposed Morton codes per active voxel.

fvdb.functional.hilbert_batch(grid: GridBatch, offset: torch.Tensor | NumericMaxRank1 | None = None) JaggedTensor[source]

Return Hilbert curve codes for active voxels in a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (JaggedTensor) – Hilbert codes per active voxel.

See also

hilbert_single()

fvdb.functional.hilbert_single(grid: Grid, offset: torch.Tensor | NumericMaxRank1 | None = None) torch.Tensor[source]

Return Hilbert curve codes for active voxels in a single grid.

Parameters:
  • grid (Grid) – The single grid.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (torch.Tensor) – Hilbert codes per active voxel.

See also

hilbert_batch()

fvdb.functional.hilbert_zyx_batch(grid: GridBatch, offset: torch.Tensor | NumericMaxRank1 | None = None) JaggedTensor[source]

Return transposed Hilbert codes (zyx ordering) for a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (JaggedTensor) – Transposed Hilbert codes per active voxel.

fvdb.functional.hilbert_zyx_single(grid: Grid, offset: torch.Tensor | NumericMaxRank1 | None = None) torch.Tensor[source]

Return transposed Hilbert codes (zyx ordering) for a single grid.

Parameters:
  • grid (Grid) – The single grid.

  • offset (torch.Tensor | NumericMaxRank1 | None) – Coordinate offset before encoding.

Returns:

codes (torch.Tensor) – Transposed Hilbert codes per active voxel.

Edge Network

fvdb.functional.edge_network_batch(grid: GridBatch, return_voxel_coordinates: bool = False) tuple[JaggedTensor, JaggedTensor][source]

Return the edge network of a grid batch.

Parameters:
  • grid (GridBatch) – The grid batch.

  • return_voxel_coordinates (bool) – If True, return voxel coordinates instead of indices.

Returns:
  • sources (JaggedTensor) – Source node indices or coordinates for each edge.

  • targets (JaggedTensor) – Target node indices or coordinates for each edge.

fvdb.functional.edge_network_single(grid: Grid, return_voxel_coordinates: bool = False) tuple[torch.Tensor, torch.Tensor][source]

Return the edge network of a single grid.

Parameters:
  • grid (Grid) – The single grid.

  • return_voxel_coordinates (bool) – If True, return voxel coordinates instead of indices.

Returns:
  • sources (torch.Tensor) – Source node indices or coordinates for each edge.

  • targets (torch.Tensor) – Target node indices or coordinates for each edge.

Grid Indexing

fvdb.functional.index_grid_batch(grid: GridBatch, index: int) GridBatch[source]
fvdb.functional.index_grid_batch(grid: GridBatch, index: slice) GridBatch
fvdb.functional.index_grid_batch(grid: GridBatch, index: list[bool]) GridBatch
fvdb.functional.index_grid_batch(grid: GridBatch, index: list[int]) GridBatch
fvdb.functional.index_grid_batch(grid: GridBatch, index: Tensor) GridBatch

Select a subset of grids from a batch using indexing.

Supports integer indexing, slicing, list indexing, and boolean/integer tensor indexing.

Parameters:
  • grid – The grid batch to index into.

  • index – Index to select grids. Can be: - int: Select a single grid. - slice: Select a range of grids. - list[int] or list[bool]: Select specific grids. - torch.Tensor: Boolean or integer tensor for advanced indexing.

Returns:

A new :class:`~fvdb.GridBatch` containing the selected grids.

Grid Constructors (Batch)

fvdb.functional.gridbatch_from_dense(num_grids: int, dense_dims: NumericMaxRank1, ijk_min: NumericMaxRank1 = 0, voxel_sizes: NumericMaxRank2 = 1, origins: NumericMaxRank2 = 0, mask: torch.Tensor | None = None, device: DeviceIdentifier | None = None) GridBatch[source]

Create a grid batch of dense grids.

Parameters:
  • num_grids (int) – Number of grids to create.

  • dense_dims (NumericMaxRank1) – Dimensions of the dense grid, broadcastable to (3,).

  • ijk_min (NumericMaxRank1) – Minimum voxel index, broadcastable to (3,).

  • voxel_sizes (NumericMaxRank2) – Voxel size per grid, broadcastable to (num_grids, 3).

  • origins (NumericMaxRank2) – Origin per grid, broadcastable to (num_grids, 3).

  • mask (torch.Tensor | None) – Optional boolean mask (W, H, D) selecting active voxels.

  • device (DeviceIdentifier | None) – Device to create on. Defaults to mask’s device or "cpu".

Returns:

result (GridBatch) – A new grid batch.

fvdb.functional.gridbatch_from_dense_axis_aligned_bounds(num_grids: int, dense_dims: NumericMaxRank1, bounds_min: NumericMaxRank1 = 0, bounds_max: NumericMaxRank1 = 1, voxel_center: bool = False, device: DeviceIdentifier = 'cpu') GridBatch[source]

Create a grid batch of dense grids defined by axis-aligned world-space bounds.

Parameters:
  • num_grids (int) – Number of grids to create.

  • dense_dims (NumericMaxRank1) – Dimensions of the dense grids, broadcastable to (3,).

  • bounds_min (NumericMaxRank1) – Minimum world-space coordinate, broadcastable to (3,).

  • bounds_max (NumericMaxRank1) – Maximum world-space coordinate, broadcastable to (3,).

  • voxel_center (bool) – Whether bounds correspond to voxel centers (True) or edges (False).

  • device (DeviceIdentifier) – Device to create on. Defaults to "cpu".

Returns:

result (GridBatch) – A new grid batch.

fvdb.functional.gridbatch_from_ijk(ijk: JaggedTensor, voxel_sizes: NumericMaxRank2 = 1, origins: NumericMaxRank2 = 0) GridBatch[source]

Create a grid batch from voxel-space coordinates.

Parameters:
  • ijk (JaggedTensor) – Per-grid voxel coordinates, shape (B, -1, 3) with integer dtype.

  • voxel_sizes (NumericMaxRank2) – Voxel size per grid, broadcastable to (B, 3).

  • origins (NumericMaxRank2) – Origin per grid, broadcastable to (B, 3).

Returns:

result (GridBatch) – A new grid batch.

See also

grid_from_ijk()

fvdb.functional.gridbatch_from_mesh(mesh_vertices: JaggedTensor, mesh_faces: JaggedTensor, voxel_sizes: NumericMaxRank2 = 1, origins: NumericMaxRank2 = 0) GridBatch[source]

Create a grid batch by voxelizing triangle mesh surfaces.

Parameters:
  • mesh_vertices (JaggedTensor) – Per-grid vertex positions, shape (B, -1, 3).

  • mesh_faces (JaggedTensor) – Per-grid face indices, shape (B, -1, 3).

  • voxel_sizes (NumericMaxRank2) – Voxel size per grid, broadcastable to (B, 3).

  • origins (NumericMaxRank2) – Origin per grid, broadcastable to (B, 3).

Returns:

result (GridBatch) – A new grid batch.

See also

grid_from_mesh()

fvdb.functional.gridbatch_from_nearest_voxels_to_points(points: JaggedTensor, voxel_sizes: NumericMaxRank2 = 1, origins: NumericMaxRank2 = 0) GridBatch[source]

Create a grid batch by adding the eight nearest voxels to every input point.

Parameters:
  • points (JaggedTensor) – Per-grid point positions, shape (B, -1, 3).

  • voxel_sizes (NumericMaxRank2) – Voxel size per grid, broadcastable to (B, 3).

  • origins (NumericMaxRank2) – Origin per grid, broadcastable to (B, 3).

Returns:

result (GridBatch) – A new grid batch.

fvdb.functional.gridbatch_from_points(points: JaggedTensor, voxel_sizes: NumericMaxRank2 = 1, origins: NumericMaxRank2 = 0) GridBatch[source]

Create a grid batch from point clouds.

Parameters:
  • points (JaggedTensor) – Per-grid point positions, shape (B, -1, 3).

  • voxel_sizes (NumericMaxRank2) – Voxel size per grid, broadcastable to (B, 3).

  • origins (NumericMaxRank2) – Origin per grid, broadcastable to (B, 3).

Returns:

result (GridBatch) – A new grid batch.

fvdb.functional.gridbatch_from_zero_grids(device: DeviceIdentifier = 'cpu') GridBatch[source]

Create a grid batch with zero grids.

Parameters:

device (DeviceIdentifier) – Device to create on. Defaults to "cpu".

Returns:

result (GridBatch) – An empty grid batch with grid_count == 0.

fvdb.functional.gridbatch_from_zero_voxels(device: DeviceIdentifier = 'cpu', voxel_sizes: NumericMaxRank2 = 1, origins: NumericMaxRank2 = 0) GridBatch[source]

Create a grid batch with one or more zero-voxel grids.

Parameters:
  • device (DeviceIdentifier) – Device to create on. Defaults to "cpu".

  • voxel_sizes (NumericMaxRank2) – Voxel size per grid, broadcastable to (num_grids, 3).

  • origins (NumericMaxRank2) – Origin per grid, broadcastable to (num_grids, 3).

Returns:

result (GridBatch) – A new grid batch with zero-voxel grids.

fvdb.functional.concatenate_grids(grids: Sequence[GridBatch | Grid]) GridBatch[source]

Concatenate a sequence of grids or grid batches into one.

Parameters:

grids (Sequence[GridBatch | Grid]) – Grids or grid batches to concatenate.

Returns:

result (GridBatch) – A new grid batch containing all grids.

Grid Constructors (Single)

fvdb.functional.grid_from_dense(dense_dims: NumericMaxRank1, ijk_min: NumericMaxRank1 = 0, voxel_size: NumericMaxRank1 = 1, origin: NumericMaxRank1 = 0, mask: torch.Tensor | None = None, device: DeviceIdentifier | None = None) Grid[source]

Create a single dense grid.

Parameters:
  • dense_dims (NumericMaxRank1) – Dimensions of the dense grid, broadcastable to (3,).

  • ijk_min (NumericMaxRank1) – Minimum voxel index, broadcastable to (3,).

  • voxel_size (NumericMaxRank1) – Voxel size, broadcastable to (3,).

  • origin (NumericMaxRank1) – Origin, broadcastable to (3,).

  • mask (torch.Tensor | None) – Optional boolean mask (W, H, D) selecting active voxels.

  • device (DeviceIdentifier | None) – Device to create on. Defaults to mask’s device or "cpu".

Returns:

result (Grid) – A new single grid.

fvdb.functional.grid_from_dense_axis_aligned_bounds(dense_dims: NumericMaxRank1, bounds_min: NumericMaxRank1 = 0, bounds_max: NumericMaxRank1 = 1, voxel_center: bool = False, device: DeviceIdentifier = 'cpu') Grid[source]

Create a single dense grid defined by axis-aligned world-space bounds.

Parameters:
  • dense_dims (NumericMaxRank1) – Dimensions of the dense grid, broadcastable to (3,).

  • bounds_min (NumericMaxRank1) – Minimum world-space coordinate, broadcastable to (3,).

  • bounds_max (NumericMaxRank1) – Maximum world-space coordinate, broadcastable to (3,).

  • voxel_center (bool) – Whether bounds correspond to voxel centers (True) or edges (False).

  • device (DeviceIdentifier) – Device to create on. Defaults to "cpu".

Returns:

result (Grid) – A new single grid.

fvdb.functional.grid_from_ijk(ijk: torch.Tensor, voxel_size: NumericMaxRank1 = 1, origin: NumericMaxRank1 = 0) Grid[source]

Create a single grid from voxel-space coordinates.

Parameters:
  • ijk (torch.Tensor) – Voxel coordinates, shape (N, 3) with integer dtype.

  • voxel_size (NumericMaxRank1) – Voxel size, broadcastable to (3,).

  • origin (NumericMaxRank1) – Origin, broadcastable to (3,).

Returns:

result (Grid) – A new single grid.

fvdb.functional.grid_from_mesh(mesh_vertices: torch.Tensor, mesh_faces: torch.Tensor, voxel_size: NumericMaxRank1 = 1, origin: NumericMaxRank1 = 0) Grid[source]

Create a single grid by voxelizing a triangle mesh surface.

Parameters:
  • mesh_vertices (torch.Tensor) – Vertex positions, shape (N, 3).

  • mesh_faces (torch.Tensor) – Face indices, shape (F, 3).

  • voxel_size (NumericMaxRank1) – Voxel size, broadcastable to (3,).

  • origin (NumericMaxRank1) – Origin, broadcastable to (3,).

Returns:

result (Grid) – A new single grid.

fvdb.functional.grid_from_nearest_voxels_to_points(points: torch.Tensor, voxel_size: NumericMaxRank1 = 1, origin: NumericMaxRank1 = 0) Grid[source]

Create a single grid by adding the eight nearest voxels to every input point.

Parameters:
  • points (torch.Tensor) – Point positions, shape (N, 3).

  • voxel_size (NumericMaxRank1) – Voxel size, broadcastable to (3,).

  • origin (NumericMaxRank1) – Origin, broadcastable to (3,).

Returns:

result (Grid) – A new single grid.

fvdb.functional.grid_from_points(points: torch.Tensor, voxel_size: NumericMaxRank1 = 1, origin: NumericMaxRank1 = 0) Grid[source]

Create a single grid from a point cloud.

Parameters:
  • points (torch.Tensor) – Point positions, shape (N, 3).

  • voxel_size (NumericMaxRank1) – Voxel size, broadcastable to (3,).

  • origin (NumericMaxRank1) – Origin, broadcastable to (3,).

Returns:

result (Grid) – A new single grid.

fvdb.functional.grid_from_zero_voxels(device: DeviceIdentifier = 'cpu', voxel_size: NumericMaxRank1 = 1, origin: NumericMaxRank1 = 0) Grid[source]

Create a single grid with zero voxels.

Parameters:
  • device (DeviceIdentifier) – Device to create on. Defaults to "cpu".

  • voxel_size (NumericMaxRank1) – Voxel size, broadcastable to (3,).

  • origin (NumericMaxRank1) – Origin, broadcastable to (3,).

Returns:

result (Grid) – A new single grid with zero voxels.

I/O

fvdb.functional.load_nanovdb(path: str, *, device: str | device = 'cpu', verbose: bool = False) tuple[GridBatch, JaggedTensor, list[str]][source]
fvdb.functional.load_nanovdb(path: str, *, indices: list[int], device: str | device = 'cpu', verbose: bool = False) tuple[GridBatch, JaggedTensor, list[str]]
fvdb.functional.load_nanovdb(path: str, *, index: int, device: str | device = 'cpu', verbose: bool = False) tuple[GridBatch, JaggedTensor, list[str]]
fvdb.functional.load_nanovdb(path: str, *, names: list[str], device: str | device = 'cpu', verbose: bool = False) tuple[GridBatch, JaggedTensor, list[str]]
fvdb.functional.load_nanovdb(path: str, *, name: str, device: str | device = 'cpu', verbose: bool = False) tuple[GridBatch, JaggedTensor, list[str]]

Load a grid batch from a .nvdb file.

Parameters:
  • path (str) – Path to the .nvdb file.

  • indices (list[int] | None) – Optional list of grid indices to load.

  • index (int | None) – Optional single grid index to load.

  • names (list[str] | None) – Optional list of grid names to load.

  • name (str | None) – Optional single grid name to load.

  • device (DeviceIdentifier) – Device to load onto. Defaults to "cpu".

  • verbose (bool) – Print information about loaded grids.

Returns:
  • grid_batch (GridBatch) – The loaded grid batch.

  • data (JaggedTensor) – Per-voxel data.

  • names (list[str]) – Grid names.

fvdb.functional.load_nanovdb_single(path: str, *, index: int = 0, name: str | None = None, device: DeviceIdentifier = 'cpu', verbose: bool = False) tuple[Grid, torch.Tensor, str][source]

Load a single grid from a .nvdb file.

Parameters:
  • path (str) – Path to the .nvdb file.

  • index (int) – Grid index to load. Default 0.

  • name (str | None) – Optional grid name to load (overrides index).

  • device (DeviceIdentifier) – Device to load onto. Defaults to "cpu".

  • verbose (bool) – Print information about loaded grids.

Returns:
  • grid (Grid) – The loaded single grid.

  • data (torch.Tensor) – Per-voxel data.

  • name (str) – Grid name.

See also

load_nanovdb()

fvdb.functional.save_nanovdb(grid: GridBatch, path: str, data: JaggedTensor | None = None, names: list[str] | str | None = None, name: str | None = None, compressed: bool = False, verbose: bool = False) None[source]

Save a grid batch and optional voxel data to a .nvdb file.

Parameters:
  • grid (GridBatch) – The grid batch to save.

  • path (str) – File path (should have .nvdb extension).

  • data (JaggedTensor | None) – Optional voxel data to save with the grids.

  • names (list[str] | str | None) – Names for each grid, or a single name for all.

  • name (str | None) – Single name for all grids (takes precedence over names).

  • compressed (bool) – Use Blosc compression. Default False.

  • verbose (bool) – Print information about saved grids. Default False.

fvdb.functional.save_nanovdb_single(grid: Grid, path: str, data: torch.Tensor | None = None, name: str | None = None, compressed: bool = False, verbose: bool = False) None[source]

Save a single grid and optional voxel data to a .nvdb file.

Parameters:
  • grid (Grid) – The single grid to save.

  • path (str) – File path (should have .nvdb extension).

  • data (torch.Tensor | None) – Optional voxel data as a plain tensor.

  • name (str | None) – Optional name for the grid.

  • compressed (bool) – Use Blosc compression. Default False.

  • verbose (bool) – Print information about saved grids. Default False.

See also

save_nanovdb()