提交 e876a13b authored 作者: Frederic Bastien's avatar Frederic Bastien

Make a test don't run in DebugMode as CPU and GPU don't give the same results.

上级 f4d876e9
...@@ -373,7 +373,12 @@ class Test_TopK(unittest.TestCase): ...@@ -373,7 +373,12 @@ class Test_TopK(unittest.TestCase):
x = theano.tensor.vector(name='x', dtype=dtype) x = theano.tensor.vector(name='x', dtype=dtype)
y = argtopk(x, k, sorted=sorted, idx_dtype='int32') y = argtopk(x, k, sorted=sorted, idx_dtype='int32')
fn = theano.function([x], y, mode=self.mode) # DebugMode won't like the index change on collision on CPU
# So don't use DebugMode here.
mode = self.mode
if isinstance(self.mode, theano.compile.DebugMode):
mode = theano.Mode(optimizer=mode.optimizer)
fn = theano.function([x], y, mode=mode)
assert any([isinstance(n.op, self.op_class) for n in fn.maker.fgraph.apply_nodes]) assert any([isinstance(n.op, self.op_class) for n in fn.maker.fgraph.apply_nodes])
xval = np.repeat(np.random.uniform(-100., 100., size=size // 2).astype(dtype), 2) xval = np.repeat(np.random.uniform(-100., 100., size=size // 2).astype(dtype), 2)
xval = xval[np.random.permutation(size)] xval = xval[np.random.permutation(size)]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论