未验证 提交 6abe7dcb 编写于 作者: Z zyfncg 提交者: GitHub

support bool index for int tensor (#37761)

上级 b0d580a2
...@@ -674,14 +674,6 @@ def _setitem_impl_(var, item, value): ...@@ -674,14 +674,6 @@ def _setitem_impl_(var, item, value):
# the item is a tensor of bool # the item is a tensor of bool
def set_value_for_bool_tensor(var, item, value): def set_value_for_bool_tensor(var, item, value):
# TODO(zyfncg): Now scatter_nd_add only support float32 and float64 tensor,
# so in the current version we also only support float32 and float64 tensor,
# this problem will be fixed in the future.
if var.dtype != core.VarDesc.VarType.FP32 and var.dtype != core.VarDesc.VarType.FP64:
raise TypeError("Only support float and double tensor for bool index, "
"but received {}.".format(var.dtype))
if len(item.shape) > len(var.shape): if len(item.shape) > len(var.shape):
raise IndexError("The dims of bool index doesn't match indexed array, " raise IndexError("The dims of bool index doesn't match indexed array, "
"the dims of bool index except to be equal or less " "the dims of bool index except to be equal or less "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册