Search code examples
pythontensorflowtensorrt

TensorFlow default precision mode?


I'm using TensorFlow 1.14 and testing TensorRT; as I see in the documentation, TensorRT support 3 precision modes: "FP32", "FP16", and "INT8". So I want to know what is the default precision mode of TensorFlow; I suppose it's FP32 but I'm not totally sure about this?


Solution

  • The default precision of weights in tensorflow is 'float32', as can be seen in weight initialisation function documentation here: https://github.com/tensorflow/tensorflow/blob/6bfbcf31dce9a59acfcad51d905894b082989012/tensorflow/python/ops/init_ops.py#L527

    However, inputs could be in multiple precision as supported by different layers used in model.

    Now, mostly you would want to reduce size of model (which is formed by model weights) after training to be able to deploy. During that time, you could reduce precision of model weight to FP16.