Utils#

This class consists of various utilities necessary for the library:

Utils for scatter.

Adaptation of torch_scatter/scatter.py from: rusty1s/pytorch_scatter

topomodelx.utils.scatter.broadcast(src: Tensor, other: Tensor, dim: int) Tensor[source]#

Broadcasts src to the shape of other.

topomodelx.utils.scatter.scatter(scatter: str)[source]#

Return the scatter function.

topomodelx.utils.scatter.scatter_add(src: Tensor, index: Tensor, dim: int = -1, out: Tensor | None = None, dim_size: int | None = None) Tensor[source]#

Add all values from the src tensor into out at the indices.

topomodelx.utils.scatter.scatter_mean(src: Tensor, index: Tensor, dim: int = -1, out: Tensor | None = None, dim_size: int | None = None) Tensor[source]#

Compute the mean value of all values from the src tensor into out.

topomodelx.utils.scatter.scatter_sum(src: Tensor, index: Tensor, dim: int = -1, out: Tensor | None = None, dim_size: int | None = None) Tensor[source]#

Add all values from the src tensor into out at the indices.