This repository was archived by the owner on Dec 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 287
This repository was archived by the owner on Dec 11, 2025. It is now read-only.
register error for tf2.x #125
Copy link
Copy link
Closed
Labels
Description
Describe the bug
from delta.layers.base_layer import Layer
will raise error:
"Registering two gradient with name 'BlockLSTM'!
caused by from delta.layers.recurrent import RnnAttentionEncoder
To Reproduce
under delta/delta/models
python autoencoder_model_test.py
Screenshots
Traceback (most recent call last):
File "autoencoder_model_test.py", line 35, in setUp
import_all_modules_for_register_v2()
File "/workbase/delta/delta/utils/register.py", line 181, in import_all_modules_for_register_v2
importlib.import_module(full_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/workbase/delta/delta/models/autoencoder_model.py", line 25, in <module>
from delta.layers.base_layer import Layer
File "/workbase/delta/delta/layers/__init__.py", line 19, in <module>
from delta.layers.recurrent import RnnAttentionEncoder
File "/workbase/delta/delta/layers/recurrent.py", line 23, in <module>
from tensorflow.contrib import seq2seq
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 37, in <module>
from tensorflow.contrib import cudnn_rnn
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/__init__.py", line 38, in <module>
from tensorflow.contrib.cudnn_rnn.python.layers import *
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/layers/__init__.py", line 23, in <module>
from tensorflow.contrib.cudnn_rnn.python.layers.cudnn_rnn import *
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/layers/cudnn_rnn.py", line 20, in <module>
from tensorflow.contrib.cudnn_rnn.python.ops import cudnn_rnn_ops
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 22, in <module>
from tensorflow.contrib.rnn.python.ops import lstm_ops
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/rnn/__init__.py", line 91, in <module>
from tensorflow.contrib.rnn.python.ops.lstm_ops import *
File "/root/.local/lib/python3.6/site-packages/tensorflow/contrib/rnn/python/ops/lstm_ops.py", line 298, in <module>
@ops.RegisterGradient("BlockLSTM")
File "/root/.local/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 2489, in __call__
_gradient_registry.register(f, self._op_type)
File "/root/.local/lib/python3.6/site-packages/tensorflow_core/python/framework/registry.py", line 61, in register
(self._name, name, function_name, filename, line_number))
KeyError: "Registering two gradient with name 'BlockLSTM'! (Previous registration was in register /root/.local/lib/python3.6/site-packages/tensorflow_core/python/framework/registry.py:66)"
----------------------------------------------------------------------
Ran 2 tests in 0.216s
FAILED (errors=1)
Additional context
test under delta docker