diff options
author | 2018-07-25 08:21:22 -0700 | |
---|---|---|
committer | 2018-07-25 08:24:02 -0700 | |
commit | be3d22844025e42e177a21479f3ae73bc5351c1f (patch) | |
tree | 6a31b60adc71dd840043ef794cd158ead9608ec9 /tensorflow/python | |
parent | 1170da749f442554219f207a7cc745811c528320 (diff) |
Warn if creating a MultiRNNCell with multiple identical cell objects.
This is likely a bug.
PiperOrigin-RevId: 205996090
Diffstat (limited to 'tensorflow/python')
-rw-r--r-- | tensorflow/python/ops/rnn_cell_impl.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/python/ops/rnn_cell_impl.py b/tensorflow/python/ops/rnn_cell_impl.py index 70805fd572..42806ba6ec 100644 --- a/tensorflow/python/ops/rnn_cell_impl.py +++ b/tensorflow/python/ops/rnn_cell_impl.py @@ -1261,6 +1261,11 @@ class MultiRNNCell(RNNCell): raise TypeError( "cells must be a list or tuple, but saw: %s." % cells) + if len(set([id(cell) for cell in cells])) < len(cells): + logging.log_first_n(logging.WARN, + "At least two cells provided to MultiRNNCell " + "are the same object and will share weights.", 1) + self._cells = cells for cell_number, cell in enumerate(self._cells): # Add Checkpointable dependencies on these cells so their variables get |