From 42ae84b5e187fd81ca84473b9a264fa0e3b00e9f Mon Sep 17 00:00:00 2001 From: zsksmhq <121339860+zsksmhq@users.noreply.github.com> Date: Tue, 16 Jan 2024 15:09:44 +0800 Subject: [PATCH] zsk/fix adapative_pool_2d (#852) * fix adapative_pool_2d --------- Co-authored-by: yangbofun --- impl/ascend/device_configs.py | 8 -------- impl/ascend/functions/pool.cpp | 15 ++++++--------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/impl/ascend/device_configs.py b/impl/ascend/device_configs.py index ceb041bd0..5da4d05a8 100755 --- a/impl/ascend/device_configs.py +++ b/impl/ascend/device_configs.py @@ -231,14 +231,6 @@ 'adaptive_avg_pool2d': dict( name=['adaptive_avg_pool2d'], atol=2e-2, - tensor_para=dict( - args=[ - { - "ins": ['input'], - "shape": [Skip((3,16,8)), Skip((4,16,12)), Skip((2,144,65,65))], - }, - ] - ), ), 'adaptive_max_pool2d': dict( diff --git a/impl/ascend/functions/pool.cpp b/impl/ascend/functions/pool.cpp index a829798fa..708bd93a7 100644 --- a/impl/ascend/functions/pool.cpp +++ b/impl/ascend/functions/pool.cpp @@ -5,7 +5,6 @@ */ #include "../common/acloprunner.hpp" - namespace impl { namespace ascend { @@ -37,14 +36,12 @@ diopiError_t diopiAdaptiveAvgPool2dBackward(diopiContextHandle_t ctx, diopiTenso diopiMulInp(ctx, gradInput, gradOutput); return diopiSuccess; } - - AclOpRunner<1, 1>("AdaptiveAvgPool2dGrad", ctx) - .addInput(gradOutput) - .setAttr("orig_input_shape", - std::vector{ - static_cast(shape.data[0]), static_cast(shape.data[1]), static_cast(shape.data[2]), static_cast(shape.data[3])}) - .addOutput(gradInput) - .run(); + std::vector shapeVector; + shapeVector.reserve(shape.len); + for (int i = 0; i < shape.len; ++i) { + shapeVector.push_back(static_cast(shape.data[i])); + } + AclOpRunner<1, 1>("AdaptiveAvgPool2dGrad", ctx).addInput(gradOutput).setAttr("orig_input_shape", shapeVector).addOutput(gradInput).run(); return diopiSuccess; }