From 52d2d204e3b969a583759899bcb8508838e8163d Mon Sep 17 00:00:00 2001 From: zhaozhenlong Date: Fri, 8 May 2020 16:34:21 +0800 Subject: [PATCH] Conv2DBackpropInput bprop return 3 items ImageGradients make compile check before others --- mindspore/nn/layer/image.py | 3 ++- mindspore/ops/_grad/grad_nn_ops.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mindspore/nn/layer/image.py b/mindspore/nn/layer/image.py index f06c5fd30ae..7448d5fd492 100644 --- a/mindspore/nn/layer/image.py +++ b/mindspore/nn/layer/image.py @@ -58,7 +58,8 @@ class ImageGradients(Cell): super(ImageGradients, self).__init__() def construct(self, images): - _check_input_4d(F.shape(images), "images", self.cls_name) + check = _check_input_4d(F.shape(images), "images", self.cls_name) + images = F.depend(images, check) batch_size, depth, height, width = P.Shape()(images) dy = images[:, :, 1:, :] - images[:, :, :height - 1, :] dy_last = P.Fill()(P.DType()(images), (batch_size, depth, 1, width), 0) diff --git a/mindspore/ops/_grad/grad_nn_ops.py b/mindspore/ops/_grad/grad_nn_ops.py index 362bda73686..9bf0c208981 100755 --- a/mindspore/ops/_grad/grad_nn_ops.py +++ b/mindspore/ops/_grad/grad_nn_ops.py @@ -627,7 +627,7 @@ def get_bprop_conv2d_backprop_input(self): def bprop(x, w, f_sizes, out, dout): dx = input_grad(dout, w) dw = filter_grad(x, dout, F.shape(w)) - return dx, dw + return dx, dw, zeros_like(f_sizes) return bprop