diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/tile_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/tile_cpu_kernel.cc index 1cf9d4835b..f3769ac05c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/tile_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/tile_cpu_kernel.cc @@ -85,7 +85,7 @@ void TileCPUKernel::LaunchKernel(const std::vector &inputs, const st std::vector cargo_x(d, 1); std::vector cargo_y = x_shape_; for (int i = d - 2; i >= 0; --i) { - cargo_x[i] = x_shape_[i + 1] * cargo_x[i]; + cargo_x[i] = x_shape_[i + 1] * cargo_x[i + 1]; cargo_y[i] *= cargo_y[i + 1] * multiples_[i + 1]; } size_t offset = 0; diff --git a/mindspore/ops/_grad/grad_array_ops.py b/mindspore/ops/_grad/grad_array_ops.py index 73afd6aff0..e48223ffea 100644 --- a/mindspore/ops/_grad/grad_array_ops.py +++ b/mindspore/ops/_grad/grad_array_ops.py @@ -380,10 +380,18 @@ def get_bprop_gather_v2(self): @bprop_getters.register(P.GatherD) def get_bprop_gather_d(self): + """Generate bprop for GatherD""" + gather_d = P.GatherD() def bprop(x, dim, index, out, dout): return P.GatherDGrad(dim)(index, dout) + def bprop_ascend(x, dim, index, out, dout): + return (gather_d(dout, dim, index), zeros_like(dim), zeros_like(index)) + + if context.get_context('device_target') == 'Ascend': + return bprop_ascend + return bprop diff --git a/mindspore/ops/operations/image_ops.py b/mindspore/ops/operations/image_ops.py index 14545dd11e..e57be1d6ac 100644 --- a/mindspore/ops/operations/image_ops.py +++ b/mindspore/ops/operations/image_ops.py @@ -44,9 +44,9 @@ class CropAndResize(PrimitiveWithInfer): mapped to [0, image_height - 1] in image height coordinates. We do allow y1 > y2, in which case the sampled crop is an up-down flipped version of the original image. The width dimension is treated similarly. Normalized coordinates outside the [0, 1] range are allowed, in which case we use extrapolation_value to - extrapolate the input image values. Types allowd: float32. + extrapolate the input image values. Types allowed: float32. - **box_index** (Tensor) - A 1-D tensor of shape [num_boxes] with int32 values in [0, batch). - The value of box_ind[i] specifies the image that the i-th box refers to. Types allowd: int32. + The value of box_ind[i] specifies the image that the i-th box refers to. Types allowed: int32. - **crop_size** (Tuple[int]) - A tuple of two int32 elements: (crop_height, crop_width). Only constant value is allowed. All cropped image patches are resized to this size. The aspect ratio of the image content is not preserved. Both crop_height and crop_width need to be positive.