Tensorflow 2.0中是否有cudnnLSTM或cudNNGRU替代品 [英] Is there cudnnLSTM or cudNNGRU alternative in tensorflow 2.0

查看:761
本文介绍了Tensorflow 2.0中是否有cudnnLSTM或cudNNGRU替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TensorFlow 1.0中的CuDNNGRU确实非常快.但是当我转到TensorFlow 2.0时,我找不到CuDNNGRU.简单的GRUTensorFlow 2.0中真的很慢.

The CuDNNGRU in TensorFlow 1.0 is really fast. But when I shifted to TensorFlow 2.0 i am unable to find CuDNNGRU. Simple GRU is really slow in TensorFlow 2.0.

有什么方法可以在TensorFlow 2.0中使用CuDNNGRU?

Is there any way to use CuDNNGRU in TensorFlow 2.0?

推荐答案

可导入的实现已被弃用-相反,如果所有

The importable implementations have been deprecated - instead, LSTM and GRU will default to CuDNNLSTM and CuDNNGRU if all conditions are met:

  1. activation = 'tanh'
  2. recurrent_activation = 'sigmoid'
  3. recurrent_dropout = 0
  4. unroll = False
  5. use_bias = True
  6. 输入如果被屏蔽,请严格右击
  7. reset_after = True(仅限GRU)
  1. activation = 'tanh'
  2. recurrent_activation = 'sigmoid'
  3. recurrent_dropout = 0
  4. unroll = False
  5. use_bias = True
  6. Inputs, if masked, are strictly right-padded
  7. reset_after = True (GRU only)


还要确保TensorFlow使用GPU:


Also ensure TensorFlow uses 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()))


更新:在Colab上运行时,似乎在TF 2.0.0上存在问题,以使CuDNN正常工作;尝试使用!pip install tensorflow==2.1.0.


Update: there appears to be a problem w/ TF 2.0.0 when running on Colab in getting CuDNN to work; try !pip install tensorflow==2.1.0 instead.

这篇关于Tensorflow 2.0中是否有cudnnLSTM或cudNNGRU替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆