Tal*_*war 8 python keras tensorflow recurrent-neural-network tensorflow2.0
该CuDNNGRU中TensorFlow 1.0是非常快。但是当我转移到TensorFlow 2.0我无法找到CuDNNGRU. 简单GRU在 TensorFlow 2.0.
有没有办法使用CuDNNGRU的TensorFlow 2.0?
Ove*_*gon 17
在导入的实现已经过时-相反,LSTM并且GRU将默认为CuDNNLSTM和CuDNNGRU,如果所有条件都满足:
activation = 'tanh'recurrent_activation = 'sigmoid'recurrent_dropout = 0unroll = Falseuse_bias = Truereset_after = True (仅限 GRU)还要确保 TensorFlow 使用 GPU:
import tensorflow as tf
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
Run Code Online (Sandbox Code Playgroud)
更新:在 Colab 上运行时,TF 2.0.0 似乎存在问题,使 CuDNN 正常工作;试试吧!pip install tensorflow==2.1.0。