def test_test_local_remove_useless_assert2(self):
# remove assert condition that are always true
mode = theano.config.mode
if mode == 'FAST_COMPILE':
mode = 'FAST_RUN'
mode = compile.mode.get_mode(mode)
x = T.scalar()
y = T.scalar()
f = theano.function([x, y], theano.tensor.opt.assert_op(x, y, 1),
mode=mode)
assert f(1, 1) == 1
assert f(5, 1) == 5
topo = f.maker.fgraph.toposort()
assert len(topo) == 2
assert len(topo[0].inputs) == 2
assert topo[1].op == deep_copy_op
评论列表
文章目录