Dtype error when using Mixed Precision and building EfficientNetB0 Model

391 views Asked by At

System information

  • OS Platform and Distribution : MacOS
  • TensorFlow installed from : Colab
  • TensorFlow version : 2.5.0
  • Python version: python 3.7
  • GPU model and memory: Tesla T4

Error TypeError: Input 'y' of 'Sub' Op has type float16 that does not match type float32 of argument 'x'

Current behaviour

While using Mixed Precision and building a Keras Functional API model (EfficientNet B0), it shows the below error TypeError: Input 'y' of 'Sub' Op has type float16 that does not match type float32 of argument 'x'

Note : For some reason StackOverflow isn't allowing me to post the images. Visit the below link to get more insight over the issue : https://github.com/tensorflow/tensorflow/issues/49725

Expected behaviour

The Global Policy I set in the previous cell was mixed_float16. The problem works fine when running on tensorflow 2.4.1 so the bug is with tensorflow 2.5.0

You can reproduce the same error using the below notebook : https://colab.research.google.com/drive/1TfNZSIJ_I7IZI35RsGFnTdj-6beMHV2_?usp=sharing

0

There are 0 answers