gsplat

raw JSON →
1.5.3 verified Fri May 01 auth: no python

A Python package for differentiable rasterization of 3D Gaussians, widely used in 3D Gaussian Splatting (3DGS) research and applications. Version 1.5.3 includes support for batched scenes, 2DGS, distorted cameras, and CUDA fused Adam optimizer. Release cadence is approximately monthly.

pip install gsplat
error module 'gsplat' has no attribute 'rasterization'
cause Importing 'gsplat.rasterization' as a module instead of calling it as a function after importing the package.
fix
Use 'import gsplat' then call 'gsplat.rasterization(...)'.
error RuntimeError: CUDA error: no kernel image is available for execution on the device
cause The installed gsplat wheel does not support the GPU architecture (e.g., CUDA compute capability mismatch).
fix
Install gsplat from source to compile for your specific GPU: 'pip install gsplat --no-binary gsplat'.
error AssertionError: Total number of Gaussians must be non-negative
cause Passing an empty tensor for means when no Gaussians are present.
fix
Ensure at least one Gaussian is provided, or handle the edge case by skipping rasterization when count is zero.
breaking In v1.0+, the rasterization function signature changed: now expects individual tensors for means, quats, scales, opacities, colors instead of a single packed tensor.
fix Update calls to pass separate keyword arguments. See docs for current signature.
deprecated The 'gsplat.cuda_legacy' module is deprecated and will be removed in a future release.
fix Use 'gsplat.rasterization' directly instead of 'gsplat.cuda_legacy.rasterization'.
gotcha gsplat requires a CUDA-capable GPU and PyTorch with CUDA. Running on CPU will trigger a RuntimeError about CUDA not being available.
fix Ensure you have a GPU and install PyTorch with CUDA support (e.g., 'pip install torch==2.2.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html').

Minimal example of rasterization with dummy data. Requires CUDA for performance.

import torch
import gsplat

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# dummy data: batch of 3D Gaussians (N, 14)
gaussians = torch.randn(100, 14, device=device)
viewmat = torch.eye(4, device=device).unsqueeze(0)  # (1, 4, 4)
fx, fy, cx, cy = 100.0, 100.0, 50.0, 50.0
img_height, img_width = 100, 100
rendered = gsplat.rasterization(
    means=gaussians[:, :3],
    quats=gaussians[:, 3:7],
    scales=torch.exp(gaussians[:, 7:10]),
    opacities=torch.sigmoid(gaussians[:, 10:11]),
    colors=torch.sigmoid(gaussians[:, 11:14]),
    viewmat=viewmat,
    K=torch.tensor([[fx, 0, cx], [0, fy, cy], [0, 0, 1]], device=device),
    width=img_width,
    height=img_height,
)
print(rendered.keys())