Merge pull request #34486 from georgesterpu:patch-6

PiperOrigin-RevId: 289382079
Change-Id: I2e5ec5a98b6e69fb6492abe13158223c10f3e3ac
This commit is contained in:
TensorFlower Gardener 2020-01-12 23:07:56 -08:00
commit 5b4590d6f3

View File

@ -82,10 +82,10 @@ class StackedRNNCells(Layer):
def __init__(self, cells, **kwargs): def __init__(self, cells, **kwargs):
for cell in cells: for cell in cells:
if not hasattr(cell, 'call'): if not 'call' in dir(cell):
raise ValueError('All cells must have a `call` method. ' raise ValueError('All cells must have a `call` method. '
'received cells:', cells) 'received cells:', cells)
if not hasattr(cell, 'state_size'): if not 'state_size' in dir(cell):
raise ValueError('All cells must have a ' raise ValueError('All cells must have a '
'`state_size` attribute. ' '`state_size` attribute. '
'received cells:', cells) 'received cells:', cells)
@ -391,10 +391,10 @@ class RNN(Layer):
**kwargs): **kwargs):
if isinstance(cell, (list, tuple)): if isinstance(cell, (list, tuple)):
cell = StackedRNNCells(cell) cell = StackedRNNCells(cell)
if not hasattr(cell, 'call'): if not 'call' in dir(cell):
raise ValueError('`cell` should have a `call` method. ' raise ValueError('`cell` should have a `call` method. '
'The RNN was passed:', cell) 'The RNN was passed:', cell)
if not hasattr(cell, 'state_size'): if not 'state_size' in dir(cell):
raise ValueError('The RNN cell should have ' raise ValueError('The RNN cell should have '
'an attribute `state_size` ' 'an attribute `state_size` '
'(tuple of integers, ' '(tuple of integers, '