diff --git a/paddle/phi/kernels/impl/accuracy_check_kernel_impl.h b/paddle/phi/kernels/impl/accuracy_check_kernel_impl.h index d6b9e1976a1270..4d78b934ab17b1 100644 --- a/paddle/phi/kernels/impl/accuracy_check_kernel_impl.h +++ b/paddle/phi/kernels/impl/accuracy_check_kernel_impl.h @@ -108,7 +108,7 @@ struct AccuracyCheckFunctor> { for (int i = 0; i < num; i++) { out_data[i] = true; } - bool val; + bool val = false; int res_index = -1; for (int i = 0; i < num; i++) { const phi::dtype::complex a = in_a[i], b = in_b[i]; diff --git a/paddle/phi/kernels/impl/einsum_grad_kernel_impl.h b/paddle/phi/kernels/impl/einsum_grad_kernel_impl.h index 0354e28761ab9a..8aa0c09d28ff05 100644 --- a/paddle/phi/kernels/impl/einsum_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/einsum_grad_kernel_impl.h @@ -44,7 +44,7 @@ DenseTensor PerformTileAndReduction(const Context& dev_ctx, std::vector resize_dims; std::vector recover_shape; std::vector t_shape = common::vectorize(t.dims()); - for (int i = 0; i < op_label.size(); i++) { + for (size_t i = 0; i < op_label.size(); i++) { int c = op_label[i]; if (label2type[c] == LabelType::Reduction) { repeat_times.push_back(label2shape[c]); @@ -64,7 +64,7 @@ DenseTensor PerformTileAndReduction(const Context& dev_ctx, "shape size: `%d`, but got label nums: `%d`", t_shape.size(), op_label.size())); - for (int i = 0; i < op_label.size(); i++) { + for (size_t i = 0; i < op_label.size(); i++) { int c = op_label[i]; if (label2type[c] == LabelType::Contraction && t_shape[i] != label2shape[c]) {