1

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

  • Welcome to Stack Overflow! You can post your code example and full error traceback as a [code block](https://stackoverflow.com/editing-help#syntax-highlighting) right in your question. Actually it is a preferred and strongly recommended way for posting code here on SO as the external resources may become invalid in time and it helps other users in searching your question. – Sergey Shubin May 26 '21 at 07:53
  • The issue is a bug and you should report it to the main source (not appropriate here in SO). – Innat May 26 '21 at 13:18
  • Simple [code](https://github.com/tensorflow/tensorflow/issues/49725#issuecomment-848762618) to reproduce the issue. – Innat May 26 '21 at 13:20

0 Answers0