P-Gn
P-Gn

Reputation: 24581

How do I know which version of the Keras API is implemented in tf.keras?

In the standard implementation of Keras, one can get the API version using keras.__version__.

However, there is no tf.keras.__version__.

So how do I check the version of the Keras API implemented in tf.keras?

Upvotes: 5

Views: 18342

Answers (3)

Abhishek Sehgal
Abhishek Sehgal

Reputation: 598

You can simply run this code

from tensorflow.python import keras
print(keras.__version__)

which is compatible with TF v1.8.0.

Upvotes: 5

user3076252
user3076252

Reputation: 1937

This has recently been updated:

>>> import tensorflow as tf
>>> print(tf.keras.__version__)
2.1.6-tf
>>> print(tf.__version__)
1.12.0

Upvotes: 1

P-Gn
P-Gn

Reputation: 24581

You can retrieve the version of Keras implemented in tf.keras using

from tensorflow.python.keras._impl.keras import __version__ as tf_keras_version
print(tf_keras_version)
# 2.1.5-tf (in TF 1.8)

It seems that from TF 1.9 on, it will actually be accessible as tf.keras.__version__, as it should.

Upvotes: 0

Related Questions