提交 607c8ba6 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #1636 from nouiz/scipy_0.13

Scipy 0.13 (needed for the release)
......@@ -2246,6 +2246,10 @@ class HStack(gof.op.Op):
assert _is_sparse(b)
out[0] = scipy.sparse.hstack(block, format=self.format,
dtype=self.dtype)
# Some version of scipy (at least 0.14.0.dev-c4314b0)
# Do not cast to the wanted dtype.
if out[0].dtype != self.dtype:
out[0] = out[0].astype(self.dtype)
def grad(self, inputs, (gz, )):
is_continuous = [(inputs[i].dtype in tensor.continuous_dtypes)
......@@ -2321,6 +2325,10 @@ class VStack(HStack):
assert _is_sparse(b)
out[0] = scipy.sparse.vstack(block, format=self.format,
dtype=self.dtype)
# Some version of scipy (at least 0.14.0.dev-c4314b0)
# Do not cast to the wanted dtype.
if out[0].dtype != self.dtype:
out[0] = out[0].astype(self.dtype)
def grad(self, inputs, (gz, )):
is_continuous = [(inputs[i].dtype in tensor.continuous_dtypes)
......
......@@ -69,14 +69,16 @@ def random_lil(shape, dtype, nnz):
huge = 2 ** 30
for k in range(nnz):
# set non-zeros in random locations (row x, col y)
idx = numpy.random.random_integers(huge, size=len(shape)) % shape
idx = numpy.random.random_integers(huge, size=2) % shape
value = numpy.random.rand()
#if dtype *int*, value will always be zeros!
if "int" in dtype:
value = int(value * 100)
# The call to tuple is needed as scipy 0.13.1 do not support
# ndarray with lenght 2 as idx tuple.
rval.__setitem__(
idx,
value)
tuple(idx),
value)
return rval
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论