message: Added support to CUDNN Rnn V2 in Keras APIs
diff: @@ -19,6 +19,7 @@ from __future__ import division
  from __future__ import print_function
  import collections
  +import os
  from tensorflow.python.framework import constant_op
  from tensorflow.python.keras import backend as K
  @@ -293,13 +294,20 @@ class CuDNNGRU(_CuDNNRNN):
  ],
  shape=self._vector_shape)
  - outputs, h, _, _ = gen_cudnn_rnn_ops.cudnn_rnn(
  - inputs,
  - input_h=input_h,
  - input_c=0,
  - params=params,
  - is_training=True,
  - rnn_mode='gru')
  + use_cudnn_v2 = os.environ.get("TF_CUDNN_RNN_USE_V2", "0")
  + args = {
  + "input": inputs,
  + "input_h": input_h,
  + "input_c": 0,
  + "params": params,
  + "is_training": True,
  + "rnn_mode": 'gru',
  + }
  +
  + if use_cudnn_v2 != "1":
  + outputs, h, _, _ = gen_cudnn_rnn_ops.cudnn_rnn(**args)
  + else:
  + outputs, h, _, _, _ = gen_cudnn_rnn_ops.cudnn_rnnv2(**args)
  if self.stateful or self.return_state:
  h = h[0]
  @@ -492,12 +500,19 @@ class CuDNNLSTM(_CuDNNRNN):
  ],
  shape=self._vector_shape)
  - outputs, h, c, _ = gen_cudnn_rnn_ops.cudnn_rnn(
  - inputs,
  - input_h=input_h,
  - input_c=input_c,
  - params=params,
  - is_training=True)
  + use_cudnn_v2 = os.environ.get("TF_CUDNN_RNN_USE_V2", "0")
  + args = {
  + "input": inputs,
  + "input_h": input_h,
  + "input_c": input_c,
  + "params": params,
  + "is_training": True,
  + }
  +
  + if use_cudnn_v2 != "1":
  + outputs, h, c, _ = gen_cudnn_rnn_ops.cudnn_rnn(**args)
  + else:
  + outputs, h, c, _, _ = gen_cudnn_rnn_ops.cudnn_rnnv2(**args)
  if self.stateful or self.return_state:
  h = h[0]
  