@@ -65,15 +65,16 @@ class SGDOpKernel : public framework::OpKernel<T> {
65
65
auto &grad_rows = grad->rows ();
66
66
67
67
size_t grad_row_numel = grad_value.numel () / grad_rows.size ();
68
- PADDLE_ENFORCE_EQ (grad_row_numel, param_out->numel () / grad_height);
68
+ PADDLE_ENFORCE_EQ (static_cast <int64_t >(grad_row_numel),
69
+ param_out->numel () / grad_height);
69
70
70
71
auto *grad_data = grad_value.data <T>();
71
72
auto *out_data = param_out->data <T>();
72
73
auto *lr = learning_rate->data <T>();
73
74
for (size_t i = 0 ; i < grad_rows.size (); i++) {
74
75
PADDLE_ENFORCE (grad_rows[i] < grad_height,
75
76
" Input rows index should less than height" );
76
- for (int64_t j = 0 ; j < grad_row_numel; j++) {
77
+ for (size_t j = 0 ; j < grad_row_numel; j++) {
77
78
out_data[grad_rows[i] * grad_row_numel + j] -=
78
79
lr[0 ] * grad_data[i * grad_row_numel + j];
79
80
}
@@ -107,7 +108,7 @@ class SGDOpKernel : public framework::OpKernel<T> {
107
108
PADDLE_ENFORCE (grad.rows ()[i] < grad.height (),
108
109
" Input rows index should less than height" );
109
110
int64_t id_index = param.index (grad.rows ()[i]);
110
- for (int64_t j = 0 ; j < grad_row_width; j++) {
111
+ for (size_t j = 0 ; j < grad_row_width; j++) {
111
112
out_data[id_index * grad_row_width + j] -=
112
113
lr[0 ] * grad_data[i * grad_row_width + j];
113
114
}
0 commit comments