deadleaves.utils#

Functions#

choose_compute_backend(→ torch.device)

This function will automatically assign the available compute backend

bounding_box(→ tuple[int, int, int, int])

Generate boundaries for bounding box for leaf index in partition

Module Contents#

deadleaves.utils.choose_compute_backend() torch.device#

This function will automatically assign the available compute backend

Returns:
torch.device:

A suitable PyTorch compute backend.

deadleaves.utils.bounding_box(partition: torch.Tensor, leaf_idx: int) tuple[int, int, int, int]#

Generate boundaries for bounding box for leaf index in partition

Args:
partition (torch.Tensor):

Partition to use for bounding box

leaf_idx (int):

Index of relevant leaf

Returns:
tuple[int, int, int, int] | None:

Top, left, bottom, right boundary indices of bounding box.