提交 307cb704 authored 作者: Frederic Bastien's avatar Frederic Bastien

Disable another costly check when the client list is long.

上级 a3253d39
...@@ -260,7 +260,7 @@ class FunctionGraph(utils.object2): ...@@ -260,7 +260,7 @@ class FunctionGraph(utils.object2):
""" """
return r.clients return r.clients
def __add_client__(self, r, new_client, check=True): def __add_client__(self, r, new_client):
""" """
Updates the list of clients of r with new_clients. Updates the list of clients of r with new_clients.
...@@ -272,14 +272,11 @@ class FunctionGraph(utils.object2): ...@@ -272,14 +272,11 @@ class FunctionGraph(utils.object2):
(node, i) pairs such that node.inputs[i] is r. (node, i) pairs such that node.inputs[i] is r.
""" """
test = new_client in r.clients # Ne need to do the assert as it is always True. The logic
if test: # that call __add_client__ is valid. When the client list is
print('ERROR: clients intersect!', file=sys.stderr) # long, the check it time consuming, so we don't enable it by
print(' RCLIENTS of', r, [(n, i, type(n), id(n)) # default.
for n, i in r.clients], file=sys.stderr) # assert not new_client in r.clients
print(' NCLIENTS of', r, [(n, i, type(n), id(n))
for n, i in [new_client]], file=sys.stderr)
assert not test
r.clients.append(new_client) r.clients.append(new_client)
def __remove_client__(self, r, client_to_remove, def __remove_client__(self, r, client_to_remove,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论