2

So, I have a conda env with the following packages installed:

tensorboard               2.9.1                    pypi_0    pypi
tensorboard-data-server   0.6.1                    pypi_0    pypi
tensorboard-plugin-wit    1.8.1                    pypi_0    pypi
tensorflow-deps           2.9.0                         0    apple
tensorflow-estimator      2.9.0                    pypi_0    pypi
tensorflow-macos          2.9.2                    pypi_0    pypi
tensorflow-metal          0.5.1                    pypi_0    pypi

and my IDE (DataSpell) signals the following: enter image description here

However, If i run the code, no error whatsoever is thrown, so I suppose that I'm missing some configuration, any idea?

Alberto Sinigaglia
  • 12,097
  • 2
  • 20
  • 48

1 Answers1

1

Please import the keras from tensorflow as below:

from tensorflow import keras

#Or

from tensorflow import keras as k
  • 1
    hi there, sorry for the delay... thank for the answer, however this only fixes half of the problem as for example subclassing from keras layer leads to `'CustomLayer' object is not callable`, as if `keras.layers.Layer` is not callable... (also clicking over `keras.layers.Concatenate` lead to a "Cannot find declaration to go to") – Alberto Sinigaglia Aug 21 '22 at 13:36
  • Can you please share some more reproducible code to understand and fix this error. –  Aug 22 '22 at 14:45
  • just use the code you have provided, add `x = k.layers.Concatenate()` and use CMD/Ctrl+click over the "Concatenate", and you will see that the IDE can't find any reference... however, `import keras.api._v2.keras as keras` works fine as reported by claudia in the comment section – Alberto Sinigaglia Aug 22 '22 at 15:58
  • Please have a look at this [gist](https://colab.research.google.com/gist/RenuPatelGoogle/80e479959b83879ce00340d0a86b04fc/73405532.ipynb). You can check [tf.keras.layers.Concatenate](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Concatenate) api for more details. –  Aug 22 '22 at 16:26
  • the problem occurs with TF 2.9 as reported on the question – Alberto Sinigaglia Aug 22 '22 at 16:32
  • Hi @AlbertoSinigaglia, It's the same output even using TF 2.9 also. –  Aug 22 '22 at 17:01