Skip to content

Commit 42ae84b

Browse files
zsksmhqyangbofun
andauthored
zsk/fix adapative_pool_2d (DeepLink-org#852)
* fix adapative_pool_2d --------- Co-authored-by: yangbofun <[email protected]>
1 parent 2cc9690 commit 42ae84b

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

impl/ascend/device_configs.py

-8
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,6 @@
231231
'adaptive_avg_pool2d': dict(
232232
name=['adaptive_avg_pool2d'],
233233
atol=2e-2,
234-
tensor_para=dict(
235-
args=[
236-
{
237-
"ins": ['input'],
238-
"shape": [Skip((3,16,8)), Skip((4,16,12)), Skip((2,144,65,65))],
239-
},
240-
]
241-
),
242234
),
243235

244236
'adaptive_max_pool2d': dict(

impl/ascend/functions/pool.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
#include "../common/acloprunner.hpp"
8-
98
namespace impl {
109
namespace ascend {
1110

@@ -37,14 +36,12 @@ diopiError_t diopiAdaptiveAvgPool2dBackward(diopiContextHandle_t ctx, diopiTenso
3736
diopiMulInp(ctx, gradInput, gradOutput);
3837
return diopiSuccess;
3938
}
40-
41-
AclOpRunner<1, 1>("AdaptiveAvgPool2dGrad", ctx)
42-
.addInput(gradOutput)
43-
.setAttr("orig_input_shape",
44-
std::vector<int32_t>{
45-
static_cast<int>(shape.data[0]), static_cast<int>(shape.data[1]), static_cast<int>(shape.data[2]), static_cast<int>(shape.data[3])})
46-
.addOutput(gradInput)
47-
.run();
39+
std::vector<int32_t> shapeVector;
40+
shapeVector.reserve(shape.len);
41+
for (int i = 0; i < shape.len; ++i) {
42+
shapeVector.push_back(static_cast<int>(shape.data[i]));
43+
}
44+
AclOpRunner<1, 1>("AdaptiveAvgPool2dGrad", ctx).addInput(gradOutput).setAttr("orig_input_shape", shapeVector).addOutput(gradInput).run();
4845
return diopiSuccess;
4946
}
5047

0 commit comments

Comments
 (0)