Skip to content

Commit

Permalink
[clang-tidy] NO.33 enable bugprone-inaccurate-erase (PaddlePaddle#61589
Browse files Browse the repository at this point in the history
)
  • Loading branch information
enkilee committed Feb 20, 2024
1 parent cf6e7b3 commit c64f655
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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

0 comments on commit c64f655

Please sign in to comment.