Remove the unnecessary type check from legacy RNN code.

PiperOrigin-RevId: 302544931
Change-Id: I591db053c5835529a7cf9a4e1180e0d77299c145
This commit is contained in:
A. Unique TensorFlower 2020-03-23 16:33:29 -07:00 committed by TensorFlower Gardener
parent 3e2b031211
commit 1bf7b2f0cf

View File

@ -23,6 +23,7 @@ from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_util
from tensorflow.python.keras.engine import base_layer
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import control_flow_util
@ -160,6 +161,7 @@ def _is_keras_rnn_cell(rnn_cell):
# Keras cells never had zero_state method, which was from the original
# interface from TF RNN cell.
return (not isinstance(rnn_cell, rnn_cell_impl.RNNCell) and
isinstance(rnn_cell, base_layer.Layer) and
getattr(rnn_cell, "zero_state", None) is None)