How to use automatic mixed precision with TensorFlow?

201 Views Asked by At

I don't manage to use Automatic Mixed Precision with TensorFlow 2.3.2 (on Windows 10).

I have a TF_ENABLE_AUTO_MIXED_PRECISION variable set to 1 in my system environment. I have enabled memory growth using explicit Python code.

I am doing model inference only, not training. I am not calling model.compile.

I don't see anything in the TensorFlow log about automatic mixed precision being detected or enabled, and memory requirements remain just as high as without the environment variable set. 7GB is a lot and I would expect to see a difference if TF was using float16's instead of float32's.

Is there anything else that I should do beyond setting the environment variable? I just can't work out what is wrong. I just want TensorFlow to automatically and transparently rewrite my graph and do calculations with float16's internally.

0

There are 0 best solutions below