tensorflow / tensorflow/model-optimization

QAT for subclass inside the subclass

Open
#996 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.6k
Forks
349
Avg merge
3d 2h
Merged PRs (30d)
1

Description

I have one subclass A, which contains another subclass B inside it. I find subclass B in fact didn't get quanted.
class A ():
self.layers=[]
self.layers.append(Dense)
self.layers.append(class B)

class A_quant(A):
self.layers[0]=QuantizeWrapperV2(Dense, quant_config)
_config=B.get_config()
quant_layer=B_quant.from_config(_config)
self.layers[1]=quant_layer

Well, everything runs fine of quant_anonatize and quant_apply. Then I find only the Dense in Class A is quant, the denses in Class B doesn't get quant.

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 reproducing the nested-subclass case described for class A, subclass B, Dense, quant_anonatize, and quant_apply. Trace why the Dense layers inside B remain unquantized while the Dense layer in A is wrapped; done means nested subclass layers receive quantization as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
keras, python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.