Browse Source

!10420 [ME]SparseGatherV2 throw exception when grad with 1D tensor input

From: @chenfei52
Reviewed-by: @ginfung,@zh_qh
Signed-off-by: @zh_qh
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
f7eda1118c
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      mindspore/ops/_grad/grad_array_ops.py

+ 4
- 1
mindspore/ops/_grad/grad_array_ops.py View File

@@ -433,7 +433,10 @@ def get_bprop_sparse_gather_v2(self):
x_shp = shape_op(x)
if axis == 0:
indices_size = (size_op(indices),)
x_tail_shp = x_shp[1:]
if len(x_shp) <= 1:
x_tail_shp = ()
else:
x_tail_shp = x_shp[1:]
values_shape = indices_size + x_tail_shp
values = reshape(dout, values_shape)
indices_new = reshape(indices, indices_size)


Loading…
Cancel
Save