def decode(code: torch.Tensor, permute: List[int] = [0, 1, 2], mode: Literal['z_order', 'hilbert'] = 'z_order') -> torch.Tensor:
    """
    Decodes a 30-bit code into 3D coordinates.

    Args:
        code: a tensor of shape [N] containing the 30-bit code.
        permute: the permutation of the coordinates.
        mode: the decoding mode to use.
    """
    if mode == 'z_order':
        return z_order_decode(code, depth=10)[:, permute].float()
    elif mode == 'hilbert':
        return hilbert_decode(code, depth=10)[:, permute].float()
    else:
        raise ValueError(f"Unknown decoding mode: {mode}")

    Decodes a 30-bit code into 3D coordinates.

    Args:
        code: a tensor of shape [N] containing the 30-bit code.
        permute: the permutation of the coordinates.
        mode: the decoding mode to use.
    
extensions/vox2seq/vox2seq/pytorch/__init__.py