Get Compression Information

get_compression(self, compression_id: str) → netspresso.compressor.core.compression.CompressionInfo

Get information about a compression.

Parameters

compression_id (str) – The ID of the compression.

Raises

e – If an error occurs while getting the compression information.

Returns

The information about the compression.

Return type

CompressionInfo

Details of Returns

class CompressionInfo(compressed_model_id: str = '', compression_id: str = '', compression_method: str = '', available_layers: List[netspresso.compressor.core.compression.AvailableLayer] = <factory>, original_model_id: str = '', options: netspresso.compressor.core.compression.Options = <factory>)[source]

Represents compression information for a model.

compressed_model_id

The ID of the compressed model.

Type

str

compression_id

The ID of the compression.

Type

str

compression_method

The compression method used.

Type

str

available_layers

The compressible layers information.

AvailableLayer Attributes:
  • name (str): The name of the layer.

  • values (List[Any]): The compression parameters for the layer.

  • channels (List[int]): The channel information for the layer.

Type

List[AvailableLayer]

options

The options for pruning method.

Type

Options, optional

original_model_id

The ID of the original model.

Type

str

Example

from netspresso.compressor import ModelCompressor


compressor = ModelCompressor(email="YOUR_EMAIL", password="YOUR_PASSWORD")
compressed_info = compressor.get_compression(compression_id="YOUR_COMPRESSION_ID")

Output

>>> compressed_info
CompressionInfo(
    compressed_model_id="c65ca574-08ab-4a42-9e82-a222bd089b2c",
    compression_id="YOUR_COMPRESSION_ID",
    compression_method="PR_L2",
    available_layers=[
        AvailableLayer(name='conv1', values=[0.59375], channels=[32]),
        AvailableLayer(name='layers.0.conv2', values=[0.25], channels=[64]),
        AvailableLayer(name='layers.1.conv2', values=[0.25], channels=[128]),
        AvailableLayer(name='layers.2.conv2', values=[0.34375], channels=[128]),
        AvailableLayer(name='layers.3.conv2', values=[0.33203125], channels=[256]),
        AvailableLayer(name='layers.4.conv2', values=[0.55859375], channels=[256]),
        AvailableLayer(name='layers.5.conv2', values=[0.56640625], channels=[512]),
        AvailableLayer(name='layers.6.conv2', values=[0.697265625], channels=[512]),
        AvailableLayer(name='layers.7.conv2', values=[0.70703125], channels=[512]),
        AvailableLayer(name='layers.8.conv2', values=[0.580078125], channels=[512]),
        vailableLayer(name='layers.9.conv2', values=[0.51953125], channels=[512]),
        AvailableLayer(name='layers.10.conv2', values=[0.517578125], channels=[512]),
        AvailableLayer(name='layers.11.conv2', values=[0.7734375], channels=[1024]),
        AvailableLayer(name='layers.12.conv2', values=[0.0234375], channels=[1024])
    ],
    options={'reshape_channel_axis': -1, 'policy': 'average', 'layer_norm': 'tss_norm', 'group_policy': 'average'}
    original_model_id=""
)