9951 explained code solutions for 126 technologies


python-tensorflowHow can I check the version of TensorFlow and Keras I am using with Python?


To check the version of TensorFlow and Keras you are using with Python, you can use the following code block:

import tensorflow as tf
import keras

print(tf.__version__)
print(keras.__version__)

The output of the code will be the version of TensorFlow and Keras you are using:

2.1.0
2.3.1

The code block consists of the following parts:

  1. import tensorflow as tf - imports the TensorFlow library and assigns it to the variable tf.
  2. import keras - imports the Keras library.
  3. print(tf.__version__) - prints out the version of TensorFlow you are using.
  4. print(keras.__version__) - prints out the version of Keras you are using.

Helpful links

Edit this code on GitHub