Couldn't import 'tensorflow.tools.graph_transforms' in tensorflow 2.5.0

Viewed 976

I have a problem with importing import tensorflow.tools.graph_transforms

Here is the following error:

ModuleNotFoundError: No module named 'tensorflow.tools.graph_transforms'

here is the code:

from tensorflow.tools.graph_transforms import TransformGraph

Information

Tensorflow Version:

> pip show tensorflow

Name: tensorflow
Version: 2.5.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: ..\appdata\local\programs\python\python39\lib\site-packages
Requires: tensorboard, wheel, keras-nightly, grpcio, wrapt, six, astunparse, gast, protobuf, typing-extensions, google-pasta, numpy, tensorflow-estimator, h5py, flatbuffers, opt-einsum, absl-py, keras-preprocessing, termcolor
Required-by:

OS: Windows 10

Python version: 3.9.5

1 Answers
from tensorflow.tools.graph_transforms import TransformGraph

was no longer supported in versions TF 1.14+.

Please check this doc regarding the new API.

Hope that works for you in TF 2.5.0.

Related