0

I have heard that tf.function can build graph and accelerate computation. But when can we use it?

From another answer, seems like:

when we are not using built-in functions

Any more specific answer?

Kaveh
  • 4,618
  • 2
  • 20
  • 33

1 Answers1

0

Here is a link that count pros of tf.function. Imagine you have a loss function, adding this keyword on top of your function can helps Tensorflow to run it faster however you might face error like

ValueError: tf.function-decorated function tried to create variables on non-first call.

if you are not initializing all variables in the first run.

Hassan
  • 118
  • 6