提交 447ab781 authored 作者: Frederic Bastien's avatar Frederic Bastien

Skip a test in FAST_COMPILE and small refactor

上级 0f82ee2d
...@@ -3560,29 +3560,27 @@ class Test_local_useless_elemwise_comparison(unittest.TestCase): ...@@ -3560,29 +3560,27 @@ class Test_local_useless_elemwise_comparison(unittest.TestCase):
def test_equality_shapes(self): def test_equality_shapes(self):
# Test equality where one sides contain only shapes related # Test equality where one sides contain only shapes related
# stuff. # stuff.
if theano.config.mode == "FAST_COMPILE":
raise SkipTest("Skip opt test as the opt is disabled")
x = T.vector('x', dtype=config.floatX) x = T.vector('x', dtype=config.floatX)
mode = theano.compile.get_default_mode().including('local_useless_elemwise_comparison',
'local_shape_to_shape_i',
'local_track_shape_i',
'local_subtensor_make_vector')
for g in [x.shape[0], for g in [x.shape[0],
Shape_i(0)(x)]: Shape_i(0)(x)]:
f = theano.function([x], T.eq(g, 0), mode=mode) f = theano.function([x], T.eq(g, 0))
assert f([3, 3]) == 0 assert f([3, 3]) == 0
assert f([]) == 1 assert f([]) == 1
f = theano.function([x], T.eq(g, -1), mode=mode) f = theano.function([x], T.eq(g, -1))
self.assert_eqs_const(f, 0) self.assert_eqs_const(f, 0)
assert f([3, 3]) == 0 assert f([3, 3]) == 0
g = join(0, g = join(0,
x.shape[0:], # todo test reshape, dimshuffle x.shape[0:], # todo test reshape, dimshuffle
x.shape[0:1]) x.shape[0:1])
f = theano.function([x], T.eq(g, 0), mode=mode) f = theano.function([x], T.eq(g, 0))
assert (f([3, 3]) == 0).all() assert (f([3, 3]) == 0).all()
assert (f([]) == 1).all() assert (f([]) == 1).all()
f = theano.function([x], T.eq(g, -1), mode=mode) f = theano.function([x], T.eq(g, -1))
self.assert_eqs_const(f, 0, op=T.alloc) self.assert_eqs_const(f, 0, op=T.alloc)
assert (f([3, 3]) == 0).all() assert (f([3, 3]) == 0).all()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论