I've been working through the tensorflow-2.0.0 beta tutorials. In the advanced example a tensorflow.keras
subclass is used. The presence of the @tf.function
decorator on train_step
and test_step
means the model executes in graph
mode (not sure if that's the correct terminology, I mean oposite to eager
mode). If I remove these decorators I can single step right into the model call
function and see the input/output tensor for each layer which is neat.
My question is, is there a programatic way to enable/disable the @tf.function
decorators. Commenting them out to switch between eager and graph mode doesn't seem particularly scaleable but it's certainly useful for debugging/learning)