Skip to content Skip to sidebar Skip to footer

When We Should Use Tf.function Decorator

I'm trying to boost the performance of a simple 2NN. Here is the code: from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.kera

Solution 1:

Your code only used builtin functions and classes so there is no need to use a @tf.function decorator. @tf.function is basically used to convert a normal function into a TensorFlow Graph as mentioned here. Since you are only using the builtin modules and functions, they are already treated as a graph by the TF compiler.


Post a Comment for "When We Should Use Tf.function Decorator"