From 94736fb5acef0b18d2161a2f90dbb1ad932b8455 Mon Sep 17 00:00:00 2001 From: liangchenghui Date: Tue, 10 Nov 2020 19:46:44 +0800 Subject: [PATCH] Suit avgpoolgrad operator with latest Atlas package --- mindspore/nn/loss/loss.py | 2 +- mindspore/ops/_grad/grad_nn_ops.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/mindspore/nn/loss/loss.py b/mindspore/nn/loss/loss.py index f7e04ddf90..63cd5c1530 100644 --- a/mindspore/nn/loss/loss.py +++ b/mindspore/nn/loss/loss.py @@ -208,7 +208,7 @@ class SoftmaxCrossEntropyWithLogits(_Loss): .. math:: \ell(x_i, t_i) = - \log\left(\frac{\exp(x_{t_i})}{\sum_j \exp(x_j)}\right) - = -x_{t_i} + \log\left(\sum_j \exp(x_i)\right), + = -x_{t_i} + \log\left(\sum_j \exp(x_j)\right), where :math:`x_i` is a 1D score Tensor, :math:`t_i` is a scalar. Note: diff --git a/mindspore/ops/_grad/grad_nn_ops.py b/mindspore/ops/_grad/grad_nn_ops.py index 01386b2a6e..2d3eb41124 100755 --- a/mindspore/ops/_grad/grad_nn_ops.py +++ b/mindspore/ops/_grad/grad_nn_ops.py @@ -269,8 +269,6 @@ def _get_mean_matrix(x_shape, ksize, stride, padding, x_dtype): n_input, c_input, h_input, w_input = x_shape h_ksize, w_ksize = ksize[2], ksize[3] - if h_ksize == h_input and w_ksize == w_input and padding == "VALID": - return None h_stride, w_stride = stride[2], stride[3] n_output = n_input c_output = c_input @@ -308,10 +306,6 @@ def _get_mean_matrix(x_shape, ksize, stride, padding, x_dtype): @constexpr def _get_kernel_matrix(x_shape_nchw, kernel_matrix_shape, padding, x_dtype): - if x_shape_nchw[2] == kernel_matrix_shape[2] \ - and x_shape_nchw[3] == kernel_matrix_shape[3] \ - and padding == 'VALID': - return None kernel_matrix = np.ones(kernel_matrix_shape) return Tensor(kernel_matrix, x_dtype)