提交 49355880 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Enable long ints in reshape

上级 6bd93c9f
......@@ -6124,7 +6124,8 @@ def stack(*tensors):
# See ticket #660
if numpy.all([
# in case there is direct int in tensors.
isinstance(t, (numpy.number, float, int, python_complex)) or
isinstance(t, (numpy.number, float, int, python_complex,
long)) or
(isinstance(t, Variable) and
isinstance(t.type, TensorType) and
t.ndim == 0)
......
......@@ -5150,6 +5150,12 @@ class T_reshape(unittest.TestCase):
assert numpy.all(f_sub(a_val, b_val) == [2, 3])
def test_reshape_long_in_shape(self):
v = vector('v')
r = v.reshape((v.shape[0], 1L))
print r.eval({v: numpy.arange(5.)})
assert numpy.allclose(r.eval({v: numpy.arange(5.)}).T, numpy.arange(5.))
def test_bad_shape(self):
a = matrix('a')
shapes = ivector('shapes')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论