mindspore.ops.index_add ======================= .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/br_base/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/br_base/docs/api/api_python/ops/mindspore.ops.func_index_add.rst :alt: 查看源文件 .. py:function:: mindspore.ops.index_add(x, indices, y, axis, use_lock=True, check_index_bound=True) 按照指定轴和索引将输入 `y` 的元素加到输入 `x` 中。 .. note:: - `indices` 为一维tensor,并且 :math:`indices.shape[0] = y.shape[axis]` 。 - `indices` 中元素的取值范围为 :math:`[0, x.shape[axis] - 1]` 。 参数: - **x** (Union[Parameter, Tensor]) - 输入的parameter或tensor。 - **indices** (Tensor) - 指定索引。 - **y** (Tensor) - 与 `x` 相加的tensor。 - **axis** (int) - 指定轴。 - **use_lock** (bool,可选) - 是否对参数更新过程加锁保护。默认 ``True`` 。 - **check_index_bound** (bool,可选) - 是否检查 `indices` 边界。默认 ``True`` 。 返回: Tensor