提交 e10365de authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed an except TypeError I had overlooked earlier

上级 08d45e3f
...@@ -14,7 +14,7 @@ from theano.compile import optdb ...@@ -14,7 +14,7 @@ from theano.compile import optdb
from theano.configparser import AddConfigVar, BoolParam from theano.configparser import AddConfigVar, BoolParam
from theano.printing import pprint, debugprint from theano.printing import pprint, debugprint
from theano.tensor import basic as tensor from theano.tensor import basic as tensor
from theano.tensor import elemwise, opt from theano.tensor import elemwise, opt, NotScalarConstantError
############ ############
...@@ -277,7 +277,7 @@ def is_neg(var): ...@@ -277,7 +277,7 @@ def is_neg(var):
try: try:
constant = opt.get_scalar_constant_value(mul_input) constant = opt.get_scalar_constant_value(mul_input)
is_minus_1 = numpy.allclose(constant, -1) is_minus_1 = numpy.allclose(constant, -1)
except TypeError: except NotScalarConstantError:
is_minus_1 = False is_minus_1 = False
if is_minus_1: if is_minus_1:
# Found a multiplication by -1. # Found a multiplication by -1.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论