提交 8a64516f authored 作者: Frederic Bastien's avatar Frederic Bastien

Make MetaConvOptimizer don't print useless error.

上级 bc355bfe
......@@ -37,6 +37,15 @@ def _list_of_nodes(fgraph):
return list(graph.io_toposort(fgraph.inputs, fgraph.outputs))
class LocalMetaOptimizerSkipAssertionError(AssertionError):
"""This is an AssertionError, but instead of having the
LocalMetaOptimizer print the error, it just skip that
compilation.
"""
pass
class Optimizer(object):
"""
......@@ -1130,6 +1139,10 @@ class LocalMetaOptimizer(LocalOptimizer):
Base class for meta-optimizers that try a set of LocalOptimizers
to replace a node and choose the one that executes the fastest.
If the error LocalMetaOptimizerSkipAssertionError is raised during
compilation, we will skip that function compilation and not print
the error.
"""
def __init__(self):
......@@ -1194,6 +1207,8 @@ class LocalMetaOptimizer(LocalOptimizer):
on_unused_input='ignore')
fn.trust_input = True
timing = min(self.time_call(fn) for _ in range(2))
except LocalMetaOptimizerSkipAssertionError:
continue
except Exception as e:
if self.verbose > 0:
print("* %s: exception" % opt, e)
......
......@@ -490,7 +490,7 @@ def local_abstractconv_check(node):
AbstractConv3d,
AbstractConv3d_gradWeights,
AbstractConv3d_gradInputs)):
raise AssertionError(
raise gof.opt.LocalMetaOptimizerSkipAssertionError(
'%s Theano optimization failed: there is no implementation '
'available supporting the requested options. Did you exclude '
'both "conv_dnn" and "conv_gemm" from the optimizer? If on GPU, '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论