提交 1e279256 authored 作者: Pascal Lamblin's avatar Pascal Lamblin 提交者: GitHub

Merge pull request #5105 from nouiz/32bit

32bit
...@@ -535,14 +535,24 @@ class KeyData(object): ...@@ -535,14 +535,24 @@ class KeyData(object):
""" """
entry = self.get_entry() entry = self.get_entry()
for key in self.keys: for key in self.keys:
try:
del entry_from_key[key] del entry_from_key[key]
except KeyError:
# This happen if the compiledir was deleted during
# this process execution.
pass
if do_manual_check: if do_manual_check:
to_del = [] to_del = []
for key, key_entry in iteritems(entry_from_key): for key, key_entry in iteritems(entry_from_key):
if key_entry == entry: if key_entry == entry:
to_del.append(key) to_del.append(key)
for key in to_del: for key in to_del:
try:
del entry_from_key[key] del entry_from_key[key]
except KeyError:
# This happen if the compiledir was deleted during
# this process execution.
pass
class ModuleCache(object): class ModuleCache(object):
......
...@@ -1336,7 +1336,11 @@ class ShapeFeature(object): ...@@ -1336,7 +1336,11 @@ class ShapeFeature(object):
assert d.dtype in theano.tensor.discrete_dtypes, (node, d.dtype) assert d.dtype in theano.tensor.discrete_dtypes, (node, d.dtype)
assert str(d.dtype) != 'uint64', node assert str(d.dtype) != 'uint64', node
new_shape += sh[len(new_shape):i + 1] new_shape += sh[len(new_shape):i + 1]
new_shape[i] = theano.tensor.cast(d, 'int64') if isinstance(d, T.Constant):
casted_d = T.constant(d.data, dtype='int64')
else:
casted_d = theano.tensor.cast(d, 'int64')
new_shape[i] = casted_d
if new_shape: if new_shape:
# We replace the shape with wrong dtype by the one with # We replace the shape with wrong dtype by the one with
# 'int64'. # 'int64'.
......
...@@ -560,9 +560,9 @@ class Pool(OpenMPOp): ...@@ -560,9 +560,9 @@ class Pool(OpenMPOp):
// index for iterating over the pooling regions // index for iterating over the pooling regions
int r_idx[%(nd)s]; int r_idx[%(nd)s];
// placeholder for PyArray indexing (output) // placeholder for PyArray indexing (output)
long int o_idx[%(total_ndim)s]; npy_intp o_idx[%(total_ndim)s];
// placeholder for PyArray indexing (input) // placeholder for PyArray indexing (input)
long int i_idx[%(total_ndim)s]; npy_intp i_idx[%(total_ndim)s];
// loop over non-pooling dimensions // loop over non-pooling dimensions
int non_pooling_prod = 1; int non_pooling_prod = 1;
for (int i=0; i<%(non_pool_ndim)s; i++) for (int i=0; i<%(non_pool_ndim)s; i++)
...@@ -1040,9 +1040,9 @@ class MaxPoolGrad(PoolGrad): ...@@ -1040,9 +1040,9 @@ class MaxPoolGrad(PoolGrad):
// index for iterating over the pooling regions // index for iterating over the pooling regions
int r_idx[%(nd)s]; int r_idx[%(nd)s];
// placeholder for PyArray indexing (output) // placeholder for PyArray indexing (output)
long int o_idx[%(total_ndim)s]; npy_intp o_idx[%(total_ndim)s];
// placeholder for PyArray indexing (input) // placeholder for PyArray indexing (input)
long int i_idx[%(total_ndim)s]; npy_intp i_idx[%(total_ndim)s];
// loop over non-pooling dimensions // loop over non-pooling dimensions
int non_pooling_prod = 1; int non_pooling_prod = 1;
for (int i=0; i<%(non_pool_ndim)s; i++) for (int i=0; i<%(non_pool_ndim)s; i++)
...@@ -1367,9 +1367,9 @@ class AveragePoolGrad(PoolGrad): ...@@ -1367,9 +1367,9 @@ class AveragePoolGrad(PoolGrad):
// index for iterating over the pooling regions // index for iterating over the pooling regions
int r_idx[%(nd)s]; int r_idx[%(nd)s];
// placeholder for PyArray indexing (output) // placeholder for PyArray indexing (output)
long int o_idx[%(total_ndim)s]; npy_intp o_idx[%(total_ndim)s];
// placeholder for PyArray indexing (input) // placeholder for PyArray indexing (input)
long int i_idx[%(total_ndim)s]; npy_intp i_idx[%(total_ndim)s];
// loop over non-pooling dimensions // loop over non-pooling dimensions
int non_pooling_prod = 1; int non_pooling_prod = 1;
for (int i=0; i<%(non_pool_ndim)s; i++) for (int i=0; i<%(non_pool_ndim)s; i++)
...@@ -1671,9 +1671,9 @@ class DownsampleFactorMaxGradGrad(OpenMPOp): ...@@ -1671,9 +1671,9 @@ class DownsampleFactorMaxGradGrad(OpenMPOp):
// index for iterating over the pooling regions // index for iterating over the pooling regions
int r_idx[%(nd)s]; int r_idx[%(nd)s];
// placeholder for PyArray indexing (output) // placeholder for PyArray indexing (output)
long int o_idx[%(total_ndim)s]; npy_intp o_idx[%(total_ndim)s];
// placeholder for PyArray indexing (input) // placeholder for PyArray indexing (input)
long int i_idx[%(total_ndim)s]; npy_intp i_idx[%(total_ndim)s];
// loop over non-pooling dimensions // loop over non-pooling dimensions
int non_pooling_prod; int non_pooling_prod;
non_pooling_prod = 1; non_pooling_prod = 1;
......
...@@ -511,18 +511,18 @@ class TensorType(Type): ...@@ -511,18 +511,18 @@ class TensorType(Type):
(long int) %(type_num)s, (long int) %(type_num)s,
(long int) PyArray_TYPE((PyArrayObject*) py_%(name)s), (long int) PyArray_TYPE((PyArrayObject*) py_%(name)s),
(long int) PyArray_NDIM(tmp), (long int) PyArray_NDIM(tmp),
(long int) PyArray_NDIM(tmp) >= 3 ? (long int) (PyArray_NDIM(tmp) >= 3 ?
PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1, PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1),
(long int) PyArray_NDIM(tmp) >= 2 ? (long int) (PyArray_NDIM(tmp) >= 2 ?
PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1, PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1),
(long int) PyArray_NDIM(tmp) >= 1 ? (long int) (PyArray_NDIM(tmp) >= 1 ?
PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1, PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1),
(long int) PyArray_NDIM(tmp) >= 3 ? (long int) (PyArray_NDIM(tmp) >= 3 ?
PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1, PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1),
(long int) PyArray_NDIM(tmp) >= 2 ? (long int) (PyArray_NDIM(tmp) >= 2 ?
PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1, PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1),
(long int) PyArray_NDIM(tmp) >= 1 ? (long int) (PyArray_NDIM(tmp) >= 1 ?
PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1 PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1)
); );
%(fail)s %(fail)s
} }
...@@ -580,18 +580,18 @@ class TensorType(Type): ...@@ -580,18 +580,18 @@ class TensorType(Type):
" and 3 last strides %%ld %%ld, %%ld.", " and 3 last strides %%ld %%ld, %%ld.",
(long int) PyArray_TYPE((PyArrayObject*) py_%(name)s), (long int) PyArray_TYPE((PyArrayObject*) py_%(name)s),
(long int) PyArray_NDIM(%(name)s), (long int) PyArray_NDIM(%(name)s),
(long int) PyArray_NDIM(%(name)s) >= 3 ? (long int) (PyArray_NDIM(%(name)s) >= 3 ?
PyArray_DIMS(%(name)s)[PyArray_NDIM(%(name)s)-3] : -1, PyArray_DIMS(%(name)s)[PyArray_NDIM(%(name)s)-3] : -1),
(long int) PyArray_NDIM(%(name)s) >= 2 ? (long int) (PyArray_NDIM(%(name)s) >= 2 ?
PyArray_DIMS(%(name)s)[PyArray_NDIM(%(name)s)-2] : -1, PyArray_DIMS(%(name)s)[PyArray_NDIM(%(name)s)-2] : -1),
(long int) PyArray_NDIM(%(name)s) >= 1 ? (long int) (PyArray_NDIM(%(name)s) >= 1 ?
PyArray_DIMS(%(name)s)[PyArray_NDIM(%(name)s)-1] : -1, PyArray_DIMS(%(name)s)[PyArray_NDIM(%(name)s)-1] : -1),
(long int) PyArray_NDIM(%(name)s) >= 3 ? (long int) (PyArray_NDIM(%(name)s) >= 3 ?
PyArray_STRIDES(%(name)s)[PyArray_NDIM(%(name)s)-3] : -1, PyArray_STRIDES(%(name)s)[PyArray_NDIM(%(name)s)-3] : -1),
(long int) PyArray_NDIM(%(name)s) >= 2 ? (long int) (PyArray_NDIM(%(name)s) >= 2 ?
PyArray_STRIDES(%(name)s)[PyArray_NDIM(%(name)s)-2] : -1, PyArray_STRIDES(%(name)s)[PyArray_NDIM(%(name)s)-2] : -1),
(long int) PyArray_NDIM(%(name)s) >= 1 ? (long int) (PyArray_NDIM(%(name)s) >= 1 ?
PyArray_STRIDES(%(name)s)[PyArray_NDIM(%(name)s)-1] : -1 PyArray_STRIDES(%(name)s)[PyArray_NDIM(%(name)s)-1] : -1)
); );
%(fail)s %(fail)s
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论