Search code examples
pythontensorflowversiontensorflow-estimatortf.keras

How to get TensorFlow Estimator version using Python code (not CLI)


I can get the versions of TensorFlow and TensorFlow Keras using these code lines:

import tensorflow as tf;
print("TensorFlow version:",tf.__version__);
print("TensorFlow Keras version:",tf.keras.__version__);
#print("TensorFlow Estimator version:",tf.estimator.__version__);

However, tf.estimator has no __version__ attribute. Is there another way to get TensorFlow Estimator version in Python code?


Solution

  • After investigating the tf.estimator module with python 'help' function, the answer is that tf.estimator totally has no VERSION attribute.

    #python code
    import tensorflow as tf;
    help(tf.estimator);
    

    Output:

    Help on package tensorflow_estimator.python.estimator.api.estimator in tensorflow_estimator.python.estimator.api:
    
    NAME
        tensorflow_estimator.python.estimator.api.estimator - Estimator: High level tools for working with models.
    
    PACKAGE CONTENTS
        experimental (package)
        export (package)
        inputs (package)
    
    FILE
        /usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/api/estimator/__init__.py
    

    It seems the only way is using CLI command, for example:

    pip3 list | grep tensorflow-estimator