base

Base manifold.

Module Contents

Manifold

Abstract class to define basic operations on a manifold.

class Manifold(**kwargs)

Bases: object

Abstract class to define basic operations on a manifold.

clip

Clips tensor values to a specified min and max.

Type:

function

dtype

The type of the variables.

eps

A small constant value.

Type:

float

max_norm

The maximum value for number clipping.

Type:

float

min_norm

The minimum value for number clipping.

Type:

float

Initialize a manifold.

min_norm = 1e-15
max_norm = 1000000000000000.0
eps = 1e-05
dtype
clip
abstractmethod proj(x, c)

A projection function that prevents x from leaving the manifold. :param x: A point should be on the manifold, but it may not meet the manifold constraints. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

A projected point, meeting the manifold constraints.

Return type:

tensor

abstractmethod proj_tan(v, x, c)

A projection function that prevents v from leaving the tangent space of point x. :param v: A point should be on the tangent space, but it may not meet the manifold constraints. :type v: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

A projected point, meeting the tangent space constraints.

Return type:

tensor

abstractmethod proj_tan0(v, c)

A projection function that prevents v from leaving the tangent space of origin point. :param v: A point should be on the tangent space, but it may not meet the manifold constraints. :type v: tensor :param c: The manifold curvature. :type c: tensor

Returns:

A projected point, meeting the tangent space constraints.

Return type:

tensor

abstractmethod expmap(v, x, c)

Map a point v in the tangent space of point x to the manifold. :param v: A point in the tangent space of point x. :type v: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of mapping tangent point v to the manifold.

Return type:

tensor

abstractmethod expmap0(v, c)

Map a point v in the tangent space of origin point to the manifold. :param v: A point in the tangent space of origin point. :type v: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of mapping tangent point v to the manifold.

Return type:

tensor

abstractmethod logmap(y, x, c)

Map a point y on the manifold to the tangent space of x. :param y: A point on the manifold. :type y: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of mapping y to the tangent space of x.

Return type:

tensor

abstractmethod logmap0(y, c)

Map a point y on the manifold to the tangent space of origin point. :param y: A point on the manifold. :type y: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of mapping y to the tangent space of origin point.

Return type:

tensor

abstractmethod ptransp(v, x, y, c)

Parallel transport function, used to move point v in the tangent space of x to the tangent space of y. :param v: A point in the tangent space of x. :type v: tensor :param x: A point on the manifold. :type x: tensor :param y: A point on the manifold. :type y: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of transporting v from the tangent space at x to the tangent space at y.

Return type:

tensor

abstractmethod ptransp0(v, x, c)

Parallel transport function, used to move point v in the tangent space of origin point to the tangent space of y. :param v: A point in the tangent space of origin point. :type v: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of transporting v from the tangent space at origin point to the tangent space at y.

Return type:

tensor

abstractmethod dist(x, y, c)

Calculate the squared geodesic/distance between x and y. :param x: A point on the manifold. :type x: tensor :param y: A point on the manifold. :type y: tensor :param c: The manifold curvature. :type c: tensor

Returns:

the geodesic/distance between x and y.

Return type:

tensor

abstractmethod egrad2rgrad(grad, x, c)

Computes Riemannian gradient from the Euclidean gradient, typically used in Riemannian optimizers. :param grad: Euclidean gradient at x. :type grad: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

Riemannian gradient at x.

Return type:

tensor

abstractmethod inner(v1, v2, x, c, keep_shape)

Computes the inner product of a pair of tangent vectors v1 and v2 at x. :param v1: A tangent point at x. :type v1: tensor :param v2: A tangent point at x. :type v2: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor :param keep_shape: Whether the output tensor keeps shape or not. :type keep_shape: bool, optional

Returns:

The inner product of v1 and v2 at x.

Return type:

tensor

retraction(v, x, c)

Retraction is a continuous map function from tangent space to the manifold, typically used in Riemannian optimizers. The exp map is one of retraction functions. :param v: A tangent point at x. :type v: tensor :param x: A point on the manifold. :type x: tensor :param c: The manifold curvature. :type c: tensor

Returns:

The result of mapping tangent point v at x to the manifold.

Return type:

tensor