提交 e1da0cf0 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1623 from nouiz/py33

Fix numpy.memmap TensorConstant tests in python 3.3
差异被折叠。
差异被折叠。
...@@ -193,10 +193,10 @@ Here is the state of that vision as of October 1st, 2012 (after Theano release ...@@ -193,10 +193,10 @@ Here is the state of that vision as of October 1st, 2012 (after Theano release
* The cvm linker allows lazy evaluation. It is the current default linker. * The cvm linker allows lazy evaluation. It is the current default linker.
* How to have `DebugMode` check it? Right now, DebugMode checks the computation non-lazily. * How to have `DebugMode` check it? Right now, DebugMode checks the computation non-lazily.
* The profiler used by cvm is less complete than `ProfileMode`.
* SIMD parallelism on the CPU comes from the compiler. * SIMD parallelism on the CPU comes from the compiler.
* Multi-core parallelism is only supported by Conv2d. If the external BLAS implementation supports it, * Multi-core parallelism is only supported by Conv2d(not by default).
If the external BLAS implementation supports it,
there are also, gemm, gemv and ger that are parallelized. there are also, gemm, gemv and ger that are parallelized.
* No multi-node support. * No multi-node support.
* Many, but not all NumPy functions/aliases are implemented. * Many, but not all NumPy functions/aliases are implemented.
......
...@@ -605,6 +605,10 @@ class TensorConstantSignature(tuple): ...@@ -605,6 +605,10 @@ class TensorConstantSignature(tuple):
return self._sum return self._sum
except AttributeError: except AttributeError:
self._sum = self.no_nan.sum() self._sum = self.no_nan.sum()
# The following 2 lines are needede as in Python 3.3 with NumPy
# 1.7.1, numpy.ndarray and numpy.memmap aren't hashable.
if type(self._sum) is numpy.memmap:
self._sum = numpy.asarray(self._sum).sum()
if self.has_nan and self.no_nan.mask.all(): if self.has_nan and self.no_nan.mask.all():
# In this case the sum is not properly computed by numpy. # In this case the sum is not properly computed by numpy.
self._sum = 0 self._sum = 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论