Observed since 21 Oct, 10:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Module for compressing Convolutional Neural Networks in Aidge.
A module for compressing Convolutional Neural Networks (CNNs).
This module decomposes convolutional layers into multiple smaller convolution operations, reducing the total number of computations and improving inference speed.
It provides a C++/Python interface for compression.
Work in progress — PyPI packages are not yet available.
The wheels are published to the Aidge GitLab Package Registry on every push to main (pre-release .dev0) and on tag commits (stable release).
Requires a GitLab personal access token with read_api scope (set as GITLAB_TOKEN):
export GITLAB_TOKEN=<your_personal_access_token>
# Install latest stable release
pip install aidge_compression \
--index-url https://gitlab.eclipse.org/api/v4/projects/eclipse%2Faidge%2Faidge_compression/packages/pypi/simple
# Install latest pre-release (dev version)
pip install --pre aidge_compression \
--index-url https://gitlab.eclipse.org/api/v4/projects/eclipse%2Faidge%2Faidge_compression/packages/pypi/simple
# Install a specific version
pip install aidge_compression==0.0.5 \
--index-url https://gitlab.eclipse.org/api/v4/projects/eclipse%2Faidge%2Faidge_compression/packages/pypi/simple
The dependencies
aidge_coreandaidge_backend_cpuare also published to the monorepo GitLab Package Registry. Add the monorepo index as well so pip can resolve them:
pip install aidge_compression \
--index-url https://gitlab.eclipse.org/api/v4/projects/eclipse%2Faidge%2Faidge_compression/packages/pypi/simple \
--extra-index-url https://gitlab.eclipse.org/api/v4/projects/eclipse%2Faidge%2Faidge/packages/pypi/simple
pip install aidge_compression
Requires aidge_core and aidge_backend_cpu to be installed first (from GitLab Package Registry, PyPI, or built from source):
pip install aidge_core aidge_backend_cpu
pip install .
| Package | Version |
|---|---|
| numpy | >= 1.21.6 |
| aidge_core | any |
| Library | Version | Purpose |
|---|---|---|
| Eigen | 3.4.0 | Linear algebra |
| nlohmann/json | 3.11.3 | JSON parsing |
| pybind11 | >= 3.0 | Python bindings |
| Package | Role |
|---|---|
| aidge_core | Core graph, operators, tensor infrastructure |
| aidge_backend_cpu | CPU backend (required for compression evaluation) |
# With Python bindings (default)
pip install .
# C++ only, without Python
cmake -B build -DPYBIND=OFF
cmake --build build
# With tests
cmake -B build -DTEST=ON
cmake --build build
ctest --test-dir build
CMake options:
| Option | Default | Description |
|---|---|---|
PYBIND | ON | Build Python bindings |
WERROR | ON | Treat warnings as errors |
TEST | OFF | Build C++ unit tests |
COVERAGE | OFF | Enable code coverage (GCC only) |
Example usage with resnet18, where the first convolution is ignored, and manual ranks are assigned to specific layers (-1 ignores the layer, [0.,1.] represents a weakening factor):
import aidge_core
import aidge_onnx
import aidge_compression
model = aidge_onnx.load_onnx("resnet18.onnx")
ignores = {"conv1_Conv"}
ranks = {
"layer1_layer1_1_conv1_Conv": -1.,
"layer2_layer2_0_conv1_Conv": -1.,
}
aidge_compression.Compressor(ignores, ranks, 0.8).compress(model)
aidge_onnx.export_onnx(
model,
"resnet18_0.8.onnx",
inputs_dims={
list(model.get_input_nodes(aidge_core.InputCategory.Data))[0].name(): [
[1, 3, 224, 224]
]
},
outputs_dims={list(model.get_output_nodes())[0].name(): [[1, 100]]},
opset=18,
)
A more complete set of examples to use this module is provided in the examples/ folder, including a tutorial notebook.
This module compresses CNNs through tensor decomposition, replacing a single convolutional tensor with multiple smaller tensors, reducing computational complexity.
{width=50%}
The process starts with rank selection for each layer's decomposition:
Without a training dataset: The module uses VBMF to estimate the rank for each layer.
With a training dataset: It leverages inference on the dataset to assess the impact of decomposition on each layer.
With a partial dataset: The method can still use the available data, but it's preferable to ensure the dataset represents various cases the network will encounter.
Following rank selection, each layer undergoes Tucker-2 decomposition or WeightSVD:
{width=50%}
WeightSVD: Applied to 2D tensors, replacing a single tensor with two smaller ones.
Tucker-2: Applied to 4D tensors, replacing a 4D tensor with two 2D tensors and a smaller 4D tensor.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.5.dev0 | 1 Jul 2026 | 4 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 10:28 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:7ae36d48eb26cb344cb9b5843fa70aca30ffa5ea2d01219573ba41fa95a6a1dd