unilab.utils

unilab.utils.get_default_device()[source]

Detect the best available device.

Return type:

str

unilab.utils.to_numpy(x)[source]

Convert torch tensor or numpy-like input to numpy.

Return type:

ndarray

unilab.utils.to_torch(x, device)[source]

Convert numpy-like input to torch on the target device.

Supports torch tensors, numpy arrays, and any array exposing __dlpack__.

Parameters:

device (str | device)

Return type:

Tensor

Modules

checkpoint

Pure-filesystem log root and checkpoint resolution helpers.

device

geometry

Standalone numpy helpers for coordinate frames and geometry.

monitoring

Hardware monitoring utilities for performance profiling.

nan_guard

NaN/Inf guard for env-layer numerical anomaly detection and state dumping.

nan_viz

Interactive viewer for NaN guard state dumps.

reward

Utility functions for reward config handling.

rotation

seed

Shared training seed contract helpers.

sim2sim

Cross-backend sim2sim contract snapshot and resolution.

tensor

Generic array <-> torch conversion utilities.