openvinotoolkit / openvinotoolkit/nncf

[TorchFX] Do not propagate quantizers through `__get_item__` when input/output has different numel

Open
#3,109 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
1.2k
Forks
305
Avg merge
1d 9h
Merged PRs (30d)
27

Description

🚀 Feature request

Some TorchFX operations are returning a tuple instead of a torch.Tesnor. In case an algorithm requests a statistic from such node nncf will raise an error like tuple has not is_empty method. This affects the yolon11 model, current workaround is the ignored scope with the type of operation which returns a tuple:

nncf.IgnoredScope(types=["__getitem__"])

Solver debug illustration:
image

The task is to:

  • Find a way to automatically detect __getitem__ which have a tuple as an input (or __getitem__ which gets a piece of the input tenor, not the whole tensor) and do not propagate quantizers up through such operations. __getitem__ which input numel is the same as output numel should be marked as quantize-agnostic
Feature Use Case

No response

Are you going to submit a PR?
  • Yes I'd like to help by submitting a PR!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the TorchFX getitem quantizer-propagation path and inspect how input and output numel are determined, including tuple-valued inputs. Done means partial or tuple-producing slices no longer propagate quantizers, while operations preserving numel remain quantize-agnostic; add or update focused coverage if the relevant tests are found.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.