提交 5e4efff0 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Better error message if trying advanced indexing

上级 505317ba
...@@ -717,10 +717,16 @@ class GetItem2d(gof.op.Op): ...@@ -717,10 +717,16 @@ class GetItem2d(gof.op.Op):
"slice where stop=%s" % stop), "slice where stop=%s" % stop),
stop.ndim, stop.dtype) stop.ndim, stop.dtype)
else: elif ((isinstance(ind, gof.Variable) and
getattr(ind, 'ndim', -1) == 0)
or numpy.isscalar(ind)):
raise NotImplementedError( raise NotImplementedError(
'Theano has no sparse vector' + 'Theano has no sparse vector' +
'Use X[a:b,c:d], X[a:b,c:c+1] or X[a:b] instead.') 'Use X[a:b,c:d], X[a:b,c:c+1] or X[a:b] instead.')
else:
raise ValueError((
'Advanced indexing is not implemented for sparse '
'matrices. Argument not supported: %s' % ind))
input_op += [start, stop] input_op += [start, stop]
if len(index) == 1: if len(index) == 1:
input_op += [generic_None, generic_None] input_op += [generic_None, generic_None]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论