base ==== .. py:module:: topmost.models.hierarchical.HyperMiner.manifolds.base .. autoapi-nested-parse:: Base manifold. Module Contents --------------- .. autoapisummary:: topmost.models.hierarchical.HyperMiner.manifolds.base.Manifold .. py:class:: Manifold(**kwargs) Bases: :py:obj:`object` Abstract class to define basic operations on a manifold. .. attribute:: clip Clips tensor values to a specified min and max. :type: function .. attribute:: dtype The type of the variables. .. attribute:: eps A small constant value. :type: float .. attribute:: max_norm The maximum value for number clipping. :type: float .. attribute:: min_norm The minimum value for number clipping. :type: float Initialize a manifold. .. py:attribute:: min_norm :value: 1e-15 .. py:attribute:: max_norm :value: 1000000000000000.0 .. py:attribute:: eps :value: 1e-05 .. py:attribute:: dtype .. py:attribute:: clip .. py:method:: proj(x, c) :abstractmethod: 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. :rtype: tensor .. py:method:: proj_tan(v, x, c) :abstractmethod: 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. :rtype: tensor .. py:method:: proj_tan0(v, c) :abstractmethod: 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. :rtype: tensor .. py:method:: expmap(v, x, c) :abstractmethod: 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. :rtype: tensor .. py:method:: expmap0(v, c) :abstractmethod: 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. :rtype: tensor .. py:method:: logmap(y, x, c) :abstractmethod: 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. :rtype: tensor .. py:method:: logmap0(y, c) :abstractmethod: 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. :rtype: tensor .. py:method:: ptransp(v, x, y, c) :abstractmethod: 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. :rtype: tensor .. py:method:: ptransp0(v, x, c) :abstractmethod: 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. :rtype: tensor .. py:method:: dist(x, y, c) :abstractmethod: 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. :rtype: tensor .. py:method:: egrad2rgrad(grad, x, c) :abstractmethod: 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. :rtype: tensor .. py:method:: inner(v1, v2, x, c, keep_shape) :abstractmethod: 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. :rtype: tensor .. py:method:: 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. :rtype: tensor