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

Merge pull request #1606 from lamblin/fix_py2.4

Fixes in conv3d2d for python 2.4
import theano import theano
from theano.compat import any
from theano.gradient import DisconnectedType from theano.gradient import DisconnectedType
from theano.gof import Op, Apply from theano.gof import Op, Apply
from theano import tensor from theano import tensor
...@@ -11,7 +12,10 @@ def get_diagonal_subtensor_view(x, i0, i1): ...@@ -11,7 +12,10 @@ def get_diagonal_subtensor_view(x, i0, i1):
:note: it return a partial view of x, not a partial copy. :note: it return a partial view of x, not a partial copy.
""" """
# We have to cast i0 and i0 to int because python 2.4 (and maybe later)
# do not support indexing with 0-dim, 'int*' ndarrays.
i0 = int(i0)
i1 = int(i1)
if x.shape[i0] < x.shape[i1]: if x.shape[i0] < x.shape[i1]:
raise NotImplementedError('is this allowed?') raise NotImplementedError('is this allowed?')
idx = [slice(None)] * x.ndim idx = [slice(None)] * x.ndim
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论