mixed precison performance

Hi,

I use the ResNet50 example code, with below extra code to enable float16, but the performance drops much, is it expected?

from tensorflow.keras import mixed_precision mixed_precision.set_global_policy('mixed_float16')

Replies

Hi @juliussf

Currently the FP16 support is not yet available for many of the operations in tensorflow-metal so my guess here would be that the execution of ResNet50 falls back onto CPU for some operations where it can't find the GPU version for the requested data type. This would explain the performance drop as there would be excessive back-and-forth between the GPU and the CPU to resolve the computation.

Thanks for reporting this, I'll make a note of this feature being of interest to bump up the priority of providing extensive FP16 support on the platform.

Thank you so much for quick reply, so it means the performance w/o enabling mixed_float16 on tensorflow-metal is FP32 on GPU, is that right?