TypeError: The added layer must be an instance of class Layer.
jackz314 opened this issue · 4 comments
Hi,
I just got started with this library and was following the example here, but I'm getting this error:
TypeError: The added layer must be an instance of class Layer. Found <kapre.time_frequency.Melspectrogram object at 0x000001B7A4077400>
I'm on Windows, with keras version 2.3.1 and TensorFlow version 2.2.0
That's strange. Could you track down a bit more? As you can see on the implementation, Melspectrogram
is a subclass of keras Layer
.
Hi, I'm in the same situation with the Melspectrogram layer, but a little different error:
TypeError: The added layer must be an instance of class Layer. Found:
I'm on Mac OS Catalina 10.15.5, with keras version 2.3.1 and TensorFlow version 2.2.0 (the same as former issue).
I just realized what's going on, this error is happening because of the different keras
code used, in the example, keras
related things are imported from keras
whereas in the kapre
codebase keras
is actually imported from tensorflow.keras
. Changing the keras
import to tensorflow.keras
fixes the problem.