Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ funcion = 'funcion'
Funcion = 'Funcion'
futher = 'futher'
furture = 'furture'
Greate = 'Greate'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 PR 和另一个又会冲突吧……

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议大力出奇迹

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?怎么还教唆别人呢 给你一拳

groupped = 'groupped'
gard = 'gard'
GARD = 'GARD'
identiy = 'identiy'
indentify = 'indentify'
implemention = 'implemention'
Expand Down
14 changes: 7 additions & 7 deletions paddle/fluid/pir/dialect/op_generator/op_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
# =====================================
# String Template for h file code gen
# =====================================
NAMESPACE_GARD_TEMPLATE = """namespace {namespace} {{
NAMESPACE_GUARD_TEMPLATE = """namespace {namespace} {{
{input}
}} // namespace {namespace}"""

Expand Down Expand Up @@ -2343,7 +2343,7 @@ def OpGenerator(
if dialect_name == "pd_op":
other_info = OP_TO_MULTI_KERNELS_MAP_H
for name in reversed(namespaces):
other_info = NAMESPACE_GARD_TEMPLATE.format(
other_info = NAMESPACE_GUARD_TEMPLATE.format(
namespace=name, input=other_info
) # Add namespaces
only_pd_op_header_files_str = """
Expand All @@ -2353,7 +2353,7 @@ def OpGenerator(
elif dialect_name == "onednn_op":
other_info = ONEDNN_ONLY_OP_SET_H
for name in reversed(namespaces):
other_info = NAMESPACE_GARD_TEMPLATE.format(
other_info = NAMESPACE_GUARD_TEMPLATE.format(
namespace=name, input=other_info
) # Add namespaces
else:
Expand All @@ -2362,7 +2362,7 @@ def OpGenerator(
head_file_str = "\n".join(head_file_strs)
declare_type_id_str = "\n".join(declare_type_id_strs)
for name in reversed(namespaces):
head_file_str = NAMESPACE_GARD_TEMPLATE.format(
head_file_str = NAMESPACE_GUARD_TEMPLATE.format(
namespace=name, input=head_file_str
) # Add namespaces
head_file_str = H_FILE_TEMPLATE.format(
Expand All @@ -2384,15 +2384,15 @@ def OpGenerator(
)
other_info_str += sp_other_info_str
for name in reversed(namespaces):
other_info_str = NAMESPACE_GARD_TEMPLATE.format(
other_info_str = NAMESPACE_GUARD_TEMPLATE.format(
namespace=name, input=other_info_str
) # Add namespaces
elif dialect_name == "onednn_op":
other_info_str = ONEDNN_ONLY_OP_SET.format(
maps=", \r".join(onednn_only_op_list)
)
for name in reversed(namespaces):
other_info_str = NAMESPACE_GARD_TEMPLATE.format(
other_info_str = NAMESPACE_GUARD_TEMPLATE.format(
namespace=name, input=other_info_str
) # Add namespaces
else:
Expand Down Expand Up @@ -2442,7 +2442,7 @@ def OpGenerator(
for id in range(len(new_op_def_cc_file)):
source_file_str = source_file_strs[id]
for name in reversed(namespaces):
source_file_str = NAMESPACE_GARD_TEMPLATE.format(
source_file_str = NAMESPACE_GUARD_TEMPLATE.format(
namespace=name, input=source_file_str
) # Add namespaces

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace {

// add_grad + matmul_grad + add_ -> matmul + fused_liner_param_gard_add
// add_grad + matmul_grad + add_ -> matmul + fused_linear_param_grad_add
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不止这一个地方呀 😂

class FusedMatmulAddGradAddPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override { return "FusedMatmulAddGradAddPattern"; }
Expand Down Expand Up @@ -91,7 +91,7 @@ class FusedMatmulAddGradAddPattern : public paddle::drr::DrrPatternBase {
}
};

// matmul_grad + add_ -> matmul + fused_liner_param_gard_add
// matmul_grad + add_ -> matmul + fused_linear_param_grad_add
class FusedMatmulGradAddPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override { return "FusedMatmulGradAddPattern"; }
Expand Down Expand Up @@ -148,7 +148,7 @@ class FusedMatmulGradAddPattern : public paddle::drr::DrrPatternBase {
};

// matmul + reshape + reshape + matmul + reshape + add_ -> matmul +
// fused_liner_param_gard_add
// fused_linear_param_grad_add
class FusedMatmulReshapeMatmulAddPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override {
Expand Down Expand Up @@ -214,7 +214,7 @@ class FusedMatmulReshapeMatmulAddPattern : public paddle::drr::DrrPatternBase {
}
};

// matmul + 0 = add_(0,1) -> fused_liner_param_gard_add
// matmul + 0 = add_(0,1) -> fused_linear_param_grad_add
class FusedMatmulAddaPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override { return "FusedMatmulAddaPattern"; }
Expand Down Expand Up @@ -258,7 +258,7 @@ class FusedMatmulAddaPattern : public paddle::drr::DrrPatternBase {
}
};

// matmul + 1 = add_(1,0) -> fused_liner_param_gard_add
// matmul + 1 = add_(1,0) -> fused_linear_param_grad_add
class FusedMatmulAddbPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override { return "FusedMatmulAddbPattern"; }
Expand Down Expand Up @@ -302,7 +302,7 @@ class FusedMatmulAddbPattern : public paddle::drr::DrrPatternBase {
}
};

// add_grad + matmul + 0 = add_(0,1) -> fused_liner_param_gard_add
// add_grad + matmul + 0 = add_(0,1) -> fused_linear_param_grad_add
class FusedMatmulAddGradAddaPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override { return "FusedMatmulAddGradAddaPattern"; }
Expand Down Expand Up @@ -360,7 +360,7 @@ class FusedMatmulAddGradAddaPattern : public paddle::drr::DrrPatternBase {
}
};

// add_grad + matmul + 1 = add_(1,0) -> fused_liner_param_gard_add
// add_grad + matmul + 1 = add_(1,0) -> fused_linear_param_grad_add
class FusedMatmulAddGradAddbPattern : public paddle::drr::DrrPatternBase {
public:
std::string name() const override { return "FusedMatmulAddGradAddbPattern"; }
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/pir/transforms/tensorrt/trt_op_marker_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ class GreaterEqualOpPattern
auto x_dtype = pir::GetDataTypeFromValue(x);
auto y_dtype = pir::GetDataTypeFromValue(y);
if (x_dtype.isa<pir::BoolType>() || y_dtype.isa<pir::BoolType>()) {
VLOG(3) << "Greate_equal op do not support bool datatype";
VLOG(3) << "Greater_equal op do not support bool datatype";
return false;
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions paddle/phi/kernels/cpu/i0e_grad_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ void I0eGradKernel(const Context& ctx,
auto* x_data = x.data<T>();
auto* out_data = out.data<T>();
auto* out_grad_data = out_grad.data<T>();
auto* x_gard_data = ctx.template Alloc<T>(x_grad);
auto* x_grad_data = ctx.template Alloc<T>(x_grad);

phi::funcs::ForRange<Context> for_range(ctx, size);
I0eGradFunctor<T> functor(x_data, out_data, out_grad_data, x_gard_data, size);
I0eGradFunctor<T> functor(x_data, out_data, out_grad_data, x_grad_data, size);
for_range(functor);
}

Expand Down
4 changes: 2 additions & 2 deletions paddle/phi/kernels/cpu/polygamma_grad_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ void PolygammaGradKernel(const Context& ctx,
auto size = x.numel();
auto* x_data = x.data<T>();
auto* out_grad_data = out_grad.data<T>();
auto* x_gard_data = ctx.template Alloc<T>(x_grad);
auto* x_grad_data = ctx.template Alloc<T>(x_grad);

phi::funcs::ForRange<Context> for_range(ctx, size);
PolygammaGradFunctor<T> functor(
x_data, n + 1, out_grad_data, x_gard_data, size);
x_data, n + 1, out_grad_data, x_grad_data, size);
for_range(functor);
}

Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/kernels/funcs/sparse/softmax.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ std::tuple<DenseTensor, DenseTensor, DenseTensor, DenseTensor> ComputePoolMax(

DenseTensor pool_sizes = phi::Empty<IntT>(dev_ctx, {nnz});

/* reduce the elements which are groupped by pool index,
/* reduce the elements which are grouped by pool index,
returns all the pool indexes with unique offset value for each. */
auto new_end =
thrust::reduce_by_key(policy,
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/distributed/ps/utils/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ def block_append_op(program, origin_program, block, op):
new_op_desc.copy_from(op_desc)
new_op_desc._set_attr(RPC_OP_ROLE_ATTR_NAME, backward)

# set device gard
# set device grad
if op.desc.has_attr(device_attr_name):
op_device = op_desc.attr(device_attr_name)
new_op_desc._set_attr(device_attr_name, op_device)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,7 @@ def block_append_op(program, origin_program, block, op):
new_op_desc.copy_from(op_desc)
new_op_desc._set_attr(op_role_attr_name, backward)

# set device gard
# set device grad
if op.desc.has_attr(device_attr_name):
op_device = op_desc.attr(device_attr_name)
new_op_desc._set_attr(device_attr_name, op_device)
Expand Down
2 changes: 1 addition & 1 deletion test/legacy_test/test_adaptive_log_softmax_with_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def test_dim_error(self):
y = paddle.randint(low=0, high=20, shape=[128, 1])
_ = model(x, y)

def test_gard(self):
def test_grad(self):
n_classes = 4
in_features = 8
cutoffs = [2]
Expand Down
6 changes: 3 additions & 3 deletions test/legacy_test/test_quantile_and_nanquantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ def test_interpolation(self):
)

def test_backward(self):
def check_grad(x, q, axis, target_gard, apis=None):
def check_grad(x, q, axis, target_grad, apis=None):
x = np.array(x, dtype="float32")
paddle.disable_static()
for op, _ in apis or API_list:
x_p = paddle.to_tensor(x, dtype="float32", stop_gradient=False)
op(x_p, q, axis).sum().backward()
np.testing.assert_allclose(
x_p.grad.numpy(),
np.array(target_gard, dtype="float32"),
np.array(target_grad, dtype="float32"),
rtol=1e-05,
equal_nan=True,
)
Expand Down Expand Up @@ -178,7 +178,7 @@ def check_grad(x, q, axis, target_gard, apis=None):
)[0]
np.testing.assert_allclose(
o,
np.array(target_gard, dtype="float32"),
np.array(target_grad, dtype="float32"),
rtol=1e-05,
equal_nan=True,
)
Expand Down
Loading