"""TorchSparse primitives used by the released SPAC VQ-VAE.""" import importlib BACKEND = "torchsparse" ATTN = "sdpa" DEBUG = False _MODULES = { "SparseTensor": "basic", "sparse_batch_broadcast": "basic", "sparse_batch_op": "basic", "sparse_unbind": "basic", "SparseGroupNorm32": "norm", "SparseSiLU": "nonlinearity", "SparseGELU": "nonlinearity", "SparseTanh": "nonlinearity", "SparseLinear": "linear", "SparseConv3d": "conv", "SparseDownsample": "spatial", "SparseSubdivide": "spatial", } def __getattr__(name): if name not in _MODULES: raise AttributeError(name) value = getattr(importlib.import_module(f".{_MODULES[name]}", __name__), name) globals()[name] = value return value __all__ = list(_MODULES)