How can I use half floats with CoreML neural nets?

972 views Asked by At

I have converted a Keras model to CoreML. I want to make sure that CoreML uses half floats and not full floats for all its textures. How can I do this?

Updated: How can I make sure that the output of the network is half-float or at least Float (or any other type) and not Double?

1

There are 1 answers

8
Matthijs Hollemans On BEST ANSWER

You don't have to do anything for this if you run the CoreML model on the GPU. MPS (Metal Performance Shaders) will use half floats automatically. You can see this if you run a GPU Frame Capture on your CoreML model.

I wrote a blog post about how CoreML works under the hood, that actually demonstrates it uses half floats: http://machinethink.net/blog/peek-inside-coreml/