pytype icon indicating copy to clipboard operation
pytype copied to clipboard

`tensorflow.keras.backend` import breaks `pytype`

Open lgeiger opened this issue 3 years ago • 0 comments

When linting the following code with [email protected] adding a from tensorflow.keras import backend import breaks linting.

The following code breaks:

import tensorflow as tf
from tensorflow.keras import backend  # This line breaks linting in line 4

print(tf.keras.models.Sequential())
File "tf_imports.py", line 4, in <module>: No attribute 'models' on module 'tensorflow.keras' [module-attr]

However the removing line 2 seems to make pytype happy again:

import tensorflow as tf

print(tf.keras.models.Sequential())

I tested this with Tensorflow v2.5.0 and v2.6.0.

lgeiger avatar Jul 12 '21 11:07 lgeiger