Open zc317414 opened 2 years ago
import numpy as np from tensorflow import keras from tensorflow.keras import layers max_features = 20000 # Only consider the top 20k words maxlen = 200 # Only consider the first 200 words of each movie review
inputs = keras.Input(shape=(None,), dtype="int32")
x = layers.Embedding(max_features, 128)(inputs)
x = layers.Bidirectional(layers.LSTM(64, return_sequences=True))(x) x = layers.Bidirectional(layers.LSTM(64))(x)
outputs = layers.Dense(1, activation="sigmoid")(x) model = keras.Model(inputs, outputs)
(x_train, y_train), (x_val, y_val) = keras.datasets.imdb.load_data( num_words=max_features ) print(len(x_train), "Training sequences") print(len(x_val), "Validation sequences") x_train = keras.preprocessing.sequence.pad_sequences(x_train, maxlen=maxlen) x_val = keras.preprocessing.sequence.pad_sequences(x_val, maxlen=maxlen)
model.compile("adam", "binary_crossentropy", metrics=["accuracy"]) model.fit(x_train, y_train, batch_size=32, epochs=2, validation_data=(x_val, y_val))
Hi @zc317414 ,
This is similar to this issue. We're currently working on it and will update this issue once we have more updates.
InvalidArgumentError: Graph execution error:
2 root error(s) found. (0) INVALID_ARGUMENT: No OpKernel was registered to support Op 'CudnnRNN' used by {{node CudnnRNN}} with these attrs: [seed=0, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="lstm", seed2=0, is_training=true] Registered devices: [CPU, GPU] Registered kernels: