tensorflow / tensorflow/model-optimization
Failed quantization of dilated convolution layers: tensorflow or tensorflow-model-optimization bug?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.6k
- Forks
- 349
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 1
Description
Describe the bug
Tensorflow model optimization fails to quantize dilated convolution layers.
System information
TensorFlow version (installed from source or binary): source
TensorFlow Model Optimization version (installed from source or binary): source
Python version: 3.10.12
Describe the expected behavior
Quantizing dilated convolutions should be essentially the same as any other layer.
Describe the current behavior
Either tf or tfmot is silently failing. There is the following very old issue describing exactly this:
https://github.com/tensorflow/tensorflow/issues/26797
There is a slightly newer open issue showing that this was never resolved:
https://github.com/tensorflow/tensorflow/issues/53025
I am not 100% certain, but it seems like these issues are misplaced and should be designated as model-optimization issues.
There seems to be a workaround via using tf.nn.conv2d instead of tf.keras.layers.Conv2D, but as far as I can tell this would require layer subclassing which, based on other issues, is still buggy when it comes to quantization.
Code to reproduce the issue
See afformentioned issues.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked TensorFlow issues and reproducing the failure with a dilated tf.keras.layers.Conv2D quantization case. Compare that path with the suggested tf.nn.conv2d workaround and determine whether TensorFlow or TensorFlow Model Optimization is responsible. Done means the responsible component and a concrete fix scope are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- keras, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100