提交 ed64521e authored 作者: Frederic Bastien's avatar Frederic Bastien 提交者: Reyhane Askari

Make tests independant of toposort order

上级 feadd031
......@@ -256,8 +256,10 @@ class T_sigmoid_opts(unittest.TestCase):
[x, y],
(sigmoid(x) * sigmoid(-y) * -tensor.exp(-x) *
tensor.exp(x * y) * tensor.exp(y)), mode=m)
match(f, [sigmoid, tensor.mul, tensor.neg, tensor.exp, sigmoid,
tensor.mul])
topo = f.maker.fgraph.toposort()
for op, nb in [(sigmoid, 2), (tensor.mul, 2),
(tensor.neg, 1), (tensor.exp, 1)]:
assert sum([n.op == op for n in topo]) == nb
# assert check_stack_trace(f, ops_to_check=[sigmoid, tensor.mul,
# tensor.exp])
......
......@@ -2207,8 +2207,9 @@ class test_local_subtensor_lift(unittest.TestCase):
assert isinstance(prog[0].op, tensor.DimShuffle)
assert isinstance(prog[1].op.scalar_op, theano.scalar.
Composite) # Composite{add,exp}
assert prog[2].op == tensor.add
assert isinstance(prog[3].op, tensor.Subtensor) # first subtensor
assert prog[2].op == tensor.add or prog[3].op == tensor.add
# first subtensor
assert isinstance(prog[2].op, tensor.Subtensor) or isinstance(prog[3].op, tensor.Subtensor)
assert len(prog) == 4
f([[0, 1], [2, 3]], [4, 5]) # let debugmode test something
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论