Skip to content

identity_compression

Bases: identity_expansion

The identity data compression function.

It performs the identity compression of the input data batch, and returns the compression result. This class directly inherits from the identity_expansion class, which inherits from the base data transformation class. Both of them are performing the identical data transformation operators on the input data batch.

...

Notes

For the identity compression function, the compression space dimension equals to the input space dimension.

For input vector \(\mathbf{x} \in R^m\), its identity compression will be $$ \begin{equation} \kappa(\mathbf{x}) = \sigma(\mathbf{x}) \in R^d \end{equation} $$ where \(d = m\). By default, we can also process the input with optional pre- or post-processing functions denoted by \(\sigma(\cdot)\) in the above formula.

Attributes:

Name Type Description
name str, default = 'identity_compression'

Name of the compression function.

Methods:

Name Description
__init__

It performs the initialization of the compression function.

calculate_D

It calculates the compression space dimension d based on the input dimension parameter m.

forward

It implements the abstract forward method declared in the base transformation class.

Source code in tinybig/compression/basic_compression.py
class identity_compression(identity_expansion):
    r"""
        The identity data compression function.

        It performs the identity compression of the input data batch, and returns the compression result.
        This class directly inherits from the identity_expansion class, which inherits from the base data transformation class.
        Both of them are performing the identical data transformation operators on the input data batch.

        ...

        Notes
        ----------
        For the identity compression function, the compression space dimension equals to the input space dimension.

        For input vector $\mathbf{x} \in R^m$, its identity compression will be
        $$
            \begin{equation}
                \kappa(\mathbf{x}) = \sigma(\mathbf{x}) \in R^d
            \end{equation}
        $$
        where $d = m$. By default, we can also process the input with optional pre- or post-processing functions
        denoted by $\sigma(\cdot)$ in the above formula.

        Attributes
        ----------
        name: str, default = 'identity_compression'
            Name of the compression function.

        Methods
        ----------
        __init__
            It performs the initialization of the compression function.

        calculate_D
            It calculates the compression space dimension d based on the input dimension parameter m.

        forward
            It implements the abstract forward method declared in the base transformation class.

    """

    def __init__(self, name='identity_compression', *args, **kwargs):
        """
            The initialization method of the identity compression function.

            It initializes an identity compression object based on the input function name.
            This method will also call the initialization method of the base class.

            Parameters
            ----------
            name: str, default = 'identity_compression'
                The name of the identity compression function.

            Returns
            ----------
            transformation
                The identity compression function.
        """
        super().__init__(name=name, *args, **kwargs)

__init__(name='identity_compression', *args, **kwargs)

The initialization method of the identity compression function.

It initializes an identity compression object based on the input function name. This method will also call the initialization method of the base class.

Parameters:

Name Type Description Default
name

The name of the identity compression function.

'identity_compression'

Returns:

Type Description
transformation

The identity compression function.

Source code in tinybig/compression/basic_compression.py
def __init__(self, name='identity_compression', *args, **kwargs):
    """
        The initialization method of the identity compression function.

        It initializes an identity compression object based on the input function name.
        This method will also call the initialization method of the base class.

        Parameters
        ----------
        name: str, default = 'identity_compression'
            The name of the identity compression function.

        Returns
        ----------
        transformation
            The identity compression function.
    """
    super().__init__(name=name, *args, **kwargs)