Skip to content

Cannot import tf.keras.engine #33786

@kiflowb777

Description

@kiflowb777

System information

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

After switching my code to tf.keras I cannot import tf.keras.engine:
with Keras:

import keras.layers as KL
import keras.models as KM
import keras.engine as KE

>>>OK

with tf.keras:

import tensorflow.keras.layers as KL
import tensorflow.keras.models as KM
import tensorflow.keras.engine as KE
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-004966c96ded> in <module>
      1 import tensorflow.keras.layers as KL
      2 import tensorflow.keras.models as KM
----> 3 import tensorflow.keras.engine as KE

ModuleNotFoundError: No module named 'tensorflow.keras.engine'

Metadata

Metadata

Labels

TF 1.14for issues seen with TF 1.14TF 1.15for issues seen on TF 1.15TF 2.0Issues relating to TensorFlow 2.0comp:kerasKeras related issuestype:bugBug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions