Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] NO.33 enable bugprone-inaccurate-erase #61589

Merged
merged 1 commit into from
Feb 20, 2024
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
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bugprone-copy-constructor-init,
bugprone-exception-escape,
-bugprone-fold-init-type,
-bugprone-forwarding-reference-overload,
-bugprone-inaccurate-erase,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
-bugprone-infinite-loop,
bugprone-integer-division,
Expand Down
15 changes: 10 additions & 5 deletions paddle/phi/kernels/funcs/jit/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ void TestKernelLSTM() {
VLOG(10) << "Test JITKernel: " << jit::to_string(KernelTuple::kernel_type);
std::vector<std::string> all_acts = {"sigmoid", "tanh", "relu", "identity"};
auto test_sizes = TestSizes();
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000));
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000),
test_sizes.end());
for (int d : test_sizes) {
for (bool use_peephole : {true, false}) {
for (auto& act_gate : all_acts) {
Expand Down Expand Up @@ -331,7 +332,8 @@ void TestKernelGRU() {
VLOG(10) << "Test JITKernel: " << jit::to_string(KernelTuple::kernel_type);
std::vector<std::string> all_acts = {"sigmoid", "tanh", "relu", "identity"};
auto test_sizes = TestSizes();
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000));
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000),
test_sizes.end());
for (int d : test_sizes) {
for (auto& act_gate : all_acts) {
for (auto& act_cand : all_acts) {
Expand Down Expand Up @@ -491,7 +493,8 @@ void TestKernelCRFDecoding() {
VLOG(10) << "Test JITKernel: " << jit::to_string(KernelTuple::kernel_type);
constexpr int state_trans_base_idx = 2;
auto test_sizes = TestSizes();
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 2000));
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 2000),
test_sizes.end());
for (int seq_len : {1, 11, 17, 50}) {
for (int tag_num : test_sizes) {
auto ref = jit::GetReferFunc<KernelTuple>();
Expand Down Expand Up @@ -550,7 +553,8 @@ void TestKernelSeqPool() {
std::vector<jit::SeqPoolType> pool_types = {
jit::SeqPoolType::kSum, jit::SeqPoolType::kAvg, jit::SeqPoolType::kSqrt};
auto test_sizes = TestSizes();
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000));
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000),
test_sizes.end());
for (auto type : pool_types) {
for (int w : test_sizes) {
jit::seq_pool_attr_t attr(w, type);
Expand Down Expand Up @@ -592,7 +596,8 @@ void TestKernelEmbSeqPool() {
std::vector<jit::SeqPoolType> pool_types = {
jit::SeqPoolType::kSum}; // only support sum yet
auto test_sizes = TestSizes();
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000));
test_sizes.erase(std::remove(test_sizes.begin(), test_sizes.end(), 1000),
test_sizes.end());
for (int tbl_w : test_sizes) {
std::vector<T> table(tbl_h * tbl_w);
RandomVec<T>(tbl_h * tbl_w, table.data());
Expand Down