报错:使用scatterNdAdd 算子时的报错问题
收藏回复举报
报错:使用scatterNdAdd 算子时的报错问题
发表于2022-12-01 16:55:27
0 查看

1 系统环境

硬件环境(Ascend/GPU/CPU): CPU

MindSpore版本: 1.8

执行模式(动态图): 不限模式

Python版本: 3.7.5

操作系统平台: 不限

2 报错信息

2.1 问题描述

使用MindSpore-CPU1.8版本中的scatterNdAdd算子出现问题

2.2 报错信息

[ERROR] KERNEL(15937,7fad8d68a0c0,python3):2022-11-23-16:35:44.911.179 [mindspore/ccsrc/plugin/device/cpu/kernel/scatter_nd_arithmetic_cpu_kernel.cc:189] LaunchKernel] For 'ScatterNdAdd', the 3-th value of 'indices'[7] is out of range[4].

2.3 脚本代码

def test_scatterNdAdd():
context.set_context(mode=context.PYNATIVE_MODE, device_target='CPU')
input_x = Parameter(Tensor(np.array([[1, 2], [3, 4], [5, 6], [7, 8]]), mindspore.float32), name="x")
indices = Tensor(np.array([[2], [4], [1], [7]]), mindspore.int32)
updates = Tensor(np.array([[0, 1], [2, 3], [4, 5], [6, 7]]), mindspore.float32)
output = ops.scatter_nd_add(input_x, indices, updates, False)
print(output)

3 根因分析

******此处由用户补充详细的定位过程******

传入到Scatter_nd_add算子的参数不合规,超出算子规范。

4 解决方案

******此处由用户填写******

包含文字方案和最终脚本代码

代码格式,可上传附件

本帖最后由 匿名用户2023/01/13 14:41:16 编辑

我要发帖子