未验证 提交 7e56147d 编写于 作者: W Wang Xin 提交者: GitHub

fix maybe-uninitialized compiler warning in Linux (#51336)

上级 8db15a42
...@@ -154,7 +154,6 @@ if(NOT WIN32) ...@@ -154,7 +154,6 @@ if(NOT WIN32)
-Wno-error=terminate # Warning in PADDLE_ENFORCE -Wno-error=terminate # Warning in PADDLE_ENFORCE
-Wno-error=int-in-bool-context # Warning in Eigen gcc 7.2 -Wno-error=int-in-bool-context # Warning in Eigen gcc 7.2
-Wimplicit-fallthrough=0 # Warning in tinyformat.h -Wimplicit-fallthrough=0 # Warning in tinyformat.h
-Wno-error=maybe-uninitialized # Warning in Paddle-Lite
${fsanitize}) ${fsanitize})
if(WITH_IPU) if(WITH_IPU)
......
...@@ -45,8 +45,8 @@ void DeleteWeightDequantLinearOpPass::ApplyImpl(ir::Graph* graph) const { ...@@ -45,8 +45,8 @@ void DeleteWeightDequantLinearOpPass::ApplyImpl(ir::Graph* graph) const {
if (n->IsOp()) { if (n->IsOp()) {
auto* op = n->Op(); auto* op = n->Op();
if (op->Type() == "dequantize_linear") { if (op->Type() == "dequantize_linear") {
Node *weight_var_node, *dequantized_weight_var_node, *scale_var_node, Node *weight_var_node, *calcu_op_node, *while_op_node;
*calcu_op_node, *while_op_node; Node *dequantized_weight_var_node = nullptr, *scale_var_node = nullptr;
// 1. Judge whether for dequant weight and find // 1. Judge whether for dequant weight and find
// weight_var_node/scale_var_node // weight_var_node/scale_var_node
for (auto* input_node : n->inputs) { for (auto* input_node : n->inputs) {
......
...@@ -602,6 +602,9 @@ class OpConverter { ...@@ -602,6 +602,9 @@ class OpConverter {
const std::string& layer_type, const std::string& layer_type,
const std::vector<std::string>& output_tensor_names, const std::vector<std::string>& output_tensor_names,
bool test_mode = false) { bool test_mode = false) {
if (layer == nullptr) {
return;
}
size_t num_out = output_tensor_names.size(); size_t num_out = output_tensor_names.size();
std::string layer_name = layer_type + " (Output: "; std::string layer_name = layer_type + " (Output: ";
for (size_t i = 0; i < num_out; i++) { for (size_t i = 0; i < num_out; i++) {
......
...@@ -52,7 +52,7 @@ class UnaryOpConverter : public OpConverter { ...@@ -52,7 +52,7 @@ class UnaryOpConverter : public OpConverter {
nvinfer1::ITensor* input_tensor = nvinfer1::ITensor* input_tensor =
engine_->GetITensor(op_desc.Input("X")[0]); engine_->GetITensor(op_desc.Input("X")[0]);
auto op_pair = ops.find(op_type_); auto op_pair = ops.find(op_type_);
nvinfer1::ILayer* layer; nvinfer1::ILayer* layer = nullptr;
#if !IS_TRT_VERSION_GE(8500) #if !IS_TRT_VERSION_GE(8500)
nvinfer1::DataType org_type = input_tensor->getType(); nvinfer1::DataType org_type = input_tensor->getType();
bool cast = org_type == nvinfer1::DataType::kINT8 || bool cast = org_type == nvinfer1::DataType::kINT8 ||
......
...@@ -142,7 +142,7 @@ class FusedGemmEpilogueXPUGradKernel : public framework::OpKernel<T> { ...@@ -142,7 +142,7 @@ class FusedGemmEpilogueXPUGradKernel : public framework::OpKernel<T> {
(reserve_space == NULL) (reserve_space == NULL)
? (reinterpret_cast<const XPUType*>(NULL)) ? (reinterpret_cast<const XPUType*>(NULL))
: (reinterpret_cast<const XPUType*>(reserve_space->data<T>())); : (reinterpret_cast<const XPUType*>(reserve_space->data<T>()));
XPUType* d_act_input_ptr; XPUType* d_act_input_ptr = NULL;
if (activation != "none") { if (activation != "none") {
d_act_input_ptr = RAII_GUARD.alloc_l3_or_gm<XPUType>(dout->numel()); d_act_input_ptr = RAII_GUARD.alloc_l3_or_gm<XPUType>(dout->numel());
dout_fc_ptr = d_act_input_ptr; dout_fc_ptr = d_act_input_ptr;
......
...@@ -34,7 +34,7 @@ void Pad3dGradKernel(const Context& dev_ctx, ...@@ -34,7 +34,7 @@ void Pad3dGradKernel(const Context& dev_ctx,
auto* d_out = &out_grad; auto* d_out = &out_grad;
auto* d_in = x_grad; auto* d_in = x_grad;
auto d_in_dims = d_in->dims(); auto d_in_dims = vectorize<int>(d_in->dims());
const T* d_out_data = d_out->data<T>(); const T* d_out_data = d_out->data<T>();
T* d_in_data = dev_ctx.template Alloc<T>(d_in); T* d_in_data = dev_ctx.template Alloc<T>(d_in);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册