tensorflow: Couldn't find and import the 'graph_transforms' module in tensorflow1.14

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Centos7.6
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): 1.14
  • Python version: 2.7
  • Bazel version (if compiling from source): 24.1
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

You can collect some of this information using our environment capture script You can also obtain the TensorFlow version with: 1. TF 1.0: python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)" 2. TF 2.0: python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the current behavior

import tensorflow.tools.graph_transforms as graph_transforms

Error message:

AttributeError: 'module' object has no attribute 'graph_transforms'

Describe the expected behavior Successfully import the graph_transforms module. This code succesfully run with tf 1.13 but failed on tf 1.14.

Code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem.

import tensorflow.tools.graph_transforms as graph_transforms

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. The installed ‘graph_transforms’ module seems has been moved to tensorflow_core folder in site-packages. Is this as expected?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

For 2.0 it seems the issue has cropped up again:

In [8]: tf.__version__                                                                                                                                                                        
Out[8]: '2.1.0-dev20191114'

In [9]: from tensorflow.tools import graph_transforms                                                                                                                                         
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-9-81608bad8d7f> in <module>
----> 1 from tensorflow.tools import graph_transforms

ImportError: cannot import name 'graph_transforms' from 'tensorflow_core.tools' (/usr/lib/python3.7/site-packages/tensorflow_core/tools/__init__.py)

In [10]: from tensorflow import tools                                                                                                                                                         

In [11]: dir(tools)                                                                                                                                                                           
Out[11]: 
['__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__']

The issue is reproducible both with TF2.0 release version and TF nightly.

Is there any solution for TF 2.2?