Open maybeLee opened 2 years ago
@gadagashwini i was able to replicate the issue on colab, please find the gist here. Thank you!
Setting the private attribute _dtype
of a layer is not an official supported way to dynamically change dtypes of layers.
To discuss: Is there any official way to dynamically change the dtype of layers?
Please go to TF Forum for help and support:
https://discuss.tensorflow.org/tag/keras
If you open a GitHub issue, here is our policy:
It must be a bug, a feature request, or a significant problem with the documentation (for small docs fixes please send a PR instead). The form below must be filled out.
Here's why we have that policy:.
Keras developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.
System information.
You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"
Describe the problem. I want to automatically changing the datatype for some layers inside a DL model. By searching the internet, I was told that changing
_dtype
property of a layer is feasible to do so. That's why I want to change the_dtype
of some layers. However, I can change almost all layers' datatype except for the BatchNormalization layer. Specifically, I find that I cannot change the datatype of BatchNormalization layer tofloat64
ordouble
but I can change it tobfloat16
,float16
,float32
.Describe the current behavior. Currently, I cannot change the datatype of BatchNormalization to
float64
ordouble
by setting the_dtype
property of BatchNormalization, but I can change the datatype tobfloat16
,float16
,float32
. I can also change the datatype of other layers such asConv2D
.Describe the expected behavior. It would be of great help if I can also change the datatype of BN to
float64
by setting_dtype
. Currently, this strategy seems buggy.Contributing.
Standalone code to reproduce the issue.
You can also access the colab notebook here: https://colab.research.google.com/drive/1FZ8_DNWDYDeSa11VLAMAUK4xx1qp2k7n?usp=sharing
Source code / logs.