提交 55596d1b authored 作者: Benjamin Scellier's avatar Benjamin Scellier

various changes

上级 4840a1f6
...@@ -161,7 +161,6 @@ def do_setup(): ...@@ -161,7 +161,6 @@ def do_setup():
license=LICENSE, license=LICENSE,
platforms=PLATFORMS, platforms=PLATFORMS,
packages=find_packages(), packages=find_packages(),
# 1.7.0 give too much warning related to numpy.diagonal.
install_requires=['numpy>=1.9.1', 'scipy>=0.14', 'six>=1.9.0'], install_requires=['numpy>=1.9.1', 'scipy>=0.14', 'six>=1.9.0'],
# pygments is a dependency for Sphinx code highlight # pygments is a dependency for Sphinx code highlight
extras_require={ extras_require={
......
...@@ -557,14 +557,10 @@ def qr(a, mode="reduced"): ...@@ -557,14 +557,10 @@ def qr(a, mode="reduced"):
'raw' 'raw'
returns h, tau with dimensions (N, M), (K,) returns h, tau with dimensions (N, M), (K,)
The options 'reduced', 'complete', and 'raw' are new in numpy Note that array h returned in 'raw' mode is
1.8, see the notes for more information. The default is
'reduced' and to maintain backward compatibility with earlier
versions of numpy it can be
omitted. Note that array h returned in 'raw' mode is
transposed for calling Fortran. transposed for calling Fortran.
Default mode is 'reduced' which is also default for numpy 1.8 Default mode is 'reduced'
Returns Returns
------- -------
......
...@@ -6797,33 +6797,6 @@ class T_long_tensor(unittest.TestCase): ...@@ -6797,33 +6797,6 @@ class T_long_tensor(unittest.TestCase):
assert numpy.all(matrix_ct.value == val) assert numpy.all(matrix_ct.value == val)
def test_too_big(self): def test_too_big(self):
val = L(2 ** 63)
# NumPy 1.7 this will raise an exception
# NumPy 1.7.1 this will work
try:
cst = constant(val)
assert cst.value == val
assert cst.dtype == "uint64"
except OverflowError:
pass
try:
cst = constant([val, val])
assert cst.value[0] == val
assert cst.value[1] == val
assert cst.value.size == 2
assert cst.dtype == "uint64"
except TypeError:
pass
try:
cst = constant([[val, val]])
assert cst.value[0, 0] == val
assert cst.value[0, 1] == val
assert cst.value.size == 2
assert cst.dtype == "uint64"
except TypeError:
pass
val = L(2 ** 64) val = L(2 ** 64)
# This fail for all NumPy version. # This fail for all NumPy version.
self.assertRaises(Exception, constant, val) self.assertRaises(Exception, constant, val)
......
...@@ -3003,9 +3003,6 @@ class Test_alloc_zero(unittest.TestCase): ...@@ -3003,9 +3003,6 @@ class Test_alloc_zero(unittest.TestCase):
for n in f.maker.fgraph.toposort()]) for n in f.maker.fgraph.toposort()])
def test_advancedincsubtensor_allocs0(self): def test_advancedincsubtensor_allocs0(self):
if tensor.inplace_increment is None:
raise SkipTest('NumPy version >= 1.8 not available')
x = tensor.matrix() x = tensor.matrix()
y = tensor.matrix() y = tensor.matrix()
y0 = tensor.zeros_like(y) y0 = tensor.zeros_like(y)
...@@ -3015,9 +3012,6 @@ class Test_alloc_zero(unittest.TestCase): ...@@ -3015,9 +3012,6 @@ class Test_alloc_zero(unittest.TestCase):
for n in f.maker.fgraph.toposort()]) for n in f.maker.fgraph.toposort()])
def test_advancedincsubtensor_allocs0t(self): def test_advancedincsubtensor_allocs0t(self):
if tensor.inplace_increment is None:
raise SkipTest('NumPy version >= 1.8 not available')
x = tensor.matrix() x = tensor.matrix()
y = tensor.matrix() y = tensor.matrix()
y0 = tensor.zeros_like(y) y0 = tensor.zeros_like(y)
...@@ -3027,9 +3021,6 @@ class Test_alloc_zero(unittest.TestCase): ...@@ -3027,9 +3021,6 @@ class Test_alloc_zero(unittest.TestCase):
for n in f.maker.fgraph.toposort()]) for n in f.maker.fgraph.toposort()])
def test_advancedincsubtensor_allocs1(self): def test_advancedincsubtensor_allocs1(self):
if tensor.inplace_increment is None:
raise SkipTest('NumPy version >= 1.8 not available')
x = tensor.matrix() x = tensor.matrix()
y0 = tensor.constant(numpy.asarray(numpy.zeros_like((2, 2)), y0 = tensor.constant(numpy.asarray(numpy.zeros_like((2, 2)),
dtype=config.floatX)) dtype=config.floatX))
...@@ -3856,9 +3847,6 @@ class Test_local_useless_inc_subtensor_alloc(unittest.TestCase): ...@@ -3856,9 +3847,6 @@ class Test_local_useless_inc_subtensor_alloc(unittest.TestCase):
self.mode = compile.mode.get_mode(mode) self.mode = compile.mode.get_mode(mode)
def test_advanced_inc_subtensor(self): def test_advanced_inc_subtensor(self):
if tensor.inplace_increment is None:
raise SkipTest('NumPy version >= 1.8 not available')
x = tensor.vector('x') x = tensor.vector('x')
y = tensor.scalar('y') y = tensor.scalar('y')
i = tensor.matrix('i', dtype='int64') i = tensor.matrix('i', dtype='int64')
...@@ -3889,9 +3877,6 @@ class Test_local_useless_inc_subtensor_alloc(unittest.TestCase): ...@@ -3889,9 +3877,6 @@ class Test_local_useless_inc_subtensor_alloc(unittest.TestCase):
self.assertTrue(check_stack_trace(f2, ops_to_check=tensor.AdvancedIncSubtensor)) self.assertTrue(check_stack_trace(f2, ops_to_check=tensor.AdvancedIncSubtensor))
def test_advanced_inc_subtensor1(self): def test_advanced_inc_subtensor1(self):
if tensor.inplace_increment is None:
raise SkipTest('NumPy version >= 1.8 not available')
x = tensor.vector('x') x = tensor.vector('x')
y = tensor.scalar('y') y = tensor.scalar('y')
i = tensor.vector('i', dtype='int64') i = tensor.vector('i', dtype='int64')
......
...@@ -22,9 +22,7 @@ def hash_from_ndarray(data): ...@@ -22,9 +22,7 @@ def hash_from_ndarray(data):
# python hash are not strong, so I always use md5 in order not to have a # python hash are not strong, so I always use md5 in order not to have a
# too long hash, I call it again on the concatenation of all parts. # too long hash, I call it again on the concatenation of all parts.
if not data.flags["C_CONTIGUOUS"]: if not data.flags["C_CONTIGUOUS"]:
# Version 1.7.1 and previous of NumPy allowed calling # hash_from_code needs a C-contiguous array.
# hash_from_code on an F-contiguous array, but more recent
# versions need a C-contiguous one.
data = numpy.ascontiguousarray(data) data = numpy.ascontiguousarray(data)
return hash_from_code(hash_from_code(data) + return hash_from_code(hash_from_code(data) +
hash_from_code(str(data.shape)) + hash_from_code(str(data.shape)) +
......
...@@ -88,16 +88,7 @@ class _tensor_py_operators(object): ...@@ -88,16 +88,7 @@ class _tensor_py_operators(object):
return True return True
else: else:
raise TypeError( raise TypeError(
"Variables do not support boolean operations. This " "Variables do not support boolean operations."
"can happen if you do a logical operation (<, <=, >, <=, "
"==, !=) between a numpy.ndarray and a Theano tensor"
"variable. Due to NumPy implementation before NumPy 1.8, "
"we cannot make the Python syntax work when the ndarray "
"is on the left, and this results in this error. To work "
"around that, either call "
"theano.tensor.{lt,le,eq,ne,gt,ge}(ndarray, tensor), or "
"use the Python syntax with the Theano tensor on the "
"left. Or update to NumPy 1.8 or above."
) )
# BITWISE # BITWISE
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论