未验证 提交 5f25183e 编写于 作者: S Shuangchi He 提交者: GitHub

[CodeStyle][F401] remove unused imports in unittests/r_cmake_paddle_tools. (#46712)

上级 4bbb0b38
...@@ -20,6 +20,7 @@ res = sys.argv[1] ...@@ -20,6 +20,7 @@ res = sys.argv[1]
out = sys.argv[2] out = sys.argv[2]
var = re.sub(r'[ .-]', '_', os.path.basename(res)) var = re.sub(r'[ .-]', '_', os.path.basename(res))
open(out, "w").write("const unsigned char " + var + "[] = {" + ",".join([ open(out, "w").write("const unsigned char " + var + "[] = {" +
"0x%02x" % ord(c) for c in open(res).read() ",".join(["0x%02x" % ord(c)
]) + ",0};\n" + "const unsigned " + var + "_size = sizeof(" + var + ");\n") for c in open(res).read()]) + ",0};\n" +
"const unsigned " + var + "_size = sizeof(" + var + ");\n")
...@@ -12,11 +12,8 @@ ...@@ -12,11 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import logging
import yaml import yaml
import re import re
import argparse
import os
######################## ########################
### Global Variables ### ### Global Variables ###
......
...@@ -12,23 +12,19 @@ ...@@ -12,23 +12,19 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import yaml
import re import re
import argparse import argparse
import os import os
import logging
from codegen_utils import core_ops_returns_info, core_ops_args_info, core_ops_args_type_info from codegen_utils import core_ops_returns_info, core_ops_args_info, core_ops_args_type_info
from codegen_utils import yaml_types_mapping from codegen_utils import ReadBwdFile
from codegen_utils import ReadFwdFile, ReadBwdFile from codegen_utils import FindForwardName, GetGradNodeName, GetSavedName
from codegen_utils import FindGradName, FindForwardName, GetSavedName, GetGradNodeName
from codegen_utils import IsPlainTensorType, IsVectorTensorType from codegen_utils import IsPlainTensorType, IsVectorTensorType
from codegen_utils import GetConstReference, RemoveConstAndReference from codegen_utils import GetConstReference, RemoveConstAndReference
from codegen_utils import GetDygraphForwardFunctionName, GetIntermediateAPIFunctionName, GetDygraphLogName from codegen_utils import GetDygraphForwardFunctionName, GetIntermediateAPIFunctionName
from codegen_utils import GetAutoGradMetaName, GetAutoGradMetaVectorName from codegen_utils import GetAutoGradMetaName, GetAutoGradMetaVectorName
from codegen_utils import RemoveSpecialSymbolsInName, RecoverBaseNameOfInplaceFunction
from codegen_utils import GetInplacedFunctionName from codegen_utils import GetInplacedFunctionName
from codegen_utils import ParseYamlArgs, ParseYamlReturns, ParseYamlForwardFromBackward from codegen_utils import ParseYamlForwardFromBackward
from codegen_utils import ParseYamlForward, ParseYamlBackward from codegen_utils import ParseYamlBackward
from codegen_utils import ParseYamlInplaceInfo from codegen_utils import ParseYamlInplaceInfo
from codegen_utils import FunctionGeneratorBase, GeneratorBase from codegen_utils import FunctionGeneratorBase, GeneratorBase
from codegen_utils import ops_to_fill_zero_for_empty_grads from codegen_utils import ops_to_fill_zero_for_empty_grads
......
...@@ -14,11 +14,9 @@ ...@@ -14,11 +14,9 @@
import os import os
import argparse import argparse
import logging
from codegen_utils import FunctionGeneratorBase, GeneratorBase from codegen_utils import FunctionGeneratorBase, GeneratorBase
from codegen_utils import yaml_types_mapping from codegen_utils import GetForwardFunctionName, IsVectorTensorType
from codegen_utils import ReadFwdFile, IsVectorTensorType, GetForwardFunctionName from codegen_utils import GetInplacedFunctionName
from codegen_utils import ParseYamlForward, GetInplacedFunctionName
########################### ###########################
## Global Configurations ## ## Global Configurations ##
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import tarfile, os import tarfile
import sys import sys
......
...@@ -10,18 +10,11 @@ ...@@ -10,18 +10,11 @@
# without warranties or conditions of any kind, either express or implied. # without warranties or conditions of any kind, either express or implied.
# see the license for the specific language governing permissions and # see the license for the specific language governing permissions and
# limitations under the license. # limitations under the license.
import hashlib
import unittest
import os import os
import io import io
import numpy as np import numpy as np
import time
import sys import sys
import random
import functools
import contextlib
from PIL import Image from PIL import Image
import math
from paddle.dataset.common import download from paddle.dataset.common import download
import tarfile import tarfile
import argparse import argparse
...@@ -163,12 +156,12 @@ def run_convert(): ...@@ -163,12 +156,12 @@ def run_convert():
retry = 0 retry = 0
try_limit = 3 try_limit = 3
while not (os.path.exists(output_file) and while not (os.path.exists(output_file)
os.path.getsize(output_file) == FULL_SIZE_BYTES): and os.path.getsize(output_file) == FULL_SIZE_BYTES):
if os.path.exists(output_file): if os.path.exists(output_file):
sys.stderr.write( sys.stderr.write(
"\n\nThe existing binary file[{}] is broken. Start to generate new one...\n\n". "\n\nThe existing binary file[{}] is broken. Start to generate new one...\n\n"
format(output_file)) .format(output_file))
os.remove(output_file) os.remove(output_file)
if retry < try_limit: if retry < try_limit:
retry = retry + 1 retry = retry + 1
...@@ -204,15 +197,16 @@ def convert_Imagenet_local2bin(args): ...@@ -204,15 +197,16 @@ def convert_Imagenet_local2bin(args):
img = Image.open(img_path) img = Image.open(img_path)
img = process_image(img) img = process_image(img)
np_img = np.array(img) np_img = np.array(img)
of.seek(SIZE_INT64 + SIZE_FLOAT32 * DATA_DIM * DATA_DIM * 3 * of.seek(SIZE_INT64 +
idx) SIZE_FLOAT32 * DATA_DIM * DATA_DIM * 3 * idx)
of.write(np_img.astype('float32').tobytes()) of.write(np_img.astype('float32').tobytes())
#save label(int64_t) to file #save label(int64_t) to file
label_int = (int)(label) label_int = (int)(label)
np_label = np.array(label_int) np_label = np.array(label_int)
of.seek(SIZE_INT64 + SIZE_FLOAT32 * DATA_DIM * DATA_DIM * 3 * of.seek(SIZE_INT64 +
num_images + idx * SIZE_INT64) SIZE_FLOAT32 * DATA_DIM * DATA_DIM * 3 * num_images +
idx * SIZE_INT64)
of.write(np_label.astype('int64').tobytes()) of.write(np_label.astype('int64').tobytes())
# The bin file should contain # The bin file should contain
...@@ -221,36 +215,38 @@ def convert_Imagenet_local2bin(args): ...@@ -221,36 +215,38 @@ def convert_Imagenet_local2bin(args):
target_size = SIZE_INT64 + num_images * 3 * args.data_dim * args.data_dim * SIZE_FLOAT32 + num_images * SIZE_INT64 target_size = SIZE_INT64 + num_images * 3 * args.data_dim * args.data_dim * SIZE_FLOAT32 + num_images * SIZE_INT64
if (os.path.getsize(bin_file_path) == target_size): if (os.path.getsize(bin_file_path) == target_size):
print( print(
"Success! The user data output binary file can be found at: {0}". "Success! The user data output binary file can be found at: {0}"
format(bin_file_path)) .format(bin_file_path))
else: else:
print("Conversion failed!") print("Conversion failed!")
def main_preprocess_Imagenet(args): def main_preprocess_Imagenet(args):
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Convert the full Imagenet val set or local data to binary file.", description=
"Convert the full Imagenet val set or local data to binary file.",
usage=None, usage=None,
add_help=True) add_help=True)
parser.add_argument( parser.add_argument(
'--local', '--local',
action="store_true", action="store_true",
help="If used, user need to set --data_dir and then convert file") help="If used, user need to set --data_dir and then convert file")
parser.add_argument( parser.add_argument("--data_dir",
"--data_dir", default="", type=str, help="Dataset root directory") default="",
type=str,
help="Dataset root directory")
parser.add_argument( parser.add_argument(
"--label_list", "--label_list",
type=str, type=str,
default="val_list.txt", default="val_list.txt",
help="List of object labels with same sequence as denoted in the annotation file" help=
"List of object labels with same sequence as denoted in the annotation file"
) )
parser.add_argument( parser.add_argument("--output_file",
"--output_file",
type=str, type=str,
default="imagenet_small.bin", default="imagenet_small.bin",
help="File path of the output binary file") help="File path of the output binary file")
parser.add_argument( parser.add_argument("--data_dim",
"--data_dim",
type=int, type=int,
default=DATA_DIM, default=DATA_DIM,
help="Image preprocess with data_dim width and height") help="Image preprocess with data_dim width and height")
......
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from full_pascalvoc_test_preprocess import main_pascalvoc_preprocess
import numpy as np
import paddle.fluid.core as core
import paddle.fluid as fluid
import unittest import unittest
import os import os
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import paddle import paddle
from paddle.nn import Layer
from paddle.static import InputSpec from paddle.static import InputSpec
from paddle.jit import to_static from paddle.jit import to_static
import sys import sys
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import re import re
import math import math
from functools import partial from functools import partial
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
import re import re
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
import re import re
......
...@@ -12,17 +12,14 @@ ...@@ -12,17 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from typing import List, Dict
import itertools import itertools
import re import re
from jinja2.filters import do_xmlattr
from type_mapping import (input_types_map, optional_input_types_map, from type_mapping import (input_types_map, optional_input_types_map,
attr_types_map, opmaker_attr_types_map, attr_types_map, opmaker_attr_types_map,
output_type_map) output_type_map)
from type_mapping import (dense_input_types_map, dense_optional_input_types_map, from type_mapping import (dense_input_types_map, dense_optional_input_types_map,
dense_output_types_map, sr_input_types_map, dense_output_types_map, sr_output_types_map,
sr_optional_input_types_map, sr_output_types_map,
phi_attr_types_map) phi_attr_types_map)
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
import argparse import argparse
import os import os
import re
from itertools import chain
from pathlib import Path from pathlib import Path
import yaml import yaml
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
import re
from api_gen import ForwardAPI from api_gen import ForwardAPI
from sparse_api_gen import SparseAPI from sparse_api_gen import SparseAPI
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import re import re
import argparse import argparse
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import argparse import argparse
from pathlib import Path
import yaml import yaml
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
import re import re
import yaml
from copy import copy from copy import copy
from typing import Dict, Any, List, Tuple from typing import Dict, Any, List, Tuple
from tests import is_attr, is_input, is_output, is_vec from tests import is_attr, is_input, is_output, is_vec
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
import re
from api_gen import ForwardAPI from api_gen import ForwardAPI
from api_base import PREFIX_TENSOR_NAME from api_base import PREFIX_TENSOR_NAME
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
import re
from sparse_api_gen import SparseAPI from sparse_api_gen import SparseAPI
from backward_api_gen import BackwardAPI from backward_api_gen import BackwardAPI
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
import re
from api_gen import ForwardAPI from api_gen import ForwardAPI
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import yaml import yaml
import argparse import argparse
......
...@@ -16,10 +16,8 @@ ...@@ -16,10 +16,8 @@
# #
import platform import platform
from sys import argv
import argparse import argparse
import os import os
import time
def parse_args(): def parse_args():
......
...@@ -16,10 +16,8 @@ ...@@ -16,10 +16,8 @@
# pylint: skip-file # pylint: skip-file
import functools
import numpy as np import numpy as np
from paddle.fluid.core import AnalysisConfig from paddle.fluid.core import AnalysisConfig
from paddle.fluid.core import AnalysisPredictor
from paddle.fluid.core import create_paddle_predictor from paddle.fluid.core import create_paddle_predictor
......
...@@ -12,18 +12,7 @@ ...@@ -12,18 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import argparse
import json import json
import six
import sys
import re
import os
import glob
import unittest
import pandas
import tempfile
import platform
import pandas as pd
class ChromeTraceFormatter(object): class ChromeTraceFormatter(object):
......
...@@ -17,8 +17,7 @@ import time ...@@ -17,8 +17,7 @@ import time
import json import json
import glob import glob
import logging import logging
import pandas as pd from multiprocessing import Lock
from multiprocessing import Process, Lock
""" Some terms to clarify the code """ Some terms to clarify the code
in most case, one or more paremeters may be set as input args for a class or a function in most case, one or more paremeters may be set as input args for a class or a function
in form of single variable or k-v dict in form of single variable or k-v dict
......
...@@ -14,21 +14,16 @@ ...@@ -14,21 +14,16 @@
import os import os
import glob import glob
import logging
import argparse import argparse
import multiprocessing
import pandas as pd
from multiprocessing import Process from multiprocessing import Process
from NetFileReader import netFileReader
from DCGMFileReader import dcgmFileReader from DCGMFileReader import dcgmFileReader
from ProfileFileReader import profileFileReader from ProfileFileReader import profileFileReader
from CspFileReader import getLogger from CspFileReader import getLogger
from CspFileReader import TIME_PATH, DCGM_PATH, NET_PATH, PROFILE_PATH from CspFileReader import TIME_PATH, DCGM_PATH, NET_PATH, PROFILE_PATH
from CspFileReader import NETINFO_TRACE_NUM, DCGMINFO_TRACE_NUM, PIPELINEINFO_TRACE_NUM from CspFileReader import FILEORGANIZEFORM_BYRANK, FILEORGANIZEFORM_BYTRAINER
from CspFileReader import FILEORGANIZEFORM_BYRANK, FILEORGANIZEFORM_BYTRAINER, FILEORGANIZEFORM_BYOTHER, FILEORGANIZEFORM
def get_argparse(): def get_argparse():
......
...@@ -14,23 +14,17 @@ ...@@ -14,23 +14,17 @@
import os import os
import re import re
import json
import glob
import logging import logging
import tempfile import tempfile
import argparse
import pandas as pd import pandas as pd
import multiprocessing import multiprocessing
from multiprocessing import Process from multiprocessing import Process
from CspChromeTraceFormatter import ChromeTraceFormatter
from CspFileReader import FileReader from CspFileReader import FileReader
from CspFileReader import getLogger from CspFileReader import getLogger
from CspFileReader import dcgmMetricParameterMap from CspFileReader import dcgmMetricParameterMap
from CspFileReader import TIME_PATH, DCGM_PATH, NET_PATH, PROFILE_PATH from CspFileReader import PIPELINEINFO_TRACE_NUM
from CspFileReader import NETINFO_TRACE_NUM, DCGMINFO_TRACE_NUM, PIPELINEINFO_TRACE_NUM from CspFileReader import FILEORGANIZEFORM_BYTRAINER
from CspFileReader import FILEORGANIZEFORM_BYRANK, FILEORGANIZEFORM_BYTRAINER, FILEORGANIZEFORM_BYOTHER, FILEORGANIZEFORM
class dcgmFileReader(FileReader): class dcgmFileReader(FileReader):
......
...@@ -12,22 +12,15 @@ ...@@ -12,22 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import json import json
import glob
import logging
import pandas as pd
import multiprocessing import multiprocessing
from multiprocessing import Process from multiprocessing import Process
from CspChromeTraceFormatter import ChromeTraceFormatter
from CspFileReader import FileReader from CspFileReader import FileReader
from CspFileReader import getLogger from CspFileReader import getLogger
from CspFileReader import TIME_PATH, DCGM_PATH, NET_PATH, PROFILE_PATH from CspFileReader import PIPELINEINFO_TRACE_NUM
from CspFileReader import NETINFO_TRACE_NUM, DCGMINFO_TRACE_NUM, PIPELINEINFO_TRACE_NUM from CspFileReader import FILEORGANIZEFORM_BYTRAINER
from CspFileReader import FILEORGANIZEFORM_BYRANK, FILEORGANIZEFORM_BYTRAINER, FILEORGANIZEFORM_BYOTHER, FILEORGANIZEFORM
class netFileReader(FileReader): class netFileReader(FileReader):
......
...@@ -12,26 +12,19 @@ ...@@ -12,26 +12,19 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import six import six
import glob
import json import json
import logging
import argparse
import pandas as pd
import multiprocessing import multiprocessing
from multiprocessing import Process from multiprocessing import Process
import google.protobuf.text_format as text_format
import paddle.fluid.proto.profiler.profiler_pb2 as profiler_pb2 import paddle.fluid.proto.profiler.profiler_pb2 as profiler_pb2
from CspChromeTraceFormatter import ChromeTraceFormatter from CspChromeTraceFormatter import ChromeTraceFormatter
from CspFileReader import FileReader from CspFileReader import FileReader
from CspFileReader import getLogger from CspFileReader import getLogger
from CspFileReader import TIME_PATH, DCGM_PATH, NET_PATH, PROFILE_PATH
from CspFileReader import NETINFO_TRACE_NUM, DCGMINFO_TRACE_NUM, PIPELINEINFO_TRACE_NUM from CspFileReader import NETINFO_TRACE_NUM, DCGMINFO_TRACE_NUM, PIPELINEINFO_TRACE_NUM
from CspFileReader import FILEORGANIZEFORM_BYRANK, FILEORGANIZEFORM_BYTRAINER, FILEORGANIZEFORM_BYOTHER, FILEORGANIZEFORM from CspFileReader import FILEORGANIZEFORM_BYRANK
class profileFileReader(FileReader): class profileFileReader(FileReader):
......
...@@ -15,11 +15,7 @@ ...@@ -15,11 +15,7 @@
import commands import commands
from xml.etree import ElementTree from xml.etree import ElementTree
import re import re
import time
import queue
import threading
import os import os
import json
import sys import sys
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
import difflib import difflib
import sys import sys
import importlib
import os
import count_api_without_core_ops import count_api_without_core_ops
with open(sys.argv[1], 'r') as f: with open(sys.argv[1], 'r') as f:
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
""" Get pull requests. """ """ Get pull requests. """
import os import os
import time
import os.path import os.path
from github import Github from github import Github
......
...@@ -13,10 +13,9 @@ ...@@ -13,10 +13,9 @@
# limitations under the License. # limitations under the License.
"""DocstringChecker is used to check python doc string's style.""" """DocstringChecker is used to check python doc string's style."""
import six
import astroid import astroid
from pylint.checkers import BaseChecker, utils from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker from pylint.interfaces import IAstroidChecker
from collections import defaultdict from collections import defaultdict
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
import docstring_checker import docstring_checker
import pylint.testutils import pylint.testutils
import astroid import astroid
import pytest
import sys
class TestDocstring(pylint.testutils.CheckerTestCase): class TestDocstring(pylint.testutils.CheckerTestCase):
......
...@@ -16,11 +16,7 @@ import importlib ...@@ -16,11 +16,7 @@ import importlib
import inspect import inspect
import collections import collections
import sys import sys
import pydoc
import hashlib import hashlib
import functools
import platform
from paddle import _C_ops, _legacy_C_ops
__all__ = [ __all__ = [
'get_apis_with_and_without_core_ops', 'get_apis_with_and_without_core_ops',
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import difflib
import sys import sys
try: try:
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
import ssl import ssl
import re import re
import urllib.request import urllib.request
import json
import collections
import sys import sys
import getopt import getopt
import external_error_pb2 import external_error_pb2
......
...@@ -15,10 +15,7 @@ ...@@ -15,10 +15,7 @@
# limitations under the License. # limitations under the License.
import os import os
import time
import json import json
import datetime
import codecs
import sys import sys
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
import os import os
import json import json
import re import re
import sys
import time import time
import subprocess import subprocess
import requests import requests
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
# limitations under the License. # limitations under the License.
import os import os
import json
import time
import sys import sys
import re import re
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import os import os
import sys import sys
import re
import json import json
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
import queue import queue
import threading import threading
import os import os
import json
import time import time
import sys import sys
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
""" """
A fake model with multiple FC layers to test CINN on a more complex model. A fake model with multiple FC layers to test CINN on a more complex model.
""" """
import numpy
import sys, os
import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import json import json
import yaml import yaml
import sys
import os import os
from get_compat_kernel_signature import get_compat_kernels_info from get_compat_kernel_signature import get_compat_kernels_info
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
# limitations under the License. # limitations under the License.
import os import os
import re
import json
skip_list = ["adam_sig.cc", "adamw_sig.cc"] skip_list = ["adam_sig.cc", "adamw_sig.cc"]
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import argparse import argparse
import json import json
import yaml import yaml
from typing import List, Dict, Any from typing import Dict, List
skipped_phi_api_list_file = "/tools/infrt/skipped_phi_api.json" skipped_phi_api_list_file = "/tools/infrt/skipped_phi_api.json"
api_yaml_file = "/paddle/phi/api/yaml/api.yaml" api_yaml_file = "/paddle/phi/api/yaml/api.yaml"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
import os import os
import re import re
import json
skip_list = [] skip_list = []
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import sys
import os import os
import platform import platform
......
...@@ -25,6 +25,7 @@ import hashlib ...@@ -25,6 +25,7 @@ import hashlib
import pkgutil import pkgutil
import logging import logging
import argparse import argparse
import paddle
member_dict = collections.OrderedDict() member_dict = collections.OrderedDict()
...@@ -126,7 +127,6 @@ def get_all_api(root_path='paddle', attr="__all__"): ...@@ -126,7 +127,6 @@ def get_all_api(root_path='paddle', attr="__all__"):
""" """
walk through the paddle package to collect all the apis. walk through the paddle package to collect all the apis.
""" """
import paddle
global api_info_dict global api_info_dict
api_counter = 0 api_counter = 0
for filefinder, name, ispkg in pkgutil.walk_packages( for filefinder, name, ispkg in pkgutil.walk_packages(
...@@ -140,7 +140,6 @@ def get_all_api(root_path='paddle', attr="__all__"): ...@@ -140,7 +140,6 @@ def get_all_api(root_path='paddle', attr="__all__"):
continue continue
except AttributeError: except AttributeError:
logger.warning("AttributeError occurred when `eval(%s)`", name) logger.warning("AttributeError occurred when `eval(%s)`", name)
pass
else: else:
api_counter += process_module(m, attr) api_counter += process_module(m, attr)
...@@ -159,7 +158,6 @@ def insert_api_into_dict(full_name, gen_doc_anno=None): ...@@ -159,7 +158,6 @@ def insert_api_into_dict(full_name, gen_doc_anno=None):
Return: Return:
api_info object or None api_info object or None
""" """
import paddle
try: try:
obj = eval(full_name) obj = eval(full_name)
fc_id = id(obj) fc_id = id(obj)
...@@ -222,7 +220,6 @@ def process_module(m, attr="__all__"): ...@@ -222,7 +220,6 @@ def process_module(m, attr="__all__"):
def check_public_api(): def check_public_api():
import paddle
modulelist = [ #npqa modulelist = [ #npqa
paddle, paddle.amp, paddle.nn, paddle.nn.functional, paddle, paddle.amp, paddle.nn, paddle.nn.functional,
paddle.nn.initializer, paddle.nn.utils, paddle.static, paddle.static.nn, paddle.nn.initializer, paddle.nn.utils, paddle.static, paddle.static.nn,
...@@ -271,7 +268,6 @@ def check_public_api(): ...@@ -271,7 +268,6 @@ def check_public_api():
def check_allmodule_callable(): def check_allmodule_callable():
import paddle
modulelist = [paddle] modulelist = [paddle]
for m in modulelist: for m in modulelist:
visit_all_module(m) visit_all_module(m)
......
...@@ -12,13 +12,10 @@ ...@@ -12,13 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from xml.etree import ElementTree
import re
import time import time
import queue import queue
import threading import threading
import os import os
import json
import sys import sys
taskQueue = queue.Queue() taskQueue = queue.Queue()
......
...@@ -448,8 +448,6 @@ def get_filenames(full_test=False): ...@@ -448,8 +448,6 @@ def get_filenames(full_test=False):
''' '''
global whl_error global whl_error
import paddle
import paddle.fluid.contrib.slim.quantization
whl_error = [] whl_error = []
if full_test: if full_test:
get_full_api_from_pr_spec() get_full_api_from_pr_spec()
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import os
import sys import sys
import distro import distro
import platform import platform
......
...@@ -17,10 +17,7 @@ ...@@ -17,10 +17,7 @@
TestCases for check_api_compatible.py TestCases for check_api_compatible.py
""" """
import unittest import unittest
import sys
import os
import tempfile import tempfile
import inspect
from check_api_compatible import read_argspec_from_file from check_api_compatible import read_argspec_from_file
from check_api_compatible import check_compatible from check_api_compatible import check_compatible
......
...@@ -451,7 +451,6 @@ class Test_get_api_md5(unittest.TestCase): ...@@ -451,7 +451,6 @@ class Test_get_api_md5(unittest.TestCase):
def tearDown(self): def tearDown(self):
os.remove(self.api_pr_spec_filename) os.remove(self.api_pr_spec_filename)
pass
def test_get_api_md5(self): def test_get_api_md5(self):
res = get_api_md5('paddle/fluid/API_PR.spec') res = get_api_md5('paddle/fluid/API_PR.spec')
......
...@@ -15,10 +15,7 @@ ...@@ -15,10 +15,7 @@
import argparse import argparse
import json import json
import six import six
import sys
import unittest
import google.protobuf.text_format as text_format
import paddle.fluid.proto.profiler.profiler_pb2 as profiler_pb2 import paddle.fluid.proto.profiler.profiler_pb2 as profiler_pb2
parser = argparse.ArgumentParser(description=__doc__) parser = argparse.ArgumentParser(description=__doc__)
......
...@@ -13,9 +13,7 @@ ...@@ -13,9 +13,7 @@
# limitations under the License. # limitations under the License.
"""To get a list of prec ut """ """To get a list of prec ut """
import sys
import os import os
import platform
def get_prec_ut_list(all_test_cases, prec_test_cases): def get_prec_ut_list(all_test_cases, prec_test_cases):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册