提交 c366f046 authored 作者: Saizheng Zhang's avatar Saizheng Zhang

fixed long type, removed useless tests in test_opt

上级 2ec83e4a
......@@ -4759,7 +4759,7 @@ def tile(x, reps, ndim=None):
else:
if ndim is not None and len(reps) > ndim:
raise ValueError("len(reps) should be equal or less than ndim")
if not numpy.all([isinstance(r, (int, long)) or
if not numpy.all([isinstance(r, integer_types) or
(isinstance(r, TensorVariable) and
r.dtype in theano.tensor.discrete_dtypes) for r in reps]):
raise ValueError("elements of reps must be scalars of integer dtype")
......
......@@ -3850,25 +3850,6 @@ class T_Tile(unittest.TestCase):
assert isinstance(topo[0].op, compile.DeepCopyOp)
f(data)
# If the repeat parameter is longer then v.ndim, we must
# replace it with a DimShuffle to add the extra parameter.
# But it isn't supported for now, so assert that we raise an
# error.
#self.assertRaises(ValueError, T.tile, v, (1,)*(v.ndim+1))
# If the repeat parameter is shorter then m.ndim, it should
# pad tot he left the repeat patter with 1. It is not supported for now.
f = theano.function([var], T.tile(v, (1,)*(v.ndim+1)))
topo = f.maker.fgraph.toposort()
#assert len(topo) == 1
#assert isinstance(topo[0].op, DimShuffe)
#self.assertRaises(ValueError, T.tile, m, (1,)*(m.ndim-1))
#f = theano.function([var], T.tile(m, (1,)*(m.ndim-1)))
#topo = f.maker.fgraph.toposort()
#assert len(topo) == 1
#assert isinstance(topo[0].op, compile.DeepCopyOp)
def speed_local_pow_specialize_range():
val = numpy.random.rand(1e7)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论