Skip to content

Commit

Permalink
[Fix Type] Fix typo error (#48391)
Browse files Browse the repository at this point in the history
* fix typo error

* pass CI-coverage
  • Loading branch information
jiahy0825 committed Dec 1, 2022
1 parent da0022e commit 47e7b7a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion paddle/fluid/eager/grad_node_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/framework/operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/imperative/dygraph_grad_maker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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<VariableWrapper> SnapshotVarWrapper(
const std::shared_ptr<VariableWrapper>& var_wrapper) {
// NOTE(liym27):
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/ops_extra_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const std::unordered_map<std::string, ExtraAttrPropertySet>
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()) {
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/pybind/eager_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>& attrs_names) {
std::vector<paddle::any> res;
Expand Down Expand Up @@ -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
Expand All @@ -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<paddle::any> res_attrs =
CastAttrsToTragetType(ctx.Attrs(),
CastAttrsToTargetType(ctx.Attrs(),
paddle::framework::OpMetaInfoHelper::GetAttrs(
meta_info_map.at(op_type)[0]));
ctx.EmplaceBackAttrs(res_attrs);
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/fluid/tests/custom_op/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
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'),
Expand Down
37 changes: 18 additions & 19 deletions python/paddle/utils/cpp_extension/cpp_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
IS_WINDOWS,
OS_NAME,
MSVC_COMPILE_FLAGS,
MSVC_COMPILE_FLAGS,
)
from .extension_utils import CLANG_COMPILE_FLAGS, CLANG_LINK_FLAGS

Expand Down Expand Up @@ -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
Expand All @@ -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).
Expand Down Expand Up @@ -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`` .
Expand Down Expand Up @@ -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']

Expand Down Expand Up @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -376,7 +375,7 @@ 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__()
2. initialize_options(self)
Expand Down Expand Up @@ -430,9 +429,9 @@ def unix_custom_single_compiler(
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)
Expand Down Expand Up @@ -593,7 +592,7 @@ def win_custom_spawn(cmd):

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.
"""
Expand Down Expand Up @@ -645,7 +644,7 @@ def wrapper(source_filenames, strip_dir=0, output_dir=''):
_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)
Expand All @@ -658,7 +657,7 @@ def get_ext_filename(self, fullname):
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)
Expand Down Expand Up @@ -728,7 +727,7 @@ def _record_op_info(self):

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
Expand Down Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/utils/cpp_extension/extension_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __bootstrap__():
"""
).lstrip()

# Parse registerring op information
# Parse registering op information
_, op_info = CustomOpInfo.instance().last()
so_path = op_info.so_path

Expand Down Expand Up @@ -250,7 +250,7 @@ def add(self, op_name, so_name, so_path=None):

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()))
Expand Down

0 comments on commit 47e7b7a

Please sign in to comment.