From 86775d40da216553a47edb3083a180bf64d5db31 Mon Sep 17 00:00:00 2001 From: Corleone Date: Sun, 26 Feb 2023 19:45:59 +0800 Subject: [PATCH] update max_unpool doc --- .../python/mindspore/nn/layer/pooling.py | 14 ++++---------- .../python/mindspore/ops/function/nn_func.py | 19 +++++++------------ .../python/mindspore/ops/operations/nn_ops.py | 18 ++++++------------ 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/mindspore/python/mindspore/nn/layer/pooling.py b/mindspore/python/mindspore/nn/layer/pooling.py index 3007a0f09d9..4ff2606957b 100644 --- a/mindspore/python/mindspore/nn/layer/pooling.py +++ b/mindspore/python/mindspore/nn/layer/pooling.py @@ -1470,12 +1470,9 @@ class MaxUnpool1d(Cell): class MaxUnpool2d(Cell): r""" - Computes a partial inverse of MaxPool2d. + Computes inverse of MaxPool2d. - MaxPool2d is not fully invertible, since the non-maximal values are lost. - - MaxUnpool2d takes in as input the output of MaxPool2d including the indices of the maximal values - and computes a partial inverse in which all non-maximal values are set to zero. Typically the input + MaxUnpool2d keeps the maximal value and set all position of non-maximal values to zero. Typically the input is of shape :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`, and the output is of shape :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})`. The operation is as follows. @@ -1560,12 +1557,9 @@ class MaxUnpool2d(Cell): class MaxUnpool3d(Cell): r""" - Computes a partial inverse of MaxPool3d. + Computes inverse of MaxPool3d. - MaxPool3d is not fully invertible, since the non-maximal values are lost. - - MaxUnpool3d takes in as input the output of MaxPool3d including the indices of the maximal - values and computes a partial inverse in which all non-maximal values are set to zero. + MaxUnpool3d keeps the maximal value and set all position of non-maximal values to zero. Typically the input is of shape :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`, and the output is of shape :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(C, D_{out}, H_{out}, W_{out})`. The operation is as follows. diff --git a/mindspore/python/mindspore/ops/function/nn_func.py b/mindspore/python/mindspore/ops/function/nn_func.py index 890eef32ce4..7987c904a1e 100644 --- a/mindspore/python/mindspore/ops/function/nn_func.py +++ b/mindspore/python/mindspore/ops/function/nn_func.py @@ -866,12 +866,9 @@ def max_unpool1d(x, indices, kernel_size, stride=None, padding=0, output_size=No def max_unpool2d(x, indices, kernel_size, stride=None, padding=0, output_size=None): r""" - Computes a partial inverse of maxpool2d. + Computes inverse of maxpool2d. - maxpool2d is not fully invertible, since the non-maximal values are lost. - - max_unpool2d takes the output of maxpool2d as inputs including the indices of the maximal values - and computes a partial inverse in which all non-maximal values are set to zero. Typically the input + max_unpool2d keeps the maximal value and set all position of non-maximal values to zero. Typically the input is of shape :math:`(N, C, H_{in}, W_{in})` or :math:`(C, H_{in}, W_{in})`, and the output is of shape :math:`(N, C, H_{out}, W_{out})` or :math:`(C, H_{out}, W_{out})`. The operation is as follows. @@ -973,14 +970,12 @@ def max_unpool2d(x, indices, kernel_size, stride=None, padding=0, output_size=No def max_unpool3d(x, indices, kernel_size, stride=None, padding=0, output_size=None): r""" - Computes a partial inverse of maxpool3d. + Computes inverse of maxpool3d. - maxpool3d is not fully invertible, since the non-maximal values are lost. - - max_unpool3d takes the output of maxpool3d as input including the indices of the maximal values and computes a - partial inverse in which all non-maximal values are set to zero. Typically the input is of shape - :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`, and the output is of shape - :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(C, D_{out}, H_{out}, W_{out})`. The operation is as follows. + max_unpool3d keeps the maximal value and set all position of non-maximal values to zero. + Typically the input is of shape :math:`(N, C, D_{in}, H_{in}, W_{in})` or :math:`(C, D_{in}, H_{in}, W_{in})`, + and the output is of shape :math:`(N, C, D_{out}, H_{out}, W_{out})` or :math:`(C, D_{out}, H_{out}, W_{out})`. + The operation is as follows. .. math:: \begin{array}{ll} \\ diff --git a/mindspore/python/mindspore/ops/operations/nn_ops.py b/mindspore/python/mindspore/ops/operations/nn_ops.py index 64c123ecdcf..0cd1a02df22 100644 --- a/mindspore/python/mindspore/ops/operations/nn_ops.py +++ b/mindspore/python/mindspore/ops/operations/nn_ops.py @@ -2001,14 +2001,11 @@ class MaxPool3D(Primitive): class MaxUnpool2D(Primitive): r""" - Computes a partial inverse of MaxPool2D. + Computes inverse of MaxPool2D. - MaxPool2D is not fully invertible, since the non-maximal values are lost. - - MaxUnpool2D takes in as input the output of MaxPool2D including the indices of - the maximal values and computes a partial inverse in which all non-maximal values - are set to zero. Typically the input is of shape :math:`(N, C, H_{in}, W_{in})` , - the output is of shape :math:`(N, C, H_{out}, W_{out})` , the operation is as follows: + MaxUnpool2D keeps the maximal value and set all position of non-maximal values to zero. + Typically the input is of shape :math:`(N, C, H_{in}, W_{in})` , the output is of + shape :math:`(N, C, H_{out}, W_{out})` , the operation is as follows: .. math:: \begin{array}{ll} \\ @@ -2104,12 +2101,9 @@ class MaxUnpool2D(Primitive): class MaxUnpool3D(Primitive): r""" - Computes a partial inverse of MaxUnpool3D. + Computes inverse of MaxUnpool3D. - MaxUnpool3D is not fully invertible, since the non-maximal values are lost. - - MaxUnpool3D takes in as input the output of MaxUnpool3D including the indices of the maximal - values and computes a partial inverse in which all non-maximal values are set to zero. + MaxUnpool3D keeps the maximal value and set all position of non-maximal values to zero. Typically the input is of shape :math:`(N, C, D_{in}, H_{in}, W_{in})`, the output is of shape :math:`(N, C, D_{out}, H_{out}, W_{out})`, the operation is as follows.