提交 259fb3c2 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

In RepeatOp, fix detection of numpy-supported dtypes

上级 83b2068b
...@@ -246,17 +246,17 @@ class RepeatOp(theano.Op): ...@@ -246,17 +246,17 @@ class RepeatOp(theano.Op):
# Some dtypes are not supported by numpy's implementation of repeat. # Some dtypes are not supported by numpy's implementation of repeat.
# Until another one is available, we should fail at graph construction # Until another one is available, we should fail at graph construction
# time, not wait for execution. # time, not wait for execution.
int_bitwidth = theano.gof.python_int_bitwidth() ptr_bitwidth = theano.gof.local_bitwidth()
if int_bitwidth == 64: if ptr_bitwidth == 64:
numpy_unsupported_dtypes = ('uint64',) numpy_unsupported_dtypes = ('uint64',)
if int_bitwidth == 32: if ptr_bitwidth == 32:
numpy_unsupported_dtypes = ('uint32', 'int64', 'uint64') numpy_unsupported_dtypes = ('uint32', 'int64', 'uint64')
if repeats.dtype in numpy_unsupported_dtypes: if repeats.dtype in numpy_unsupported_dtypes:
raise TypeError( raise TypeError(
("dtypes %s are not supported by numpy.repeat " ("dtypes %s are not supported by numpy.repeat "
"for the 'repeats' parameter, " "for the 'repeats' parameter, "
% numpy_unsupported_dtypes), repeats.dtype) % str(numpy_unsupported_dtypes)), repeats.dtype)
if self.axis is None: if self.axis is None:
broadcastable = [False] broadcastable = [False]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论