hypll.tensors.manifold_tensor

Classes

ManifoldTensor

Represents a tensor on a manifold.

class hypll.tensors.manifold_tensor.ManifoldTensor

Represents a tensor on a manifold.

tensor

Torch tensor of points on the manifold.

manifold

Manifold instance.

man_dim

Dimension along which points are on the manifold.

__init__(data: Tensor, manifold: Manifold, man_dim: int = -1, requires_grad: bool = False) None

Creates an instance of ManifoldTensor.

Parameters:
  • data – Torch tensor of points on the manifold.

  • manifold – Manifold instance.

  • man_dim – Dimension along which points are on the manifold. -1 by default.

TODO(Philipp, 05/23): Let’s get rid of requires_grad if possible.

cpu() ManifoldTensor

Returns a copy of this object with self.tensor in CPU memory.

cuda(device=None) ManifoldTensor

Returns a copy of this object with self.tensor in CUDA memory.

dim() int

Returns the number of dimensions of self.tensor.

detach() ManifoldTensor

Returns a new Tensor, detached from the current graph.

flatten(start_dim: int = 0, end_dim: int = -1) ManifoldTensor

Flattens tensor by reshaping it. If start_dim or end_dim are passed, only dimensions starting with start_dim and ending with end_dim are flattend.

property is_cpu
property is_cuda
is_floating_point() bool

Returns true if the tensor is of dtype float.

project() ManifoldTensor

Projects the tensor to the manifold.

property shape

Alias for size().

size(dim: int | None = None)

Returns the size of self.tensor.

squeeze(dim=None)

Returns a squeezed version of the manifold tensor.

to(*args, **kwargs) ManifoldTensor

Returns a new tensor with the specified device and (optional) dtype.

transpose(dim0: int, dim1: int) ManifoldTensor

Returns a transposed version of the manifold tensor. The given dimensions dim0 and dim1 are swapped.

unsqueeze(dim: int) ManifoldTensor

Returns a new manifold tensor with a dimension of size one inserted at the specified position.