未验证 提交 ae428a0a 编写于 作者: engineer1109's avatar engineer1109 提交者: GitHub

fix -Werror=maybe-uninitialized (#51608)

上级 e34c79c7
...@@ -361,7 +361,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> { ...@@ -361,7 +361,7 @@ class MultiClassNMSKernel : public framework::OpKernel<T> {
auto index = ctx.Output<phi::DenseTensor>("Index"); auto index = ctx.Output<phi::DenseTensor>("Index");
bool has_roisnum = ctx.HasInput("RoisNum") ? true : false; bool has_roisnum = ctx.HasInput("RoisNum") ? true : false;
auto rois_num = ctx.Input<phi::DenseTensor>("RoisNum"); auto rois_num = ctx.Input<phi::DenseTensor>("RoisNum");
auto score_dims = scores->dims(); auto score_dims = phi::vectorize<int>(scores->dims());
auto score_size = score_dims.size(); auto score_size = score_dims.size();
auto& dev_ctx = ctx.template device_context<phi::CPUContext>(); auto& dev_ctx = ctx.template device_context<phi::CPUContext>();
......
...@@ -153,7 +153,7 @@ class FusionRepeatedFCReluKernel : public framework::OpKernel<T> { ...@@ -153,7 +153,7 @@ class FusionRepeatedFCReluKernel : public framework::OpKernel<T> {
auto place = ctx.GetPlace(); auto place = ctx.GetPlace();
int weight_sz = static_cast<int>(weights.size()); int weight_sz = static_cast<int>(weights.size());
auto i_dims = in->dims(); auto i_dims = phi::vectorize<int>(in->dims());
const auto& w_dims = weights[0]->dims(); const auto& w_dims = weights[0]->dims();
phi::jit::matmul_attr_t attr; phi::jit::matmul_attr_t attr;
attr.m = i_dims[0]; attr.m = i_dims[0];
......
...@@ -689,7 +689,7 @@ void _sliceCompute(const phi::DenseTensor *in, ...@@ -689,7 +689,7 @@ void _sliceCompute(const phi::DenseTensor *in,
const std::vector<int> &axes, const std::vector<int> &axes,
const std::vector<int> &starts) { const std::vector<int> &starts) {
auto &eigen_place = *ctx.eigen_device(); auto &eigen_place = *ctx.eigen_device();
auto out_dims = out->dims(); auto out_dims = phi::vectorize<int>(out->dims());
auto in_dims = in->dims(); auto in_dims = in->dims();
auto offsets = Eigen::DSizes<Eigen::DenseIndex, D>(); auto offsets = Eigen::DSizes<Eigen::DenseIndex, D>();
......
...@@ -255,7 +255,7 @@ void MatrixNMSKernel(const Context& ctx, ...@@ -255,7 +255,7 @@ void MatrixNMSKernel(const Context& ctx,
DenseTensor* out, DenseTensor* out,
DenseTensor* index, DenseTensor* index,
DenseTensor* roisnum) { DenseTensor* roisnum) {
auto score_dims = scores.dims(); auto score_dims = phi::vectorize<int>(scores.dims());
auto batch_size = score_dims[0]; auto batch_size = score_dims[0];
auto num_boxes = score_dims[2]; auto num_boxes = score_dims[2];
auto box_dim = bboxes.dims()[2]; auto box_dim = bboxes.dims()[2];
......
...@@ -496,7 +496,7 @@ void MultiClassNMSKernel(const Context& ctx, ...@@ -496,7 +496,7 @@ void MultiClassNMSKernel(const Context& ctx,
DenseTensor* nms_rois_num) { DenseTensor* nms_rois_num) {
bool return_index = index != nullptr; bool return_index = index != nullptr;
bool has_roisnum = rois_num.get_ptr() != nullptr; bool has_roisnum = rois_num.get_ptr() != nullptr;
auto score_dims = scores.dims(); auto score_dims = phi::vectorize<int>(scores.dims());
auto score_size = score_dims.size(); auto score_size = score_dims.size();
std::vector<std::map<int, std::vector<int>>> all_indices; std::vector<std::map<int, std::vector<int>>> all_indices;
......
...@@ -258,7 +258,7 @@ void CooToDenseCPUKernel(const CPUContext& dev_ctx, ...@@ -258,7 +258,7 @@ void CooToDenseCPUKernel(const CPUContext& dev_ctx,
const auto dense_dims = x.dims(); const auto dense_dims = x.dims();
const auto indices = x.indices(); const auto indices = x.indices();
const auto values = x.values(); const auto values = x.values();
const auto indices_dims = indices.dims(); const auto indices_dims = phi::vectorize<int>(indices.dims());
int64_t sparse_dim = indices_dims[0]; int64_t sparse_dim = indices_dims[0];
if (indices_dims.size() == 1) { if (indices_dims.size() == 1) {
sparse_dim = 1; sparse_dim = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册