From c0229fa951b1ac537fd2e83eb3d539f3911198e6 Mon Sep 17 00:00:00 2001 From: chenzomi <chenzomi12@gmail.com> Date: Tue, 21 Apr 2020 15:27:29 +0800 Subject: [PATCH] change hswish and hsigmoid accroding to primitive --- mindspore/_akg/gpu/__init__.py | 8 ++++---- mindspore/_akg/gpu/hsigmoid.py | 8 ++++---- mindspore/_akg/gpu/hsigmoid_grad.py | 8 ++++---- mindspore/_akg/gpu/hswish.py | 8 ++++---- mindspore/_akg/gpu/hswish_grad.py | 10 +++++----- .../predict/converter/lite_model/op_attr_packer.cc | 4 ++-- mindspore/nn/layer/activation.py | 2 +- mindspore/ops/_op_impl/akg/gpu/__init__.py | 4 ++++ mindspore/ops/operations/nn_ops.py | 2 +- 9 files changed, 29 insertions(+), 25 deletions(-) diff --git a/mindspore/_akg/gpu/__init__.py b/mindspore/_akg/gpu/__init__.py index 2ac6d1adb..08961d398 100644 --- a/mindspore/_akg/gpu/__init__.py +++ b/mindspore/_akg/gpu/__init__.py @@ -26,7 +26,7 @@ from .squeeze_grad import SqueezeGrad, gpu_schedule_SqueezeGrad from .mean import SimpleMean, gpu_schedule_SimpleMean from .mean_grad import SimpleMeanGrad, gpu_schedule_SimpleMeanGrad from .mul import Mul, gpu_schedule_Mul -from .hsigmoid import Hsigmoid, gpu_schedule_Hsigmoid -from .hsigmoid_grad import HsigmoidGrad, gpu_schedule_HsigmoidGrad -from .hswish import Hswish, gpu_schedule_Hswish -from .hswish_grad import HswishGrad, gpu_schedule_HswishGrad +from .hsigmoid import HSigmoid, gpu_schedule_HSigmoid +from .hsigmoid_grad import HSigmoidGrad, gpu_schedule_HSigmoidGrad +from .hswish import HSwish, gpu_schedule_HSwish +from .hswish_grad import HSwishGrad, gpu_schedule_HSwishGrad diff --git a/mindspore/_akg/gpu/hsigmoid.py b/mindspore/_akg/gpu/hsigmoid.py index b9d5ea74c..b313c2fd5 100644 --- a/mindspore/_akg/gpu/hsigmoid.py +++ b/mindspore/_akg/gpu/hsigmoid.py @@ -33,9 +33,9 @@ def topi_nn_hsigmoid(x): (x(*i) + 3) / 6))) -def Hsigmoid(x): +def HSigmoid(x): """ - Hsigmoid + HSigmoid Args: x: @@ -45,9 +45,9 @@ def Hsigmoid(x): return topi_nn_hsigmoid(x) -def gpu_schedule_Hsigmoid(outs): +def gpu_schedule_HSigmoid(outs): """ - gpu schedule Hsigmoid + gpu schedule HSigmoid Args: outs: diff --git a/mindspore/_akg/gpu/hsigmoid_grad.py b/mindspore/_akg/gpu/hsigmoid_grad.py index d3e7ac634..bdde4ed3c 100644 --- a/mindspore/_akg/gpu/hsigmoid_grad.py +++ b/mindspore/_akg/gpu/hsigmoid_grad.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Hsigmoid grad""" +"""HSigmoid grad""" import _akg.topi as topi import _akg.tvm as tvm -def HsigmoidGrad(y_grad, x): +def HSigmoidGrad(y_grad, x): """ - HsigmoidGrad + HSigmoidGrad Args: y_grad: x: @@ -32,7 +32,7 @@ def HsigmoidGrad(y_grad, x): y_grad(*i) / 6))) -def gpu_schedule_HsigmoidGrad(outs): +def gpu_schedule_HSigmoidGrad(outs): """ gpu schedule ReLU6Grad Args: diff --git a/mindspore/_akg/gpu/hswish.py b/mindspore/_akg/gpu/hswish.py index 904c38c2a..44fcf1091 100644 --- a/mindspore/_akg/gpu/hswish.py +++ b/mindspore/_akg/gpu/hswish.py @@ -33,9 +33,9 @@ def topi_nn_hswish(x): x(*i) * (x(*i) + 3) / 6))) -def Hswish(x): +def HSwish(x): """ - Hswish + HSwish Args: x: @@ -45,9 +45,9 @@ def Hswish(x): return topi_nn_hswish(x) -def gpu_schedule_Hswish(outs): +def gpu_schedule_HSwish(outs): """ - gpu schedule Hswish + gpu schedule HSwish Args: outs: diff --git a/mindspore/_akg/gpu/hswish_grad.py b/mindspore/_akg/gpu/hswish_grad.py index 5b38f07c8..cadbf0f66 100644 --- a/mindspore/_akg/gpu/hswish_grad.py +++ b/mindspore/_akg/gpu/hswish_grad.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""HswishGrad""" +"""HSwishGrad""" import _akg.topi as topi import _akg.tvm as tvm -def HswishGrad(y_grad, x): +def HSwishGrad(y_grad, x): """ - HswishGrad + HSwishGrad Args: y_grad: x: @@ -34,9 +34,9 @@ def HswishGrad(y_grad, x): return res6 -def gpu_schedule_HswishGrad(outs): +def gpu_schedule_HSwishGrad(outs): """ - gpu schedule HswishGrad + gpu schedule HSwishGrad Args: outs: diff --git a/mindspore/ccsrc/predict/converter/lite_model/op_attr_packer.cc b/mindspore/ccsrc/predict/converter/lite_model/op_attr_packer.cc index f186758de..e6fec3d54 100644 --- a/mindspore/ccsrc/predict/converter/lite_model/op_attr_packer.cc +++ b/mindspore/ccsrc/predict/converter/lite_model/op_attr_packer.cc @@ -48,8 +48,8 @@ OpAttrFactory::OpAttrFactory() { {"Softsign", ActivationPacker}, {"Softplus", ActivationPacker}, {"Tanh", ActivationPacker}, - {"Hswish", ActivationPacker}, - {"Hsigmoid", ActivationPacker}, + {"HSwish", ActivationPacker}, + {"HSigmoid", ActivationPacker}, {"MaxPool", PoolingPacker}, {"MaxPool2D", PoolingPacker}, {"MeanPool", PoolingPacker}, diff --git a/mindspore/nn/layer/activation.py b/mindspore/nn/layer/activation.py index 6485e2722..8845247a6 100644 --- a/mindspore/nn/layer/activation.py +++ b/mindspore/nn/layer/activation.py @@ -346,7 +346,7 @@ class HSwish(Cell): where :math:`x_{i}` is the :math:`i`-th slice along the given dim of the input Tensor. Inputs: - - **input_data** (Tensor) - The input of Hswish. + - **input_data** (Tensor) - The input of HSwish. Outputs: Tensor, with the same type and shape as the `input_data`. diff --git a/mindspore/ops/_op_impl/akg/gpu/__init__.py b/mindspore/ops/_op_impl/akg/gpu/__init__.py index 2135794b5..8ffc796ae 100644 --- a/mindspore/ops/_op_impl/akg/gpu/__init__.py +++ b/mindspore/ops/_op_impl/akg/gpu/__init__.py @@ -23,3 +23,7 @@ from .relu6_grad import _relu6_grad_akg from .squeeze import _squeeze_akg from .squeeze_grad import _squeeze_grad_akg from .tile import _tile_akg +from .hsigmoid import _hsigmoid_akg +from .hsigmoid_grad import _hsigmoid_grad_akg +from .hswish import _hswish_akg +from .hswish_grad import _hswish_grad_akg diff --git a/mindspore/ops/operations/nn_ops.py b/mindspore/ops/operations/nn_ops.py index 1fb65e3b7..bc88316ee 100644 --- a/mindspore/ops/operations/nn_ops.py +++ b/mindspore/ops/operations/nn_ops.py @@ -258,7 +258,7 @@ class HSwish(PrimitiveWithInfer): where :math:`x_{i}` is the :math:`i`-th slice along the given dim of the input Tensor. Inputs: - - **input_data** (Tensor) - The input of Hswish. + - **input_data** (Tensor) - The input of HSwish. Outputs: Tensor, with the same type and shape as the `input_data`. -- GitLab