JIT compile set to false in compile function and set to true globally

Hi,

I have only one model in my code and before compiling the model I am setting this:

tf.config.optimizer.set_jit(True)

but when I compile the model, I set the jit_compile parameter to false.

What I am seeing is, when I add this:

tf.config.optimizer.set_jit(True)

the time by step is almost 2 times less than without setting it.
But I wondering how could this affect the time speed if the jit_compile is set to false?
My assumption is if jit_compile is set to false then, this

tf.config.optimizer.set_jit(True)

would be useless, but seems I am wrong.

Can someone explain this?

Hi @MLEnthusiastic,

Thanks for using tensorflow forum!

This tf.config.optimizer.set_jit(True) optimizes the overall TensorFlow graph, is used to improve performance where jit_compile=False means the model itself is not compiled with XLA.So far I’m aware, even without XLA compilation, the graph-level optimizations from set_jit(True) can still speed up the entire computation, including the model performance.

Hope this helps.