Skip to content

Commit

Permalink
zsk/fix adapative_pool_2d (#852)
Browse files Browse the repository at this point in the history
* fix adapative_pool_2d

---------

Co-authored-by: yangbofun <[email protected]>
  • Loading branch information
zsksmhq and yangbofun authored Jan 16, 2024
1 parent 2cc9690 commit 42ae84b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
8 changes: 0 additions & 8 deletions impl/ascend/device_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
15 changes: 6 additions & 9 deletions impl/ascend/functions/pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

#include "../common/acloprunner.hpp"

namespace impl {
namespace ascend {

Expand Down Expand Up @@ -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<int32_t>{
static_cast<int>(shape.data[0]), static_cast<int>(shape.data[1]), static_cast<int>(shape.data[2]), static_cast<int>(shape.data[3])})
.addOutput(gradInput)
.run();
std::vector<int32_t> shapeVector;
shapeVector.reserve(shape.len);
for (int i = 0; i < shape.len; ++i) {
shapeVector.push_back(static_cast<int>(shape.data[i]));
}
AclOpRunner<1, 1>("AdaptiveAvgPool2dGrad", ctx).addInput(gradOutput).setAttr("orig_input_shape", shapeVector).addOutput(gradInput).run();
return diopiSuccess;
}

Expand Down

0 comments on commit 42ae84b

Please sign in to comment.