Skip to content

Commit 8d3ce01

Browse files
sidgoyal78abhinavarora
authored andcommitted
Fix cpplint errors for a set of operators (#9837)
* Fix cpplint errors, round2 * Fix pointer issue
1 parent f605f64 commit 8d3ce01

22 files changed

+35
-13
lines changed

paddle/fluid/operators/ctc_align_op.cu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License. */
1515
#include <stdio.h>
1616
#include <thrust/device_vector.h>
1717
#include <thrust/host_vector.h>
18+
#include <vector>
1819
#include "paddle/fluid/operators/ctc_align_op.h"
1920

2021
namespace paddle {

paddle/fluid/operators/ctc_align_op.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License. */
1515
#pragma once
1616

1717
#include <string.h>
18+
#include <vector>
1819
#include "paddle/fluid/framework/op_registry.h"
1920
#include "paddle/fluid/operators/math/math_function.h"
2021

paddle/fluid/operators/elementwise_op.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#pragma once
16+
#include <string>
1617
#include "paddle/fluid/framework/op_registry.h"
1718
#include "paddle/fluid/framework/operator.h"
1819

@@ -106,18 +107,18 @@ information. However, the output only shares the LoD information with input $X$.
106107
protected:
107108
std::string comment_;
108109

109-
void Replace(std::string& src, std::string from, std::string to) {
110+
void Replace(std::string* src, std::string from, std::string to) {
110111
std::size_t len_from = std::strlen(from.c_str());
111112
std::size_t len_to = std::strlen(to.c_str());
112-
for (std::size_t pos = src.find(from); pos != std::string::npos;
113-
pos = src.find(from, pos + len_to)) {
114-
src.replace(pos, len_from, to);
113+
for (std::size_t pos = src->find(from); pos != std::string::npos;
114+
pos = src->find(from, pos + len_to)) {
115+
src->replace(pos, len_from, to);
115116
}
116117
}
117118

118119
void SetComment(std::string name, std::string equation) {
119-
Replace(comment_, "{name}", name);
120-
Replace(comment_, "{equation}", equation);
120+
Replace(&comment_, "{name}", name);
121+
Replace(&comment_, "{equation}", equation);
121122
}
122123
};
123124

paddle/fluid/operators/gru_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "paddle/fluid/operators/gru_op.h"
16+
#include <string>
1617

1718
namespace paddle {
1819
namespace operators {

paddle/fluid/operators/gru_op.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#pragma once
16-
16+
#include <string>
17+
#include "paddle/fluid/framework/eigen.h"
18+
#include "paddle/fluid/framework/op_registry.h"
1719
#include "paddle/fluid/operators/math/detail/activation_functions.h"
1820
#include "paddle/fluid/operators/math/gru_compute.h"
1921
#include "paddle/fluid/operators/math/math_function.h"
2022
#include "paddle/fluid/operators/math/sequence2batch.h"
2123

22-
#include "paddle/fluid/framework/eigen.h"
23-
#include "paddle/fluid/framework/op_registry.h"
24-
2524
namespace paddle {
2625
namespace operators {
2726

paddle/fluid/operators/im2sequence_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "paddle/fluid/operators/im2sequence_op.h"
16+
#include <vector>
1617

1718
namespace paddle {
1819
namespace operators {

paddle/fluid/operators/im2sequence_op.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
limitations under the License. */
1414

1515
#pragma once
16-
16+
#include <vector>
1717
#include "paddle/fluid/framework/data_layout.h"
1818
#include "paddle/fluid/framework/eigen.h"
1919
#include "paddle/fluid/framework/op_registry.h"

paddle/fluid/operators/label_smooth_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "paddle/fluid/operators/label_smooth_op.h"
16+
#include <string>
1617

1718
namespace paddle {
1819
namespace operators {

paddle/fluid/operators/linear_chain_crf_op.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class LinearChainCRFOpKernel : public framework::OpKernel<T> {
100100
auto x_row_max = EigenMatrix<T>::From(emission_row_max);
101101
x_row_max.device(place) =
102102
x.maximum(Eigen::DSizes<int, 1>(1))
103-
.reshape(Eigen::DSizes<int, 2>(int(batch_size), 1));
103+
.reshape(Eigen::DSizes<int, 2>(static_cast<int>(batch_size), 1));
104104

105105
auto x_exps = EigenMatrix<T>::From(*emission_exps);
106106
x_exps.device(place) =

paddle/fluid/operators/logical_op.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

1515
#include "paddle/fluid/operators/logical_op.h"
16+
#include <string>
1617
#include "paddle/fluid/framework/op_registry.h"
1718

1819
namespace paddle {

0 commit comments

Comments
 (0)