提交 b4fbaa2e authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Apply isort to tests.gof sub-package modules

上级 ed04fa8a
import pytest
import numpy as np
import pytest
import theano
from theano.gof.link import PerformLinker
from theano.gof import fg
from theano.gof.cc import CLinker, DualLinker, OpWiseCLinker
from theano.gof.type import Type
from theano.gof.graph import Variable, Apply, Constant
from theano.gof.graph import Apply, Constant, Variable
from theano.gof.link import PerformLinker
from theano.gof.op import Op
from theano.gof import fg
from theano.gof.type import Type
def as_variable(x):
......
import os
import sys
import traceback
import warnings
import pytest
import numpy as np
import pytest
import theano
import theano.tensor as tt
from theano import config, scalar
from theano.gof import Apply, Op, utils
from theano.tensor.basic import _allclose
......@@ -222,21 +218,12 @@ class TestComputeTestValue:
def fx(prior_result, A):
return tt.dot(prior_result, A)
# Since we have to inspect the traceback,
# we cannot simply use self.assertRaises()
with pytest.raises(ValueError):
with pytest.raises(ValueError) as e:
theano.scan(fn=fx, outputs_info=tt.ones_like(A), non_sequences=A, n_steps=k)
# Get traceback
tb = sys.exc_info()[2]
frame_infos = traceback.extract_tb(tb)
assert str(e.traceback[0].path).endswith("test_compute_test_value.py")
# We should be in the "fx" function defined above
expected = "test_compute_test_value.py"
assert any(
(os.path.split(frame_info[0])[1] == expected and frame_info[2] == "fx")
for frame_info in frame_infos
), frame_infos
assert e.traceback[2].name == "fx"
@theano.change_flags(compute_test_value="raise")
def test_scan_err2(self):
......@@ -255,8 +242,6 @@ class TestComputeTestValue:
fn=fx, outputs_info=tt.ones_like(A.T), non_sequences=A, n_steps=k
)
# Since we have to inspect the traceback,
# we cannot simply use self.assertRaises()
with pytest.raises(ValueError, match="^could not broadcast input"):
theano.scan(
fn=fx, outputs_info=tt.ones_like(A.T), non_sequences=A, n_steps=k
......
import pytest
from copy import copy
from theano.gof.type import Type
from theano.gof import graph
from theano.gof.graph import Variable, Apply
import pytest
from tests.unittest_tools import assertFailure_fast
from theano import change_flags
from theano.gof import destroyhandler, graph
from theano.gof.fg import FunctionGraph, InconsistencyError
from theano.gof.graph import Apply, Variable
from theano.gof.op import Op
from theano.gof.opt import (
NavigatorOptimizer,
OpKeyOptimizer,
OpSub,
PatternSub,
NavigatorOptimizer,
TopoOptimizer,
OpSub,
)
from theano import change_flags
from theano.gof import destroyhandler
from theano.gof.fg import FunctionGraph, InconsistencyError
from theano.gof.toolbox import ReplaceValidate
from tests.unittest_tools import assertFailure_fast
from theano.gof.type import Type
def PatternOptimizer(p1, p2, ign=True):
......
import pickle
import pytest
from itertools import count
import numpy as np
import pytest
from itertools import count
from theano import sparse, shared, tensor
from theano import shared, sparse, tensor
from theano.gof.graph import (
Apply,
Variable,
as_string,
clone,
equal_computations,
general_toposort,
inputs,
io_toposort,
Variable,
equal_computations,
)
from theano.gof.op import Op
from theano.gof.type import Type
......
import os
import numpy as np
import theano
import theano.tensor as tt
floatX = "float32"
......
import pytest
from copy import deepcopy
import numpy as np
import pytest
import theano
import theano.tensor as tt
from copy import deepcopy
from theano import function, Mode
from theano import Mode, function
from theano.gof import Apply, generic
from theano.gof.op import PureOp
from theano.ifelse import ifelse
......
......@@ -3,14 +3,12 @@ from copy import deepcopy
import numpy as np
import theano
from theano.gof import graph
from theano.gof.graph import Variable, Apply, Constant
from theano.gof.type import Type
from theano.gof.op import Op
from theano.gof import fg
from theano.gof.link import PerformLinker, WrapLinker, Container
from theano.compat import cmp
from theano.gof import fg, graph
from theano.gof.graph import Apply, Constant, Variable
from theano.gof.link import Container, PerformLinker, WrapLinker
from theano.gof.op import Op
from theano.gof.type import Type
def as_variable(x):
......@@ -175,7 +173,7 @@ class TestWrapLinker:
def test_sort_schedule_fn():
import theano
from theano.gof.sched import sort_schedule_fn, make_depends
from theano.gof.sched import make_depends, sort_schedule_fn
x = theano.tensor.matrix("x")
y = theano.tensor.dot(x[:5] * 2, x.T + 1).T
......
import numpy as np
import pytest
from six import string_types
import theano
import theano.gof.op as op
import theano.tensor as tt
from six import string_types
from theano import scalar, shared, config
from theano import config, scalar, shared
from theano.configparser import change_flags
from theano.gof.graph import Apply, Variable
from theano.gof.type import Generic, Type
from theano.gof.op import Op
from theano.gof.utils import TestValueError, MethodNotDefined
from theano.gof.type import Generic, Type
from theano.gof.utils import MethodNotDefined, TestValueError
def as_variable(x):
......
import theano.tensor as tt
from theano.gof.type import Type
from theano.gof.graph import Variable, Apply, Constant
from theano.gof.fg import FunctionGraph
from theano.gof.graph import Apply, Constant, Variable
from theano.gof.op import Op
from theano.gof.opt import (
EquilibriumOptimizer,
MergeOptimizer,
OpKeyOptimizer,
OpSub,
PatternSub,
TopoOptimizer,
OpSub,
MergeOptimizer,
config,
theano,
EquilibriumOptimizer,
logging,
pre_constant_merge,
pre_greedy_local_optimizer,
theano,
)
from theano.gof.fg import FunctionGraph
from theano.tensor.type_other import MakeSlice, SliceConstant, slicetype
from theano.tensor.subtensor import AdvancedSubtensor
from theano.gof.type import Type
from theano.tensor.opt import constant_folding
from theano.tensor.subtensor import AdvancedSubtensor
from theano.tensor.type_other import MakeSlice, SliceConstant, slicetype
def is_variable(x):
......
import pytest
from theano.gof.optdb import opt, DB
from theano.gof.optdb import DB, opt
class TestDB:
......
import pytest
import numpy as np
import pytest
import theano
from theano import tensor, Generic
from tests import unittest_tools as utt
from theano import Generic, tensor
from theano.gof import Apply, COp, EnumList, Op, Params, ParamsType
from theano.scalar import Scalar
from theano.tensor import TensorType
from theano.gof import ParamsType, Params, EnumList, Op, COp, Apply
from tests import unittest_tools as utt
tensor_type_0d = TensorType("float64", tuple())
scalar_type = Scalar("float64")
......
from theano import tensor
from theano.compat import cmp
from theano.gof.graph import io_toposort
from theano.gof.sched import (
make_dependence_cmp,
sort_apply_nodes,
reverse_dict,
_toposort,
make_dependence_cmp,
posort,
reverse_dict,
sort_apply_nodes,
)
from theano import tensor
from theano.gof.graph import io_toposort
from theano.compat import cmp
def test_dependence():
dependence = make_dependence_cmp()
......
from theano import tensor
from theano.gof.graph import Variable, Apply
from theano.gof.type import Type
from theano.gof.op import Op
from theano.gof.fg import FunctionGraph
from theano.gof.graph import Apply, Variable
from theano.gof.op import Op
from theano.gof.toolbox import NodeFinder, is_same_graph
from theano.gof.type import Type
class TestNodeFinder:
......
import os
import numpy as np
import pytest
import theano
from theano import Op, Apply, scalar
from theano import Apply, Op, scalar
from theano.gof.type import CDataType, CEnumType, EnumList, EnumType
from theano.tensor import TensorType
from theano.gof.type import CDataType, EnumType, EnumList, CEnumType
# todo: test generic
......
......@@ -2,15 +2,13 @@ import gc
import sys
import time
import pytest
import numpy as np
import pytest
import theano
from theano import function, tensor
from theano.gof import vm, OpWiseCLinker
from theano.compile import Mode
from theano.gof import OpWiseCLinker, vm
from theano.ifelse import ifelse
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论