Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow 2 documentation for graph-mode

When I check the TensorFlow documentation (Python API docs or guides), it all seems exclusively for eager-mode. Almost all the examples don't even mention this. For some specific operation/function like tf.nn.relu, this does not really make any difference. However, for more complex things like tf.data (Dataset API, guide), it likely makes a difference. Esp all the examples would be different for graph mode.

Where can I find recent documentation (API references, guides, tutorials, examples) for graph mode? (My current fallback is to check latest TF 1 documentation. But at some point, this will become more and more outdated.)

Or is graph mode deprecated so far that documentation for it seems not necessary anymore?

like image 774
Albert Avatar asked Nov 22 '25 14:11

Albert


1 Answers

Graph mode in TensorFlow 2 is different from graph mode in TensorFlow 1. Instead of using sessions and placeholders, TensorFlow 2 uses functions annotated with tf.function. The eager mode examples you see can be executed in graph mode by wrapping them within a tf.function.

If you prefer to use the TensorFlow 1 style of graph mode with sessions and placeholders, you can still do so in TensorFlow 2 by using the tf.compat.v1 module. The API docs in that module describe the TensorFlow 1 style of graph mode. You can find archived guides about TensorFlow 1 graph mode at https://github.com/tensorflow/docs/tree/master/site/en/r1/guide

like image 138
AAudibert Avatar answered Nov 24 '25 07:11

AAudibert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!