提交 a76f98b6 authored 作者: Sina Honari's avatar Sina Honari

improving comment of the error

上级 94d2c024
......@@ -1124,7 +1124,9 @@ Theano indexing with a "mask" (incorrect approach):
>>> t[t > 4].eval() # an array with shape (3, 3, 3) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
TypeError: TensorType does not support boolean mask for indexing such as tensor[x==0]. If you are indexing on purpose with an int8, please cast it to int32
TypeError: TensorType does not support boolean mask for indexing such as tensor[x==0].
Instead you can use non_zeros() such as tensor[(x == 0).nonzeros()].
If you are indexing on purpose with an int8, please cast it to int16.
Getting a Theano result like NumPy:
......
......@@ -474,8 +474,10 @@ class _tensor_py_operators(object):
args_el.dtype == 'int8' or args_el.dtype == 'uint8':
raise TypeError(('TensorType does not support boolean '
'mask for indexing such as tensor[x==0]. '
'Instead you can use non_zeros() such as '
'tensor[(x == 0).nonzeros()]. '
'If you are indexing on purpose with an '
'int8, please cast it to int32'))
'int8, please cast it to int16.'))
except AttributeError:
pass
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论