From 8d3265072ce9016dd2dc79f21c0a12336c022856 Mon Sep 17 00:00:00 2001 From: chenjiaoAngel Date: Thu, 14 Nov 2019 20:45:02 +0800 Subject: [PATCH] fix x8d build error on shared_ptr, test=ddevelop --- lite/kernels/npu/bridges/pool_op.cc | 3 +-- lite/kernels/npu/bridges/pool_op_test.cc | 8 +++----- lite/kernels/opencl/pool_compute_test.cc | 3 ++- lite/kernels/x86/pool_compute_test.cc | 3 ++- lite/kernels/xpu/bridges/pool_op.cc | 7 +++---- lite/kernels/xpu/bridges/pool_op_test.cc | 8 +++----- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lite/kernels/npu/bridges/pool_op.cc b/lite/kernels/npu/bridges/pool_op.cc index 1738b8467f..87fe705705 100644 --- a/lite/kernels/npu/bridges/pool_op.cc +++ b/lite/kernels/npu/bridges/pool_op.cc @@ -47,8 +47,7 @@ node_map_type PoolConverter(const std::shared_ptr pool_op, auto ksize = op_info->GetAttr>("ksize"); auto npu_window = ge::AttrValue::LIST_INT(ksize.begin(), ksize.end()); - auto padding = - *(op_info->GetAttr>>("paddings")); + auto padding = op_info->GetAttr>("paddings"); bool pads_equal = (padding[0] == padding[1]) && (padding[2] == padding[3]); if (!pads_equal) { LOG(FATAL) diff --git a/lite/kernels/npu/bridges/pool_op_test.cc b/lite/kernels/npu/bridges/pool_op_test.cc index 3e3ef5862c..298e065547 100644 --- a/lite/kernels/npu/bridges/pool_op_test.cc +++ b/lite/kernels/npu/bridges/pool_op_test.cc @@ -39,8 +39,7 @@ void pool_ref(const std::shared_ptr op) { std::vector ksize = op_info->GetAttr>("ksize"); std::vector strides = op_info->GetAttr>("strides"); - std::vector paddings = - *(op_info->GetAttr>>("paddings")); + std::vector paddings = op_info->GetAttr>("paddings"); bool exclusive = op_info->GetAttr("exclusive"); std::string pooling_type = op_info->GetAttr("pooling_type"); bool global_pooling = op_info->GetAttr("global_pooling"); @@ -164,9 +163,8 @@ void test_pool(int bs, opdesc.SetAttr("global_pooling", global_pooling); opdesc.SetAttr("exclusive", exclusive); opdesc.SetAttr("strides", std::vector({stride, stride})); - opdesc.SetAttr( - "paddings", - std::shared_ptr>({padding, padding, padding, padding})); + opdesc.SetAttr("paddings", + std::vector({padding, padding, padding, padding})); // create and convert op to NPU model, then run it on NPU auto op = CreateOp(opdesc, &scope); diff --git a/lite/kernels/opencl/pool_compute_test.cc b/lite/kernels/opencl/pool_compute_test.cc index 354f31a68b..25f0e72634 100644 --- a/lite/kernels/opencl/pool_compute_test.cc +++ b/lite/kernels/opencl/pool_compute_test.cc @@ -89,9 +89,10 @@ TEST(pool2d, compute) { param.output = &out; param.global_pooling = true; param.pooling_type = "avg"; - param.paddings = std::make_shared>({0, 0, 0, 0}); + std::vector paddings = {0, 0, 0, 0}; param.strides = std::vector{1, 1}; param.ksize = std::vector{7, 7}; + param.paddings = std::make_shared>(paddings); std::unique_ptr context(new KernelContext); context->As().InitOnce(); diff --git a/lite/kernels/x86/pool_compute_test.cc b/lite/kernels/x86/pool_compute_test.cc index be17a3deed..4ea727cedd 100644 --- a/lite/kernels/x86/pool_compute_test.cc +++ b/lite/kernels/x86/pool_compute_test.cc @@ -60,7 +60,8 @@ TEST(pool2d_x86, run_test) { param.x = &x; param.output = &out; param.strides = {2, 2}; - param.paddings = std::make_shared>({0, 0, 0, 0}); + std::vector paddings = {0, 0, 0, 0}; + param.paddings = std::make_shared>(paddings); param.ksize = {2, 2}; param.pooling_type = "max"; std::unique_ptr ctx(new KernelContext); diff --git a/lite/kernels/xpu/bridges/pool_op.cc b/lite/kernels/xpu/bridges/pool_op.cc index 4ecad2f036..fbc6a9919c 100644 --- a/lite/kernels/xpu/bridges/pool_op.cc +++ b/lite/kernels/xpu/bridges/pool_op.cc @@ -38,8 +38,7 @@ node_map_type PoolConverter(const std::shared_ptr op, auto x_var_name = op_info->Input("X").front(); auto pooling_type = op_info->GetAttr("pooling_type"); auto ceil_mode = op_info->GetAttr("ceil_mode"); - auto paddings = - op_info->GetAttr>>("paddings"); + auto paddings = op_info->GetAttr>("paddings"); auto global_pooling = op_info->GetAttr("global_pooling"); auto ksize = op_info->GetAttr>("ksize"); auto strides = op_info->GetAttr>("strides"); @@ -58,7 +57,7 @@ node_map_type PoolConverter(const std::shared_ptr op, graph_ctx->builder->CreateMaxPool2D(*input_nodes.at(x_var_name), lite::xpu::CvtShape(ksize), lite::xpu::CvtShape(strides), - lite::xpu::CvtShape(*paddings), + lite::xpu::CvtShape(paddings), "NCHW", ceil_mode)); } @@ -73,7 +72,7 @@ node_map_type PoolConverter(const std::shared_ptr op, graph_ctx->builder->CreateAvgPool2D(*input_nodes.at(x_var_name), lite::xpu::CvtShape(ksize), lite::xpu::CvtShape(strides), - lite::xpu::CvtShape(*paddings), + lite::xpu::CvtShape(paddings), "NCHW", ceil_mode, !exclusive)); diff --git a/lite/kernels/xpu/bridges/pool_op_test.cc b/lite/kernels/xpu/bridges/pool_op_test.cc index bc1ecad2cf..7efc6b464c 100644 --- a/lite/kernels/xpu/bridges/pool_op_test.cc +++ b/lite/kernels/xpu/bridges/pool_op_test.cc @@ -38,8 +38,7 @@ void pool_ref(const std::shared_ptr op) { std::vector ksize = op_info->GetAttr>("ksize"); std::vector strides = op_info->GetAttr>("strides"); - std::vector paddings = - *(op_info->GetAttr>>("paddings")); + std::vector paddings = op_info->GetAttr>("paddings"); bool exclusive = op_info->GetAttr("exclusive"); std::string pooling_type = op_info->GetAttr("pooling_type"); bool global_pooling = op_info->GetAttr("global_pooling"); @@ -163,9 +162,8 @@ void test_pool(int bs, opdesc.SetAttr("global_pooling", global_pooling); opdesc.SetAttr("exclusive", exclusive); opdesc.SetAttr("strides", std::vector({stride, stride})); - opdesc.SetAttr( - "paddings", - std::shared_ptr>({padding, padding, padding, padding})); + opdesc.SetAttr("paddings", + std::vector({padding, padding, padding, padding})); opdesc.SetAttr("ceil_mode", ceil_mode); // create and convert op to XPU model, then run it on XPU -- GitLab