tnmf.backends._PyTorchBackend

A module that provides some specializations and utilities for all PyTorch based backends.

Module Contents

Classes

PyTorchBackend

The parent class for all PyTorch based backends.

class tnmf.backends._PyTorchBackend.PyTorchBackend(**kwargs)

Bases: tnmf.backends._Backend.Backend

The parent class for all PyTorch based backends.

They provide the functionality to evaluate the gradients of the factorization model via automatic differentiation using torch.autograd.

static to_ndarray(arr: torch.Tensor)numpy.ndarray
static convolve_multi_1d(arr: torch.Tensor, kernels: Tuple[numpy.ndarray, Ellipsis], axes: Tuple[int, Ellipsis])torch.Tensor
static normalize(arr: torch.Tensor, axis: Optional[Union[int, Tuple[int, Ellipsis]]] = None)
reconstruction_gradient_W(self, V: numpy.ndarray, W: torch.Tensor, H: torch.Tensor, s: slice = sliceNone)Tuple[torch.Tensor, torch.Tensor]
reconstruction_gradient_H(self, V: numpy.ndarray, W: torch.Tensor, H: torch.Tensor, s: slice = sliceNone)Tuple[torch.Tensor, torch.Tensor]
reconstruction_energy(self, V: torch.Tensor, W: torch.Tensor, H: torch.Tensor)float