Runtime Configuration

Central runtime configuration for qPOTS.

Edit DEFAULT_DTYPE to change the package-wide floating-point precision. DEFAULT_DEVICE automatically uses CUDA when a GPU is available and falls back to CPU otherwise.

qpots.config.as_tensor(data: Any, device: device | str | None = None, dtype: dtype | None = None) Tensor[source]

Convert data to a tensor on the configured qPOTS device and dtype.

qpots.config.get_device(device: device | str | None = None) device[source]

Return an explicit device or the configured qPOTS default device.

qpots.config.get_dtype(dtype: dtype | None = None) dtype[source]

Return an explicit dtype or the configured qPOTS default dtype.

qpots.config.tensor_kwargs(device: device | str | None = None, dtype: dtype | None = None) dict[str, device | dtype][source]

Return keyword arguments for creating floating-point tensors.

qpots.config.to_runtime(tensor: Tensor, device: device | str | None = None, dtype: dtype | None = None) Tensor[source]

Move a tensor to the configured qPOTS device and dtype.

Precision and Device

qPOTS centralizes floating-point precision and device selection in qpots.config. The default device uses CUDA when PyTorch reports an available GPU and falls back to CPU otherwise. The default dtype is torch.float64, matching the double-precision convention commonly used in BoTorch Gaussian-process workflows.

To change package-wide precision, edit DEFAULT_DTYPE in qpots/config.py. For example, use torch.float32 for lower memory usage or keep torch.float64 for the default double-precision behavior.