Description
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
- TensorFlow installed from (source or binary):
- TensorFlow version (use command below): 2.5
- Python version:
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version: 11.1
- GPU model and memory: 2080 Ti
Describe the current behavior
Please download the scripts to reproduce from : https://drive.google.com/drive/folders/15cajAZ9sAZ2Uyix8sDVSYku6QCqDCec7?usp=sharing
Command to run : python sample.py
.
I have a simple model with input layer and a depthwise conv2d layer. I quantize this model by adding quantize_and_dequantize nodes at the input of depthwiseconv2d layer (commented in the code). When I save the model and load it back, I see the following
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 544, in <lambda>
"function": lambda: self._recreate_function(proto.function),
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/load.py", line 586, in _recreate_function
proto, self._concrete_functions), setattr
File "/home/dperi/Downloads/py3/lib/python3.6/site-packages/tensorflow/python/saved_model/function_deserialization.py", line 295, in recreate_function
concrete_function_objects.append(concrete_functions[concrete_function_name])
KeyError: '__inference_depthwise_conv2d_layer_call_and_return_conditional_losses_117'
If I change the depthwise conv2d layer to a regular conv2d layer, the saving and loading quantized model works fine. This is weird and I'm not sure why that's happening.
Can anyone help me resolve the issue ?
Related issues that I checked : There are similar issues filed but the comments were not helpful for me.
tensorflow/tensorflow#42004
tensorflow/tensorflow#45945
Describe the expected behavior
Saved model loading works fine.
- Do you want to contribute a PR? (yes):
Standalone code to reproduce the issue
Please download the scripts to reproduce from : https://drive.google.com/drive/folders/15cajAZ9sAZ2Uyix8sDVSYku6QCqDCec7?usp=sharing