From 47e7b7a52bdb5086684ad03a0de09020a323bd03 Mon Sep 17 00:00:00 2001 From: HongyuJia Date: Thu, 1 Dec 2022 11:49:55 +0800 Subject: [PATCH] [Fix Type] Fix typo error (#48391) * fix typo error * pass CI-coverage --- paddle/fluid/eager/grad_node_info.h | 2 +- paddle/fluid/framework/operator.cc | 4 +- paddle/fluid/imperative/dygraph_grad_maker.h | 4 +- paddle/fluid/operators/ops_extra_info.h | 2 +- paddle/fluid/pybind/eager_functions.cc | 8 ++-- python/paddle/fluid/tests/custom_op/utils.py | 2 +- .../utils/cpp_extension/cpp_extension.py | 37 +++++++++---------- .../utils/cpp_extension/extension_utils.py | 4 +- 8 files changed, 31 insertions(+), 32 deletions(-) diff --git a/paddle/fluid/eager/grad_node_info.h b/paddle/fluid/eager/grad_node_info.h index 65044640146..f20bad71c51 100644 --- a/paddle/fluid/eager/grad_node_info.h +++ b/paddle/fluid/eager/grad_node_info.h @@ -173,7 +173,7 @@ class GradNodeBase { virtual ~GradNodeBase() { VLOG(7) << "Destruct GradNodeBase"; } /** - * operator() designed to contian the real backward execution logic, it should + * operator() designed to contain the real backward execution logic, it should * be overrided by derived class defined for each operator. It accepts a * vector of Tensor which contains grads input of current operator * diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index 0784c833068..b294779837f 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -3262,7 +3262,7 @@ void OperatorWithKernel::BuildPhiKernelContext( for (const auto& attr_iter : runtime_attrs) { auto& attr_name = attr_iter.first; auto& attr = attr_iter.second; - auto attr_propertys = paddle::operators::GetExtraAttrPropertys(attr_name); + auto attr_propertys = paddle::operators::GetExtraAttrProperties(attr_name); SetDnnAttrIntoDeviceContext(dev_ctx, attr, attr_name, attr_propertys); } // TODO(chenweihang): Since the pass will still `SetAttr` in the OpDesc, @@ -3277,7 +3277,7 @@ void OperatorWithKernel::BuildPhiKernelContext( for (const auto& attr_iter : attrs) { auto& attr_name = attr_iter.first; auto& attr = attr_iter.second; - auto attr_propertys = paddle::operators::GetExtraAttrPropertys(attr_name); + auto attr_propertys = paddle::operators::GetExtraAttrProperties(attr_name); SetDnnAttrIntoDeviceContext(dev_ctx, attr, attr_name, attr_propertys); } VLOG(4) << "Done runtime attributes"; diff --git a/paddle/fluid/imperative/dygraph_grad_maker.h b/paddle/fluid/imperative/dygraph_grad_maker.h index e0c943f18ce..0683bdc16a8 100644 --- a/paddle/fluid/imperative/dygraph_grad_maker.h +++ b/paddle/fluid/imperative/dygraph_grad_maker.h @@ -237,7 +237,7 @@ class TracedGradOp { if (kRole == TracedVarRole::kBackward) { for (auto& var : vars) { - VLOG(6) << "SetIutput var name: " << var->Name(); + VLOG(6) << "SetInput var name: " << var->Name(); if (var && !var->OverridedStopGradient()) { var->SetGraphIsFreed(false); auto dirty_grad_node = var->GradNode(); @@ -351,7 +351,7 @@ class TracedGradOp { // Get a snapshot of VariableWrapper at a certain inplace version. // The inplace version number of VariableWrapper is used for inplace - // detection in gradient compution. + // detection in gradient computation. static const std::shared_ptr SnapshotVarWrapper( const std::shared_ptr& var_wrapper) { // NOTE(liym27): diff --git a/paddle/fluid/operators/ops_extra_info.h b/paddle/fluid/operators/ops_extra_info.h index 12df9f96d6d..94f0fa2a606 100644 --- a/paddle/fluid/operators/ops_extra_info.h +++ b/paddle/fluid/operators/ops_extra_info.h @@ -139,7 +139,7 @@ const std::unordered_map ExtraAttrPropertySet(ExtraAttrProperty::GPUDNN)}, }; -inline ExtraAttrPropertySet GetExtraAttrPropertys( +inline ExtraAttrPropertySet GetExtraAttrProperties( const std::string& attr_name) { auto iter = extra_attr_properties.find(attr_name); if (iter != extra_attr_properties.end()) { diff --git a/paddle/fluid/pybind/eager_functions.cc b/paddle/fluid/pybind/eager_functions.cc index 14368a9d99c..9c0f189e630 100644 --- a/paddle/fluid/pybind/eager_functions.cc +++ b/paddle/fluid/pybind/eager_functions.cc @@ -421,7 +421,7 @@ static void ConstructFwdAndBwdMap( } } -static std::vector CastAttrsToTragetType( +static std::vector CastAttrsToTargetType( const std::vector& src, const std::vector& attrs_names) { std::vector res; @@ -488,7 +488,7 @@ static PyObject* eager_api_jit_function_call(PyObject* self, EAGER_CATCH_AND_THROW_RETURN_NULL } -static PyObject* eager_api_run_costum_op(PyObject* self, +static PyObject* eager_api_run_custom_op(PyObject* self, PyObject* args, PyObject* kwargs) { EAGER_TRY @@ -511,7 +511,7 @@ static PyObject* eager_api_run_costum_op(PyObject* self, op_type)); VLOG(7) << "Run Kernel of Custom Op: " << op_type; std::vector res_attrs = - CastAttrsToTragetType(ctx.Attrs(), + CastAttrsToTargetType(ctx.Attrs(), paddle::framework::OpMetaInfoHelper::GetAttrs( meta_info_map.at(op_type)[0])); ctx.EmplaceBackAttrs(res_attrs); @@ -1087,7 +1087,7 @@ PyMethodDef variable_functions[] = { METH_VARARGS | METH_KEYWORDS, NULL}, {"_run_custom_op", - (PyCFunction)(void (*)(void))eager_api_run_costum_op, + (PyCFunction)(void (*)(void))eager_api_run_custom_op, METH_VARARGS | METH_KEYWORDS, NULL}, {"tensor_copy", diff --git a/python/paddle/fluid/tests/custom_op/utils.py b/python/paddle/fluid/tests/custom_op/utils.py index ab15f742ece..671d412e808 100644 --- a/python/paddle/fluid/tests/custom_op/utils.py +++ b/python/paddle/fluid/tests/custom_op/utils.py @@ -23,7 +23,7 @@ IS_MAC = sys.platform.startswith('darwin') site_packages_path = get_python_lib() # Note(Aurelius84): We use `add_test` in Cmake to config how to run unittest in CI. # `PYTHONPATH` will be set as `build/python/paddle` that will make no way to find -# paddle include directory. Because the following path is generated after insalling +# paddle include directory. Because the following path is generated after installing # PaddlePaddle whl. So here we specific `include_dirs` to avoid errors in CI. paddle_includes = [ os.path.join(site_packages_path, 'paddle', 'include'), diff --git a/python/paddle/utils/cpp_extension/cpp_extension.py b/python/paddle/utils/cpp_extension/cpp_extension.py index c31b934c55e..91ce1203867 100644 --- a/python/paddle/utils/cpp_extension/cpp_extension.py +++ b/python/paddle/utils/cpp_extension/cpp_extension.py @@ -56,7 +56,6 @@ from .extension_utils import ( IS_WINDOWS, OS_NAME, MSVC_COMPILE_FLAGS, - MSVC_COMPILE_FLAGS, ) from .extension_utils import CLANG_COMPILE_FLAGS, CLANG_LINK_FLAGS @@ -85,7 +84,7 @@ def setup(**attr): ``import`` statement. It encapsulates the python built-in ``setuptools.setup`` function and keeps arguments - and usage same as the native interface. Meanwhile, it hiddens Paddle inner framework + and usage same as the native interface. Meanwhile, it hides Paddle inner framework concepts, such as necessary compiling flags, included paths of head files, and linking flags. It also will automatically search and valid local environment and versions of ``cc(Linux)`` , ``cl.exe(Windows)`` and ``nvcc`` , then compiles customized operators @@ -104,8 +103,8 @@ def setup(**attr): Note: - 1. Currently we support Linux, MacOS and Windows platfrom. - 2. On Linux platform, we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` . + 1. Currently we support Linux, MacOS and Windows platform. + 2. On Linux platform, we recommend to use GCC 8.2 as soft linking candidate of ``/usr/bin/cc`` . Then, Use ``which cc`` to ensure location of ``cc`` and using ``cc --version`` to ensure linking GCC version. 3. On Windows platform, we recommend to install `` Visual Studio`` (>=2017). @@ -164,7 +163,7 @@ def setup(**attr): ``site-package/paddle/include`` . Please add the corresponding directory path if including third-party head files. Default is None. extra_compile_args(list[str] | dict, optional): Specify the extra compiling flags such as ``-O3`` . If set ``list[str]`` , all these flags - will be applied for ``cc`` and ``nvcc`` compiler. It support specify flags only applied ``cc`` or ``nvcc`` + will be applied for ``cc`` and ``nvcc`` compiler. It supports specify flags only applied ``cc`` or ``nvcc`` compiler using dict type with ``{'cxx': [...], 'nvcc': [...]}`` . Default is None. **attr(dict, optional): Specify other arguments same as ``setuptools.setup`` . @@ -211,7 +210,7 @@ def setup(**attr): ), "Required only one Extension, but received {}. If you want to compile multi operators, you can include all necessary source files in one Extension.".format( len(ext_modules) ) - # replace Extension.name with attr['name] to keep consistant with Package name. + # replace Extension.name with attr['name] to keep consistent with Package name. for ext_module in ext_modules: ext_module.name = attr['name'] @@ -263,7 +262,7 @@ def CppExtension(sources, *args, **kwargs): Note: - It is mainly used in ``setup`` and the nama of built shared library keeps same + It is mainly used in ``setup`` and the name of built shared library keeps same as ``name`` argument specified in ``setup`` interface. @@ -277,7 +276,7 @@ def CppExtension(sources, *args, **kwargs): """ kwargs = normalize_extension_kwargs(kwargs, use_cuda=False) # Note(Aurelius84): While using `setup` and `jit`, the Extension `name` will - # be replaced as `setup.name` to keep consistant with package. Because we allow + # be replaced as `setup.name` to keep consistent with package. Because we allow # users can not specific name in Extension. # See `paddle.utils.cpp_extension.setup` for details. name = kwargs.get('name', None) @@ -315,7 +314,7 @@ def CUDAExtension(sources, *args, **kwargs): Note: - It is mainly used in ``setup`` and the nama of built shared library keeps same + It is mainly used in ``setup`` and the name of built shared library keeps same as ``name`` argument specified in ``setup`` interface. @@ -329,7 +328,7 @@ def CUDAExtension(sources, *args, **kwargs): """ kwargs = normalize_extension_kwargs(kwargs, use_cuda=True) # Note(Aurelius84): While using `setup` and `jit`, the Extension `name` will - # be replaced as `setup.name` to keep consistant with package. Because we allow + # be replaced as `setup.name` to keep consistent with package. Because we allow # users can not specific name in Extension. # See `paddle.utils.cpp_extension.setup` for details. name = kwargs.get('name', None) @@ -376,7 +375,7 @@ class BuildExtension(build_ext): def __init__(self, *args, **kwargs): """ - Attributes is initialized with following oreder: + Attributes is initialized with following order: 1. super().__init__() 2. initialize_options(self) @@ -430,9 +429,9 @@ class BuildExtension(build_ext): obj, src, ext, cc_args, extra_postargs, pp_opts ): """ - Monkey patch machanism to replace inner compiler to custom complie process on Unix platform. + Monkey patch mechanism to replace inner compiler to custom complie process on Unix platform. """ - # use abspath to ensure no warning and don't remove deecopy because modify params + # use abspath to ensure no warning and don't remove deepcopy because modify params # with dict type is dangerous. src = os.path.abspath(src) cflags = copy.deepcopy(extra_postargs) @@ -593,7 +592,7 @@ class BuildExtension(build_ext): def object_filenames_with_cuda(origina_func, build_directory): """ - Decorated the function to add customized naming machanism. + Decorated the function to add customized naming mechanism. Originally, both .cc/.cu will have .o object output that will bring file override problem. Use .cu.o as CUDA object suffix. """ @@ -645,7 +644,7 @@ class BuildExtension(build_ext): _reset_so_rpath(so_path) def get_ext_filename(self, fullname): - # for example: custommed_extension.cpython-37m-x86_64-linux-gnu.so + # for example: customized_extension.cpython-37m-x86_64-linux-gnu.so ext_name = super().get_ext_filename(fullname) split_str = '.' name_items = ext_name.split(split_str) @@ -658,7 +657,7 @@ class BuildExtension(build_ext): name_items.pop(-2) ext_name = split_str.join(name_items) - # custommed_extension.dylib + # customized_extension.dylib if OS_NAME.startswith('darwin'): name_items[-1] = 'dylib' ext_name = split_str.join(name_items) @@ -728,7 +727,7 @@ class BuildExtension(build_ext): class EasyInstallCommand(easy_install): """ - Extend easy_intall Command to control the behavior of naming shared library + Extend easy_install Command to control the behavior of naming shared library file. NOTE(Aurelius84): This is a hook subclass inherited Command used to rename shared @@ -838,8 +837,8 @@ def load( Note: - 1. Currently we support Linux, MacOS and Windows platfrom. - 2. On Linux platform, we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` . + 1. Currently we support Linux, MacOS and Windows platform. + 2. On Linux platform, we recommend to use GCC 8.2 as soft linking candidate of ``/usr/bin/cc`` . Then, Use ``which cc`` to ensure location of ``cc`` and using ``cc --version`` to ensure linking GCC version. 3. On Windows platform, we recommend to install `` Visual Studio`` (>=2017). diff --git a/python/paddle/utils/cpp_extension/extension_utils.py b/python/paddle/utils/cpp_extension/extension_utils.py index 46046b51660..09b5492e541 100644 --- a/python/paddle/utils/cpp_extension/extension_utils.py +++ b/python/paddle/utils/cpp_extension/extension_utils.py @@ -197,7 +197,7 @@ def custom_write_stub(resource, pyfile): """ ).lstrip() - # Parse registerring op information + # Parse registering op information _, op_info = CustomOpInfo.instance().last() so_path = op_info.so_path @@ -250,7 +250,7 @@ class CustomOpInfo: def last(self): """ - Return the lastest insert custom op info. + Return the last inserted custom op info. """ assert len(self.op_info_map) > 0 return next(reversed(self.op_info_map.items())) -- GitLab