Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo changes to the input spec when RNN.unroll is True. #37374

Merged
merged 2 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions tensorflow/python/keras/layers/recurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,7 @@ def get_input_spec(shape):
batch_index, time_step_index = (1, 0) if self.time_major else (0, 1)
if not self.stateful:
input_spec_shape[batch_index] = None
if not getattr(self, 'unroll', False):
input_spec_shape[time_step_index] = None
input_spec_shape[time_step_index] = None
return InputSpec(shape=tuple(input_spec_shape))

def get_step_input_shape(shape):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,11 @@ def testSaveTimeDistributedLayer(self):
self.assertAllClose(loaded.predict_on_batch(array_ops.ones((3, 2, 1))),
predictions)

@parameterized.named_parameters([('with_unrolling', True),
('no_unrolling', False)])
@parameterized.named_parameters([
# TODO(b/148491963): Unrolling does not work with SavedModel
# ('with_unrolling', True),
('no_unrolling', False)
])
def testSaveStatefulRNN(self, unroll):
batch = 12
timesteps = 10
Expand Down