!43033 python clean code

Merge pull request !43033 from chujinjin/fix_python_clean_code
This commit is contained in:
i-robot 2022-09-28 09:02:55 +00:00 committed by Gitee
commit 6e7f2aa32a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 9 additions and 8 deletions

View File

@ -15,13 +15,13 @@
"""Define the grad rules of clip operations."""
from .grad_base import bprop_getters
from .. import operations as P
from ..operations import _inner_ops as inner
from ..operations import _grad_ops as G
from ...common import dtype as mstype
from .._grad.grad_math_ops import _sum_grad
from .._grad.grad_math_ops import binop_grad_common
from mindspore.ops._grad.grad_base import bprop_getters
from mindspore.ops import operations as P
from mindspore.ops.operations import _inner_ops as inner
from mindspore.ops.operations import _grad_ops as G
import mindspore.common.dtype as mstype
from mindspore.ops._grad.grad_math_ops import _sum_grad
from mindspore.ops._grad.grad_math_ops import binop_grad_common
@bprop_getters.register(inner.ClipByNorm)

View File

@ -410,7 +410,7 @@ class GradOperation(GradOperation_):
""" Pynative forward run to build grad graph. """
new_kwargs = kwargs
if self.sens_param:
if not 'sens' in kwargs.keys():
if 'sens' not in kwargs.keys():
args = args[:-1]
else:
new_kwargs = kwargs.copy()

View File

@ -13,6 +13,7 @@
# limitations under the License.
# ============================================================================
"""debug_ops"""
from __future__ import absolute_import
from types import FunctionType, MethodType
from mindspore import context