未验证 提交 47e7b7a5 编写于 作者: H HongyuJia 提交者: GitHub

[Fix Type] Fix typo error (#48391)

* fix typo error

* pass CI-coverage
上级 da0022e4
...@@ -173,7 +173,7 @@ class GradNodeBase { ...@@ -173,7 +173,7 @@ class GradNodeBase {
virtual ~GradNodeBase() { VLOG(7) << "Destruct 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 * be overrided by derived class defined for each operator. It accepts a
* vector of Tensor which contains grads input of current operator * vector of Tensor which contains grads input of current operator
* *
......
...@@ -3262,7 +3262,7 @@ void OperatorWithKernel::BuildPhiKernelContext( ...@@ -3262,7 +3262,7 @@ void OperatorWithKernel::BuildPhiKernelContext(
for (const auto& attr_iter : runtime_attrs) { for (const auto& attr_iter : runtime_attrs) {
auto& attr_name = attr_iter.first; auto& attr_name = attr_iter.first;
auto& attr = attr_iter.second; 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); SetDnnAttrIntoDeviceContext(dev_ctx, attr, attr_name, attr_propertys);
} }
// TODO(chenweihang): Since the pass will still `SetAttr` in the OpDesc, // TODO(chenweihang): Since the pass will still `SetAttr` in the OpDesc,
...@@ -3277,7 +3277,7 @@ void OperatorWithKernel::BuildPhiKernelContext( ...@@ -3277,7 +3277,7 @@ void OperatorWithKernel::BuildPhiKernelContext(
for (const auto& attr_iter : attrs) { for (const auto& attr_iter : attrs) {
auto& attr_name = attr_iter.first; auto& attr_name = attr_iter.first;
auto& attr = attr_iter.second; 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); SetDnnAttrIntoDeviceContext(dev_ctx, attr, attr_name, attr_propertys);
} }
VLOG(4) << "Done runtime attributes"; VLOG(4) << "Done runtime attributes";
......
...@@ -237,7 +237,7 @@ class TracedGradOp { ...@@ -237,7 +237,7 @@ class TracedGradOp {
if (kRole == TracedVarRole::kBackward) { if (kRole == TracedVarRole::kBackward) {
for (auto& var : vars) { for (auto& var : vars) {
VLOG(6) << "SetIutput var name: " << var->Name(); VLOG(6) << "SetInput var name: " << var->Name();
if (var && !var->OverridedStopGradient()) { if (var && !var->OverridedStopGradient()) {
var->SetGraphIsFreed(false); var->SetGraphIsFreed(false);
auto dirty_grad_node = var->GradNode(); auto dirty_grad_node = var->GradNode();
...@@ -351,7 +351,7 @@ class TracedGradOp { ...@@ -351,7 +351,7 @@ class TracedGradOp {
// Get a snapshot of VariableWrapper at a certain inplace version. // Get a snapshot of VariableWrapper at a certain inplace version.
// The inplace version number of VariableWrapper is used for inplace // The inplace version number of VariableWrapper is used for inplace
// detection in gradient compution. // detection in gradient computation.
static const std::shared_ptr<VariableWrapper> SnapshotVarWrapper( static const std::shared_ptr<VariableWrapper> SnapshotVarWrapper(
const std::shared_ptr<VariableWrapper>& var_wrapper) { const std::shared_ptr<VariableWrapper>& var_wrapper) {
// NOTE(liym27): // NOTE(liym27):
......
...@@ -139,7 +139,7 @@ const std::unordered_map<std::string, ExtraAttrPropertySet> ...@@ -139,7 +139,7 @@ const std::unordered_map<std::string, ExtraAttrPropertySet>
ExtraAttrPropertySet(ExtraAttrProperty::GPUDNN)}, ExtraAttrPropertySet(ExtraAttrProperty::GPUDNN)},
}; };
inline ExtraAttrPropertySet GetExtraAttrPropertys( inline ExtraAttrPropertySet GetExtraAttrProperties(
const std::string& attr_name) { const std::string& attr_name) {
auto iter = extra_attr_properties.find(attr_name); auto iter = extra_attr_properties.find(attr_name);
if (iter != extra_attr_properties.end()) { if (iter != extra_attr_properties.end()) {
......
...@@ -421,7 +421,7 @@ static void ConstructFwdAndBwdMap( ...@@ -421,7 +421,7 @@ static void ConstructFwdAndBwdMap(
} }
} }
static std::vector<paddle::any> CastAttrsToTragetType( static std::vector<paddle::any> CastAttrsToTargetType(
const std::vector<paddle::any>& src, const std::vector<paddle::any>& src,
const std::vector<std::string>& attrs_names) { const std::vector<std::string>& attrs_names) {
std::vector<paddle::any> res; std::vector<paddle::any> res;
...@@ -488,7 +488,7 @@ static PyObject* eager_api_jit_function_call(PyObject* self, ...@@ -488,7 +488,7 @@ static PyObject* eager_api_jit_function_call(PyObject* self,
EAGER_CATCH_AND_THROW_RETURN_NULL 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* args,
PyObject* kwargs) { PyObject* kwargs) {
EAGER_TRY EAGER_TRY
...@@ -511,7 +511,7 @@ static PyObject* eager_api_run_costum_op(PyObject* self, ...@@ -511,7 +511,7 @@ static PyObject* eager_api_run_costum_op(PyObject* self,
op_type)); op_type));
VLOG(7) << "Run Kernel of Custom Op: " << op_type; VLOG(7) << "Run Kernel of Custom Op: " << op_type;
std::vector<paddle::any> res_attrs = std::vector<paddle::any> res_attrs =
CastAttrsToTragetType(ctx.Attrs(), CastAttrsToTargetType(ctx.Attrs(),
paddle::framework::OpMetaInfoHelper::GetAttrs( paddle::framework::OpMetaInfoHelper::GetAttrs(
meta_info_map.at(op_type)[0])); meta_info_map.at(op_type)[0]));
ctx.EmplaceBackAttrs(res_attrs); ctx.EmplaceBackAttrs(res_attrs);
...@@ -1087,7 +1087,7 @@ PyMethodDef variable_functions[] = { ...@@ -1087,7 +1087,7 @@ PyMethodDef variable_functions[] = {
METH_VARARGS | METH_KEYWORDS, METH_VARARGS | METH_KEYWORDS,
NULL}, NULL},
{"_run_custom_op", {"_run_custom_op",
(PyCFunction)(void (*)(void))eager_api_run_costum_op, (PyCFunction)(void (*)(void))eager_api_run_custom_op,
METH_VARARGS | METH_KEYWORDS, METH_VARARGS | METH_KEYWORDS,
NULL}, NULL},
{"tensor_copy", {"tensor_copy",
......
...@@ -23,7 +23,7 @@ IS_MAC = sys.platform.startswith('darwin') ...@@ -23,7 +23,7 @@ IS_MAC = sys.platform.startswith('darwin')
site_packages_path = get_python_lib() site_packages_path = get_python_lib()
# Note(Aurelius84): We use `add_test` in Cmake to config how to run unittest in CI. # 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 # `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. # PaddlePaddle whl. So here we specific `include_dirs` to avoid errors in CI.
paddle_includes = [ paddle_includes = [
os.path.join(site_packages_path, 'paddle', 'include'), os.path.join(site_packages_path, 'paddle', 'include'),
......
...@@ -56,7 +56,6 @@ from .extension_utils import ( ...@@ -56,7 +56,6 @@ from .extension_utils import (
IS_WINDOWS, IS_WINDOWS,
OS_NAME, OS_NAME,
MSVC_COMPILE_FLAGS, MSVC_COMPILE_FLAGS,
MSVC_COMPILE_FLAGS,
) )
from .extension_utils import CLANG_COMPILE_FLAGS, CLANG_LINK_FLAGS from .extension_utils import CLANG_COMPILE_FLAGS, CLANG_LINK_FLAGS
...@@ -85,7 +84,7 @@ def setup(**attr): ...@@ -85,7 +84,7 @@ def setup(**attr):
``import`` statement. ``import`` statement.
It encapsulates the python built-in ``setuptools.setup`` function and keeps arguments 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 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 flags. It also will automatically search and valid local environment and versions of
``cc(Linux)`` , ``cl.exe(Windows)`` and ``nvcc`` , then compiles customized operators ``cc(Linux)`` , ``cl.exe(Windows)`` and ``nvcc`` , then compiles customized operators
...@@ -104,8 +103,8 @@ def setup(**attr): ...@@ -104,8 +103,8 @@ def setup(**attr):
Note: Note:
1. Currently we support Linux, MacOS and Windows platfrom. 1. Currently we support Linux, MacOS and Windows platform.
2. On Linux platform, we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` . 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 Then, Use ``which cc`` to ensure location of ``cc`` and using ``cc --version`` to ensure linking
GCC version. GCC version.
3. On Windows platform, we recommend to install `` Visual Studio`` (>=2017). 3. On Windows platform, we recommend to install `` Visual Studio`` (>=2017).
...@@ -164,7 +163,7 @@ def setup(**attr): ...@@ -164,7 +163,7 @@ def setup(**attr):
``site-package/paddle/include`` . Please add the corresponding directory path if including third-party ``site-package/paddle/include`` . Please add the corresponding directory path if including third-party
head files. Default is None. 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 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. compiler using dict type with ``{'cxx': [...], 'nvcc': [...]}`` . Default is None.
**attr(dict, optional): Specify other arguments same as ``setuptools.setup`` . **attr(dict, optional): Specify other arguments same as ``setuptools.setup`` .
...@@ -211,7 +210,7 @@ def setup(**attr): ...@@ -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( ), "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) 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: for ext_module in ext_modules:
ext_module.name = attr['name'] ext_module.name = attr['name']
...@@ -263,7 +262,7 @@ def CppExtension(sources, *args, **kwargs): ...@@ -263,7 +262,7 @@ def CppExtension(sources, *args, **kwargs):
Note: 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. as ``name`` argument specified in ``setup`` interface.
...@@ -277,7 +276,7 @@ def CppExtension(sources, *args, **kwargs): ...@@ -277,7 +276,7 @@ def CppExtension(sources, *args, **kwargs):
""" """
kwargs = normalize_extension_kwargs(kwargs, use_cuda=False) kwargs = normalize_extension_kwargs(kwargs, use_cuda=False)
# Note(Aurelius84): While using `setup` and `jit`, the Extension `name` will # 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. # users can not specific name in Extension.
# See `paddle.utils.cpp_extension.setup` for details. # See `paddle.utils.cpp_extension.setup` for details.
name = kwargs.get('name', None) name = kwargs.get('name', None)
...@@ -315,7 +314,7 @@ def CUDAExtension(sources, *args, **kwargs): ...@@ -315,7 +314,7 @@ def CUDAExtension(sources, *args, **kwargs):
Note: 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. as ``name`` argument specified in ``setup`` interface.
...@@ -329,7 +328,7 @@ def CUDAExtension(sources, *args, **kwargs): ...@@ -329,7 +328,7 @@ def CUDAExtension(sources, *args, **kwargs):
""" """
kwargs = normalize_extension_kwargs(kwargs, use_cuda=True) kwargs = normalize_extension_kwargs(kwargs, use_cuda=True)
# Note(Aurelius84): While using `setup` and `jit`, the Extension `name` will # 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. # users can not specific name in Extension.
# See `paddle.utils.cpp_extension.setup` for details. # See `paddle.utils.cpp_extension.setup` for details.
name = kwargs.get('name', None) name = kwargs.get('name', None)
...@@ -376,7 +375,7 @@ class BuildExtension(build_ext): ...@@ -376,7 +375,7 @@ class BuildExtension(build_ext):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
""" """
Attributes is initialized with following oreder: Attributes is initialized with following order:
1. super().__init__() 1. super().__init__()
2. initialize_options(self) 2. initialize_options(self)
...@@ -430,9 +429,9 @@ class BuildExtension(build_ext): ...@@ -430,9 +429,9 @@ class BuildExtension(build_ext):
obj, src, ext, cc_args, extra_postargs, pp_opts 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. # with dict type is dangerous.
src = os.path.abspath(src) src = os.path.abspath(src)
cflags = copy.deepcopy(extra_postargs) cflags = copy.deepcopy(extra_postargs)
...@@ -593,7 +592,7 @@ class BuildExtension(build_ext): ...@@ -593,7 +592,7 @@ class BuildExtension(build_ext):
def object_filenames_with_cuda(origina_func, build_directory): 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 Originally, both .cc/.cu will have .o object output that will
bring file override problem. Use .cu.o as CUDA object suffix. bring file override problem. Use .cu.o as CUDA object suffix.
""" """
...@@ -645,7 +644,7 @@ class BuildExtension(build_ext): ...@@ -645,7 +644,7 @@ class BuildExtension(build_ext):
_reset_so_rpath(so_path) _reset_so_rpath(so_path)
def get_ext_filename(self, fullname): 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) ext_name = super().get_ext_filename(fullname)
split_str = '.' split_str = '.'
name_items = ext_name.split(split_str) name_items = ext_name.split(split_str)
...@@ -658,7 +657,7 @@ class BuildExtension(build_ext): ...@@ -658,7 +657,7 @@ class BuildExtension(build_ext):
name_items.pop(-2) name_items.pop(-2)
ext_name = split_str.join(name_items) ext_name = split_str.join(name_items)
# custommed_extension.dylib # customized_extension.dylib
if OS_NAME.startswith('darwin'): if OS_NAME.startswith('darwin'):
name_items[-1] = 'dylib' name_items[-1] = 'dylib'
ext_name = split_str.join(name_items) ext_name = split_str.join(name_items)
...@@ -728,7 +727,7 @@ class BuildExtension(build_ext): ...@@ -728,7 +727,7 @@ class BuildExtension(build_ext):
class EasyInstallCommand(easy_install): 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. file.
NOTE(Aurelius84): This is a hook subclass inherited Command used to rename shared NOTE(Aurelius84): This is a hook subclass inherited Command used to rename shared
...@@ -838,8 +837,8 @@ def load( ...@@ -838,8 +837,8 @@ def load(
Note: Note:
1. Currently we support Linux, MacOS and Windows platfrom. 1. Currently we support Linux, MacOS and Windows platform.
2. On Linux platform, we recommend to use GCC 8.2 as soft linking condidate of ``/usr/bin/cc`` . 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 Then, Use ``which cc`` to ensure location of ``cc`` and using ``cc --version`` to ensure linking
GCC version. GCC version.
3. On Windows platform, we recommend to install `` Visual Studio`` (>=2017). 3. On Windows platform, we recommend to install `` Visual Studio`` (>=2017).
......
...@@ -197,7 +197,7 @@ def custom_write_stub(resource, pyfile): ...@@ -197,7 +197,7 @@ def custom_write_stub(resource, pyfile):
""" """
).lstrip() ).lstrip()
# Parse registerring op information # Parse registering op information
_, op_info = CustomOpInfo.instance().last() _, op_info = CustomOpInfo.instance().last()
so_path = op_info.so_path so_path = op_info.so_path
...@@ -250,7 +250,7 @@ class CustomOpInfo: ...@@ -250,7 +250,7 @@ class CustomOpInfo:
def last(self): def last(self):
""" """
Return the lastest insert custom op info. Return the last inserted custom op info.
""" """
assert len(self.op_info_map) > 0 assert len(self.op_info_map) > 0
return next(reversed(self.op_info_map.items())) return next(reversed(self.op_info_map.items()))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册