From: @wuxuejian
Reviewed-by: @liangchenghui,@c_34
Signed-off-by: @liangchenghui
pull/8374/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 0dedcceefa

@ -85,7 +85,7 @@ void TileCPUKernel::LaunchKernel(const std::vector<AddressPtr> &inputs, const st
std::vector<size_t> cargo_x(d, 1); std::vector<size_t> cargo_x(d, 1);
std::vector<size_t> cargo_y = x_shape_; std::vector<size_t> cargo_y = x_shape_;
for (int i = d - 2; i >= 0; --i) { 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]; cargo_y[i] *= cargo_y[i + 1] * multiples_[i + 1];
} }
size_t offset = 0; size_t offset = 0;

@ -380,10 +380,18 @@ def get_bprop_gather_v2(self):
@bprop_getters.register(P.GatherD) @bprop_getters.register(P.GatherD)
def get_bprop_gather_d(self): def get_bprop_gather_d(self):
"""Generate bprop for GatherD"""
gather_d = P.GatherD()
def bprop(x, dim, index, out, dout): def bprop(x, dim, index, out, dout):
return P.GatherDGrad(dim)(index, 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 return bprop

@ -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 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. 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 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). - **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). - **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. 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. The aspect ratio of the image content is not preserved. Both crop_height and crop_width need to be positive.

Loading…
Cancel
Save