提交 08ad8b0d authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Better check suggested in code review

上级 ea0717ee
...@@ -1773,11 +1773,13 @@ class Remove0Tester(utt.InferShapeTester): ...@@ -1773,11 +1773,13 @@ class Remove0Tester(utt.InferShapeTester):
if theano.config.mode not in ['FAST_COMPILE']: if theano.config.mode not in ['FAST_COMPILE']:
# list of apply nodes in the optimized graph. # list of apply nodes in the optimized graph.
nodes = f.maker.fgraph.toposort() nodes = f.maker.fgraph.toposort()
for node in nodes: # Check there isn't any Remove0 instance not inplace.
if isinstance(node.op, Remove0): assert not any([isinstance(node.op, Remove0) and
assert node.op.inplace, ('Inplace optimization should ' not node.op.inplace for node in nodes]), (
'have been applied.') 'Inplace optimization should have been applied')
# Check there is at least one Remove0 inplace.
assert any([isinstance(node.op, Remove0) and node.op.inplace
for node in nodes])
# checking # checking
# makes sense to change its name # makes sense to change its name
target = mat target = mat
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论