From 66fe67d84fe29d25ef2f962a20e2ff5b2774c918 Mon Sep 17 00:00:00 2001 From: Lifann Date: Fri, 28 Jul 2023 15:15:48 +0800 Subject: [PATCH] fix: Do not reuse variable in python to avoid confict of multiple variables with different properties --- .../dynamic_embedding/python/ops/dynamic_embedding_variable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py b/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py index 42daaed33..7e77c7a8d 100644 --- a/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py +++ b/tensorflow_recommenders_addons/dynamic_embedding/python/ops/dynamic_embedding_variable.py @@ -1226,7 +1226,7 @@ def default_partition_fn(keys, shard_num): scope = variable_scope.get_variable_scope() scope_store = variable_scope._get_default_variable_store() full_name = scope.name + "/" + name if scope.name else name - if full_name in scope_store._vars: + if context.executing_eagerly() and full_name in scope_store._vars: if scope.reuse is False: err_msg = ("Variable %s already exists, disallowed." " Did you mean to set reuse=True or "