chikitin
chikitin

Reputation: 781

What are Aliases and Difference between tf.compat.v1 and tf.compat.v2?

I have the following questions:

  1. What are Aliases in TF2 Documents such as for tf.keras.utils.get_file? Does this mean we can use both tf.foo and tf.compat.v1.foo?

  2. What are Difference between tf.compat.v1 and tf.compat.v2?

Upvotes: 2

Views: 1515

Answers (1)

nessuno
nessuno

Reputation: 27050

tf.compat is the compatibility module. v1 is the version 1.x of TensorFlow, while v2 is the version 2.x of TensorFlow (so although strange, you have tf2 inside tf2, through tf.compat.v2).

For the aliases: yes, if a function is an alias of another, you can use the one you prefer. However, using the compatibility module is often not needed and I recommend to do not reply on it too much (usually it is better to find the tf2 equivalent way of doing something, instead of writing code in the tf1 style, through tf.compat.v1)

Upvotes: 3

Related Questions