У меня есть:
from keras.layers import Input, LSTM, Dense, TimeDistributed, Activation, BatchNormalization, Dropout, Bidirectional
from keras.models import Sequential
from keras.utils import Sequence
from tensorflow.compat.v1.keras.layers import CuDNNLSTM
и
self.model.add(CuDNNLSTM(lstm1_size, input_shape=(
seq_length, feature_dim), return_sequences=True))
# self.model.add(BatchNormalization())
self.model.add(Dropout(0.2))
self.model.add(CuDNNLSTM(lstm2_size, return_sequences=True))
self.model.add(Dropout(0.2))
self.model.add(CuDNNLSTM(lstm3_size, return_sequences=True))
self.model.add(Dropout(0.2))
self.model.add(CuDNNLSTM(lstm4_size, return_sequences=True))
self.model.add(Dropout(0.2))
self.model.add(Dense(feature_dim, activation='linear'))
Но я получаю ошибку:
TypeError: The added layer must be an instance of class Layer. Found: <tensorflow.python.keras.layers.cudnn_recurrent.CuDNNLSTM object at 0x140869be0>