Skip to content

sphere_patch_based_geometric_compression

Bases: geometric_compression

The sphere patch based geometric compression function.

It performs the data compression based on sphere geometric patch shapes and provided compression metric. This class inherits from the geometric_compression class, and only redefines the initialization method.

...

Attributes:

Name Type Description
metric Callable[[Tensor], Tensor]

The geometric compression metric.

name str, default = 'sphere_patch_based_geometric_compression'

Name of the compression function.

p_r int

Radius of the sphere patch shape.

Methods:

Name Description
__init__

It performs the initialization of the compression function based on the provided metric and sphere patch shapes.

Source code in tinybig/compression/geometric_compression.py
class sphere_patch_based_geometric_compression(geometric_compression):
    """
        The sphere patch based geometric compression function.

        It performs the data compression based on sphere geometric patch shapes and provided compression metric.
        This class inherits from the geometric_compression class, and only redefines the initialization method.

        ...

        Attributes
        ----------
        metric: Callable[[torch.Tensor], torch.Tensor]
            The geometric compression metric.
        name: str, default = 'sphere_patch_based_geometric_compression'
            Name of the compression function.
        p_r: int
            Radius of the sphere patch shape.

        Methods
        ----------
        __init__
            It performs the initialization of the compression function based on the provided metric and sphere patch shapes.
    """
    def __init__(
        self,
        metric: Callable[[torch.Tensor], torch.Tensor],
        p_r: int,
        name: str = 'sphere_patch_based_geometric_compression',
        *args, **kwargs
    ):
        """
            The initialization method of the sphere patch based geometric compression function.

            It initializes the sphere compression function based on the provided sphere patch shape
            of the data segments to be compressed in the provided grid structure.

            Parameters
            ----------
            metric: Callable[[torch.Tensor], torch.Tensor]
                The geometric compression metric.
            name: str, default = 'sphere_patch_based_geometric_compression'
                Name of the compression function.
            p_r: int
                Radius of the sphere shape.

            Returns
            ----------
            transformation
                The sphere geometric compression function.
        """
        patch = sphere(p_r=p_r)
        super().__init__(name=name, metric=metric, patch=patch, *args, **kwargs)

__init__(metric, p_r, name='sphere_patch_based_geometric_compression', *args, **kwargs)

The initialization method of the sphere patch based geometric compression function.

It initializes the sphere compression function based on the provided sphere patch shape of the data segments to be compressed in the provided grid structure.

Parameters:

Name Type Description Default
metric Callable[[Tensor], Tensor]

The geometric compression metric.

required
name str

Name of the compression function.

'sphere_patch_based_geometric_compression'
p_r int

Radius of the sphere shape.

required

Returns:

Type Description
transformation

The sphere geometric compression function.

Source code in tinybig/compression/geometric_compression.py
def __init__(
    self,
    metric: Callable[[torch.Tensor], torch.Tensor],
    p_r: int,
    name: str = 'sphere_patch_based_geometric_compression',
    *args, **kwargs
):
    """
        The initialization method of the sphere patch based geometric compression function.

        It initializes the sphere compression function based on the provided sphere patch shape
        of the data segments to be compressed in the provided grid structure.

        Parameters
        ----------
        metric: Callable[[torch.Tensor], torch.Tensor]
            The geometric compression metric.
        name: str, default = 'sphere_patch_based_geometric_compression'
            Name of the compression function.
        p_r: int
            Radius of the sphere shape.

        Returns
        ----------
        transformation
            The sphere geometric compression function.
    """
    patch = sphere(p_r=p_r)
    super().__init__(name=name, metric=metric, patch=patch, *args, **kwargs)