Utilities Used in Examples

class channel_select2d.ChannelSelect2d(channel: int)[source]

Bases: Module

forward(input: Tensor) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

create_point_clouds.create_point_clouds(*, constructors: ~collections.abc.Sequence[~collections.abc.Callable[[int, int], ~numpy.ndarray]] = [<function my_sphere>, <function my_torus>, <function my_swiss_roll>], seed: int = 1000, nb_point_clouds: int = 40, nb_points: int = 125, nb_noise: int = 125, nb_subsamples: int = 30, nb_coarsened: int = 30) ndarray
create_point_clouds.my_sphere(nb_points: int, seed: int) ndarray[source]
create_point_clouds.my_swiss_roll(nb_points: int, seed: int) ndarray[source]
create_point_clouds.my_torus(nb_points: int, seed: int) ndarray[source]
create_point_clouds.point_clouds_from_constructors(*, constructors: Sequence[Callable[[int, int], ndarray]], seed: int = 1_000, nb_point_clouds: int = 40, nb_points: int = 125, nb_noise: int = 125, nb_subsamples: int = 30, nb_coarsened: int = 30) ndarray[source]
class gram_test.GramTest(*, gram: Callable[[Tensor, Tensor], Tensor], support_indices: Tensor, len_train: int, support_vectors, device=None, dtype=None)[source]

Bases: Module

forward(test: Tensor, /) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gudhi_util.point_cloud_to_simplex_tree(point_cloud: ndarray) SimplexTree[source]
gudhi_util.point_clouds_to_simplex_trees(point_clouds: ndarray) Sequence[Sequence[Sequence[SimplexTree]]][source]
gudhi_util.simplex_trees_to_persistence_intervals_in_dim(*, simplex_trees: Sequence[Sequence[Sequence[SimplexTree]]], dim: int) ndarray[source]
class standard_scaler.StandardScaler(std: Tensor, mean: Tensor)[source]

Bases: Module

forward(input: Tensor, /) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class train_test.Optimize(optimizer)[source]

Bases: NamedTuple

__call__(result: Result) Tensor[source]

Call self as a function.

optimizer: Optimizer

Alias for field number 0

class train_test.ProcessBatch(model, loss_fn, binary)[source]

Bases: NamedTuple

__call__(X: Tensor, label: Tensor) Result[source]

Call self as a function.

binary: bool

Alias for field number 2

loss_fn: Callable[[Tensor], Tensor]

Alias for field number 1

model: Module

Alias for field number 0

class train_test.Result(loss, nb_correct)[source]

Bases: NamedTuple

loss: Tensor

Alias for field number 0

nb_correct: float

Alias for field number 1

train_test.accumulate_loss(results: Sequence[Result]) float[source]
train_test.accumulate_score(results: Sequence[Result]) float[source]