提交 8cdeff01 authored 作者: Iban Harlouchet's avatar Iban Harlouchet

flake8 for theano/gof/tests/test_destroyhandler.py

上级 daabc688
from __future__ import print_function from __future__ import print_function
import unittest
from six.moves import xrange from six.moves import xrange
from theano.gof.type import Type from theano.gof.type import Type
from theano.gof import graph from theano.gof import graph
from theano.gof.graph import Variable, Apply from theano.gof.graph import Variable, Apply
from theano.gof.op import Op from theano.gof.op import Op
from theano.gof.opt import * from theano.gof.opt import * # noqa
from theano.gof import destroyhandler from theano.gof import destroyhandler
from theano.gof.fg import FunctionGraph, InconsistencyError from theano.gof.fg import FunctionGraph, InconsistencyError
...@@ -15,8 +13,14 @@ from theano.gof.toolbox import ReplaceValidate ...@@ -15,8 +13,14 @@ from theano.gof.toolbox import ReplaceValidate
from copy import copy from copy import copy
PatternOptimizer = lambda p1, p2, ign=True: OpKeyOptimizer(PatternSub(p1, p2), ignore_newtrees=ign)
OpSubOptimizer = lambda op1, op2, fail=NavigatorOptimizer.warn_ignore, ign=True: TopoOptimizer(OpSub(op1, op2), ignore_newtrees=ign, failure_callback=fail) def PatternOptimizer(p1, p2, ign=True):
return OpKeyOptimizer(PatternSub(p1, p2), ignore_newtrees=ign)
def OpSubOptimizer(op1, op2, fail=NavigatorOptimizer.warn_ignore, ign=True):
return TopoOptimizer(OpSub(op1, op2),
ignore_newtrees=ign, failure_callback=fail)
def as_variable(x): def as_variable(x):
...@@ -329,7 +333,7 @@ def test_long_destroyers_loop(): ...@@ -329,7 +333,7 @@ def test_long_destroyers_loop():
add_in_place(y, z)), add_in_place(y, z)),
add_in_place(z, x)) add_in_place(z, x))
try: try:
g2 = Env(*graph.clone([x, y, z], [e2])) Env(*graph.clone([x, y, z], [e2]))
raise Exception("Shouldn't have reached this point.") raise Exception("Shouldn't have reached this point.")
except InconsistencyError: except InconsistencyError:
pass pass
...@@ -349,7 +353,7 @@ def test_multi_destroyers(): ...@@ -349,7 +353,7 @@ def test_multi_destroyers():
x, y, z = inputs() x, y, z = inputs()
e = add(add_in_place(x, y), add_in_place(x, y)) e = add(add_in_place(x, y), add_in_place(x, y))
try: try:
g = Env([x, y, z], [e]) Env([x, y, z], [e])
raise Exception("Shouldn't have reached this point.") raise Exception("Shouldn't have reached this point.")
except InconsistencyError as e: except InconsistencyError as e:
pass pass
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论