aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python
diff options
context:
space:
mode:
authorGravatar James Keeling <jtkeeling@google.com>2018-07-25 08:21:22 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-25 08:24:02 -0700
commitbe3d22844025e42e177a21479f3ae73bc5351c1f (patch)
tree6a31b60adc71dd840043ef794cd158ead9608ec9 /tensorflow/python
parent1170da749f442554219f207a7cc745811c528320 (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.py5
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