microsoft / tensorflow-directml-plugin

DirectML PluggableDevice plugin for TensorFlow 2
Apache License 2.0
179 stars 23 forks source link

encounter a problem #318

Open zc317414 opened 1 year ago

zc317414 commented 1 year ago

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:

[[CudnnRNN]] [[model/bidirectional/forward_lstm_3/PartitionedCall]] [[binary_crossentropy/logistic_loss/_12]] (1) 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: [[CudnnRNN]] [[model/bidirectional/forward_lstm_3/PartitionedCall]] 0 successful operations. 0 derived errors ignored. [Op:__inference_train_function_53639]
zc317414 commented 1 year 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

Input for variable-length sequences of integers

inputs = keras.Input(shape=(None,), dtype="int32")

Embed each integer in a 128-dimensional vector

x = layers.Embedding(max_features, 128)(inputs)

Add 2 bidirectional LSTMs

x = layers.Bidirectional(layers.LSTM(64, return_sequences=True))(x) x = layers.Bidirectional(layers.LSTM(64))(x)

Add a classifier

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))

PatriceVignola commented 1 year ago

Hi @zc317414 ,

This is similar to this issue. We're currently working on it and will update this issue once we have more updates.