nncf
nncf copied to clipboard
Support models without a batch dimension
Changes
- Modified
nncf/quantization/algorithms/fast_bias_correction/openvino_backend.py. - Updated the
create_input_datamethod to add a specific check for 1D input shapes (i.e.,len(shape) == 1). - When a 1D model is detected, the function now bypasses the per-channel loop and directly uses the single mean tensor from the
datalist.
Reason for changes
The create_input_data method was looping based on the channel dimension size (3) but should have been based on the statistics list size (1)
Related tickets
Closes the feature request: "Currently FastBiasCorrection algorithm does not support models without the batch dimension" https://github.com/openvinotoolkit/nncf/issues/3481
Tests
Verified the fix by running the reproducer command provided in the issue, which now passes:
python -m pytest tests/openvino/native/test_fast_bias_correction.py -k OneDimMM
@daniil-lyakhov , please take a look