clean pylint

pull/1218/head
jinyaohui 5 years ago
parent f23bfe0d71
commit 5a914994ba

@ -14,6 +14,7 @@
# ============================================================================
'''Remove after MindData merge to MindSpore '''
import numpy as np
from mindspore import Tensor

@ -19,13 +19,14 @@
import math
import numpy as np
import mindspore.common.dtype as mstype
import mindspore.ops.functional as F
from mindspore import nn
from mindspore.common.initializer import TruncatedNormal
from mindspore.ops import operations as P
from mindspore.common.tensor import Tensor
from mindspore.model_zoo.Bert_NEZHA.bert_model import SaturateCast, RelaPosEmbeddingsGenerator
from mindspore.ops import operations as P
class BertAttentionQueryKeyMul(nn.Cell):

@ -17,22 +17,19 @@
import numpy as np
import mindspore.common.dtype as mstype
from mindspore import context, nn
from mindspore.model_zoo.Bert_NEZHA import GetNextSentenceOutput, BertNetworkWithLoss
from mindspore.model_zoo.Bert_NEZHA.bert_model import BertConfig, \
EmbeddingLookup, EmbeddingPostprocessor, BertOutput, \
BertAttention, BertSelfAttention, SaturateCast, TruncatedNormal, \
BertEncoderCell, BertTransformer, CreateAttentionMaskFromInputMask, BertModel
from mindspore import context, nn
import mindspore.common.dtype as mstype
from .bert_attention_submodules import BertAttentionQueryKeyMul, BertAttentionRelativePositionKeys, \
BertAttentionMaskBackward, BertAttentionSoftmax, BertAttentionRelativePositionValues, BertDense
from ..mindspore_test import mindspore_test
from ..pipeline.gradient.compare_gradient import \
pipeline_for_compare_inputs_grad_with_numerical_diff_for_group_by_group_config, \
pipeline_for_compare_params_grad_with_numerical_diff_for_group_by_group_config
from ..mindspore_test import mindspore_test
from .bert_attention_submodules import BertAttentionQueryKeyMul, BertAttentionRelativePositionKeys, \
BertAttentionMaskBackward, BertAttentionSoftmax, BertAttentionRelativePositionValues, BertDense
verification_set = {
'inputs': [

@ -16,6 +16,7 @@
"""Test bert compare with npy."""
import numpy as np
import mindspore.common.dtype as mstype
from mindspore import context
from mindspore.model_zoo.Bert_NEZHA.bert_model import BertAttention, SaturateCast, \
@ -25,12 +26,11 @@ from mindspore.model_zoo.Bert_NEZHA.bert_model import BertAttention, SaturateCas
BertSelfAttention, CreateAttentionMaskFromInputMask, \
RelaPosMatrixGenerator, BertOutput, \
RelaPosEmbeddingsGenerator
from .bert_attention_submodules import BertAttentionQueryKeyMul, BertAttentionRelativePositionKeys, BertAttentionMask, \
BertAttentionSoftmax, BertAttentionRelativePositionValues, BertDense
from ..mindspore_test import mindspore_test
from ..pipeline.forward.compare_forward import \
pipeline_for_compare_forward_with_npy_for_group_by_group_config_using_group_policy
from .bert_attention_submodules import BertAttentionQueryKeyMul, BertAttentionRelativePositionKeys, BertAttentionMask, \
BertAttentionSoftmax, BertAttentionRelativePositionValues, BertDense
verification_set = {
'inputs': [

@ -17,11 +17,10 @@
from mindspore import context
from mindspore.ops import operations as P
from ..mindspore_test import mindspore_test
from ..pipeline.gradient.compare_gradient import \
pipeline_for_compare_inputs_grad_with_numerical_diff_for_group_by_group_config, \
pipeline_for_compare_inputs_jacobian_with_numerical_diff_for_group_by_group_config
from ..mindspore_test import mindspore_test
# from ...vm_impl import *

@ -15,20 +15,20 @@
"""Test bert submodules."""
import os
import numpy as np
import os
from mindspore import Tensor
from mindspore import nn, context
from mindspore.model_zoo.Bert_NEZHA import EmbeddingLookup, GetMaskedLMOutput, \
BertConfig, BertPreTraining, BertNetworkWithLoss
from mindspore.model_zoo.Bert_NEZHA.bert_model import BertModel
from mindspore import nn, context
from mindspore import Tensor
from ..utils.block_util import get_output_cell
from ..mindspore_test import mindspore_test
from ..pipeline.forward.compile_forward import pipeline_for_compile_forward_anf_graph_for_case_by_case_config, \
pipeline_for_compile_forward_ge_graph_for_case_by_case_config
from ..pipeline.gradient.compile_gradient import pipeline_for_compile_grad_anf_graph_for_case_by_case_config, \
pipeline_for_compile_grad_ge_graph_for_case_by_case_config
from ..utils.block_util import get_output_cell
from ...dataset_mock import MindData
# pylint: disable=missing-docstring, W0612, arguments-differ

@ -18,9 +18,9 @@
from mindspore import context
from mindspore.nn.optim import Lamb
from ..mindspore_test import mindspore_test
from ..pipeline.gradient.check_training import pipeline_for_check_model_loss_for_case_by_case_config
from ..utils.model_util import Linreg
from ..utils.model_util import SquaredLoss
from ..pipeline.gradient.check_training import pipeline_for_check_model_loss_for_case_by_case_config
network = Linreg(2)
num_epochs = 1000

@ -19,7 +19,6 @@ import numpy as np
from mindspore import context
from mindspore.ops import operations as P
from ..mindspore_test import mindspore_test
from ..pipeline.gradient.compare_gradient import pipeline_for_compare_inputs_grad_with_npy_for_case_by_case_config
from ...vm_impl import *

@ -15,8 +15,8 @@
"""Component that Check if the function raises the expected Exception."""
import sys
import pytest
import sys
from ...components.icomponent import IExectorComponent
from ...utils import keyword

@ -16,8 +16,8 @@
"""Component that verify if the model can converge to expected loss."""
from ...components.icomponent import IExectorComponent
from ...utils.model_util import Model
from ...utils import keyword
from ...utils.model_util import Model
class LossVerifierEC(IExectorComponent):

@ -18,8 +18,8 @@
import numpy as np
from ...components.icomponent import IFacadeComponent
from ...utils.facade_util import get_block_config, fill_block_config
from ...utils import keyword
from ...utils.facade_util import get_block_config, fill_block_config
class MeFacadeFC(IFacadeComponent):

@ -16,8 +16,8 @@
"""Component that generate dataset for linear regression."""
from ...components.icomponent import IDataComponent
from ...utils.dataset_util import generate_dataset_for_linear_regression
from ...utils import keyword
from ...utils.dataset_util import generate_dataset_for_linear_regression
class GenerateDataSetForLRDC(IDataComponent):

@ -16,12 +16,12 @@
"""Component that generate inputs for specified shape type."""
import numpy as np
from mindspore.common.tensor import Tensor
from mindspore.common.tensor import Tensor
from ...components.icomponent import IDataComponent
from ...utils.other_util import shape2tensor
from ...utils.config_util import get_input_config
from ...utils import keyword
from ...utils.config_util import get_input_config
from ...utils.other_util import shape2tensor
class GenerateFromShapeDC(IDataComponent):

@ -16,8 +16,8 @@
"""Component that load inputs from npy file."""
from ...components.icomponent import IDataComponent
from ...utils.npy_util import load_data_from_npy_or_shape
from ...utils import keyword
from ...utils.npy_util import load_data_from_npy_or_shape
class LoadFromNpyDC(IDataComponent):

@ -16,8 +16,8 @@
"""Component that comparing forward result with baseline functions."""
from ...components.icomponent import IVerifierComponent
from ...utils.compare_util import compare
from ...utils import keyword
from ...utils.compare_util import compare
class CompareWithVC(IVerifierComponent):

@ -16,8 +16,8 @@
"""Component that comparing gradients with baseline functions."""
from ...components.icomponent import IVerifierComponent
from ...utils.compare_util import compare
from ...utils import keyword
from ...utils.compare_util import compare
class CompareGradientWithVC(IVerifierComponent):

@ -16,11 +16,12 @@
"""Component that comparing results with expectation serialized as npy file."""
import numpy as np
from ...components.icomponent import IVerifierComponent
from ...utils.other_util import to_numpy_list, to_numpy
from ...utils import keyword
from ...utils.npy_util import load_data_from_npy_or_shape
from ...utils.other_util import to_numpy_list, to_numpy
from ...utils.verifier_util import tolerance_assert
from ...utils import keyword
class LoadFromNpyVC(IVerifierComponent):

@ -16,8 +16,8 @@
"""Component that verify shape and type."""
from ...components.icomponent import IVerifierComponent
from ...utils.other_util import to_numpy_list
from ...utils import keyword
from ...utils.other_util import to_numpy_list
class ShapeTypeVC(IVerifierComponent):

@ -17,6 +17,7 @@
import logging
import pytest
from .components.icomponent import IDataComponent, IBuilderComponent, IExectorComponent, \
IVerifierComponent, IFIPolicyComponent, IERPolicyComponent, IComponent, \
IFacadeComponent

@ -15,18 +15,18 @@
"""Pipelines for forward comparison."""
from ...components.expect_result_policy.cartesian_product_on_id_for_expect_result import IdCartesianProductERPC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.executor.exec_forward import IdentityEC
from ...components.function.run_block import RunBlockBC
from ...components.inputs.generate_inputs_from_shape import GenerateFromShapeDC
from ...components.verifier.compare_forward import CompareWithVC
from ...components.expect_result_policy.cartesian_product_on_id_for_expect_result import IdCartesianProductERPC
from ...components.facade.me_facade import MeFacadeFC
from ...components.inputs.load_inputs_from_npy import LoadFromNpyDC
from ...components.verifier.verify_expect_from_npy import LoadFromNpyVC
from ...components.function.init_params_with_rand_and_run_block import RunBlockWithRandParamBC
from ...components.function.run_block import RunBlockBC
from ...components.function_inputs_policy.cartesian_product_on_group_for_function_inputs import \
GroupCartesianProductFIPC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.inputs.generate_inputs_from_shape import GenerateFromShapeDC
from ...components.inputs.load_inputs_from_npy import LoadFromNpyDC
from ...components.verifier.compare_forward import CompareWithVC
from ...components.verifier.verify_expect_from_npy import LoadFromNpyVC
# pylint: disable=W0105
"""

@ -15,13 +15,13 @@
"""Pipelines for forward computing."""
from ...components.facade.me_facade import MeFacadeFC
from ...components.inputs.generate_inputs_from_shape import GenerateFromShapeDC
from ...components.executor.exec_forward import IdentityEC
from ...components.executor.check_exceptions import CheckExceptionsEC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.executor.exec_forward import IdentityEC
from ...components.facade.me_facade import MeFacadeFC
from ...components.function.compile_block import CompileBlockBC
from ...components.function.run_block import RunBlockBC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.inputs.generate_inputs_from_shape import GenerateFromShapeDC
# pylint: disable=W0105
"""

@ -16,10 +16,10 @@
"""Pipelines for exception checking."""
from ...components.executor.check_exceptions import CheckExceptionsEC
from ...components.inputs.get_inputs_from_config import IdentityDC
from ...components.function.get_function_from_config import IdentityBC
from ...components.facade.me_facade import MeFacadeFC
from ...components.function.get_function_from_config import IdentityBC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.inputs.get_inputs_from_config import IdentityDC
# pylint: disable=W0105
"""

@ -15,13 +15,13 @@
"""Pipelines for shape and type checking."""
from ...components.inputs.get_inputs_from_config import IdentityDC
from ...components.function.get_function_from_config import IdentityBC
from ...components.executor.exec_forward import IdentityEC
from ...components.expect_result_policy.cartesian_product_on_group_for_expect_result \
import GroupCartesianProductERPC
from ...components.function.get_function_from_config import IdentityBC
from ...components.function_inputs_policy.cartesian_product_on_group_for_function_inputs \
import GroupCartesianProductFIPC
from ...components.inputs.get_inputs_from_config import IdentityDC
from ...components.verifier.verify_shapetype import ShapeTypeVC
# pylint: disable=W0105

@ -15,11 +15,11 @@
"""Pipelines for loss checking."""
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.executor.exec_and_verify_model_loss import LossVerifierEC
from ...components.facade.me_facade import MeFacadeFC
from ...components.function.get_function_from_config import IdentityBC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.inputs.generate_dataset_for_linear_regression import GenerateDataSetForLRDC
from ...components.executor.exec_and_verify_model_loss import LossVerifierEC
# pylint: disable=W0105
"""

@ -15,20 +15,20 @@
"""Pipelines for gradients comparison."""
from ...components.expect_result_policy.cartesian_product_on_id_for_expect_result import IdCartesianProductERPC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.executor.check_gradient_wrt_inputs import CheckGradientWrtInputsEC
from ...components.executor.check_gradient_wrt_params import CheckGradientWrtParamsEC
from ...components.executor.check_jacobian_wrt_inputs import CheckJacobianWrtInputsEC
from ...components.executor.exec_gradient import IdentityBackwardEC
from ...components.expect_result_policy.cartesian_product_on_id_for_expect_result import IdCartesianProductERPC
from ...components.facade.me_facade import MeFacadeFC
from ...components.function.get_function_from_config import IdentityBC
from ...components.function.run_gradient_wrt_inputs import RunBackwardBlockWrtInputsBC
from ...components.function.run_gradient_wrt_params import RunBackwardBlockWrtParamsBC
from ...components.function_inputs_policy.cartesian_product_on_id_for_function_inputs import IdCartesianProductFIPC
from ...components.inputs.generate_inputs_from_shape import GenerateFromShapeDC
from ...components.verifier.compare_gradient import CompareGradientWithVC
from ...components.facade.me_facade import MeFacadeFC
from ...components.inputs.load_inputs_from_npy import LoadFromNpyDC
from ...components.verifier.compare_gradient import CompareGradientWithVC
from ...components.verifier.verify_expect_from_npy import LoadFromNpyVC
from ...components.function.get_function_from_config import IdentityBC
from ...components.executor.check_gradient_wrt_inputs import CheckGradientWrtInputsEC
from ...components.executor.check_gradient_wrt_params import CheckGradientWrtParamsEC
from ...components.executor.check_jacobian_wrt_inputs import CheckJacobianWrtInputsEC
# pylint: disable=W0105
"""

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save