提交 4e0fb124 authored 作者: Frederic's avatar Frederic

Fix tests. All in FAST_COMPILE except the pycuda one

上级 3b4ccf8b
......@@ -29,8 +29,15 @@ class TestPyDotFormatter(unittest.TestCase):
f = th.function(m.inputs, m.outputs)
pdf = PyDotFormatter()
graph = pdf(f)
self.assertEqual(len(graph.get_nodes()), 11)
expected = 11
if th.config.mode == "FAST_COMPILE":
expected = 12
self.assertEqual(len(graph.get_nodes()), 12)
nc = self.node_counts(graph)
if th.config.mode == "FAST_COMPILE":
assert nc['apply'] == 6
else:
assert nc['apply'] == 5
assert nc['output'] == 1
......@@ -43,6 +50,9 @@ class TestPyDotFormatter(unittest.TestCase):
sub_graphs = graph.get_subgraph_list()
assert len(sub_graphs) == 2
ofg1, ofg2 = sub_graphs
if th.config.mode == "FAST_COMPILE":
assert len(ofg1.get_nodes()) == 9
else:
assert len(ofg1.get_nodes()) == 5
assert len(ofg1.get_nodes()) == len(ofg2.get_nodes())
......
......@@ -15,8 +15,13 @@ def check_deterministic(iterable):
# So I must use an assert here. In the long term we should fix the rest of
# theano to use exceptions correctly, so that this can be a TypeError.
if iterable is not None:
assert isinstance(iterable, (
list, tuple, OrderedSet, types.GeneratorType, string_types))
if not isinstance(iterable, (
list, tuple, OrderedSet,
types.GeneratorType, string_types)):
if len(iterable) > 1:
# We need to accept length 1 size to allow unpickle in tests.
raise AssertionError(
"Get an not ordered iterable when one was expected")
# Copyright (C) 2009 Raymond Hettinger
# Permission is hereby granted, free of charge, to any person obtaining a
......
......@@ -287,8 +287,8 @@ class PycudaElemwiseSourceModuleMakeThunkOp(Op):
# As we have a dict in props, we need to implement __hash__
def __hash__(self):
return hash(type(self), hash(self.scalar_op),
hash_from_dict(self.inplace_pattern))
return hash((type(self), hash(self.scalar_op),
hash_from_dict(self.inplace_pattern)))
def __str__(self):
if self.name is None:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论