已合并
修复pooling作用域 #2512
修复pooling作用域 #2512
已合并
胡一航创建于 3月10日
共 10 个文件变更+18-30
@@ -37,6 +37,7 @@
37#include "aclnn_kernels/common/op_error_check.h"37#include "aclnn_kernels/common/op_error_check.h"
38#include "pooling/pool_3d_common/op_api/pool_3d_util.h"38#include "pooling/pool_3d_common/op_api/pool_3d_util.h"
39using namespace op;39using namespace op;
40+using namespace Pool3DCommon;
40#ifdef __cplusplus41#ifdef __cplusplus
41extern "C" {42extern "C" {
42#endif43#endif
@@ -20,6 +20,8 @@
20#include "pooling/pool_3d_common/op_api/pool_3d_util.h"20#include "pooling/pool_3d_common/op_api/pool_3d_util.h"
21#include "adaptive_max_pool_common.h"21#include "adaptive_max_pool_common.h"
22using namespace op;22using namespace op;
23+using namespace AdaptiveMaxPoolCommon;
24+using namespace Pool3DCommon;
23#ifdef __cplusplus25#ifdef __cplusplus
24extern "C" {26extern "C" {
25#endif27#endif
@@ -20,6 +20,8 @@
20#include "pooling/pool_3d_common/op_api/pool_3d_util.h"20#include "pooling/pool_3d_common/op_api/pool_3d_util.h"
21#include "adaptive_max_pool_common.h"21#include "adaptive_max_pool_common.h"
22using namespace op;22using namespace op;
23+using namespace AdaptiveMaxPoolCommon;
24+using namespace Pool3DCommon;
23#ifdef __cplusplus25#ifdef __cplusplus
24extern "C" {26extern "C" {
25#endif27#endif
@@ -27,10 +27,7 @@
27#include "adaptive_max_pool_common.h"27#include "adaptive_max_pool_common.h"
28using namespace op;28using namespace op;
29 29 
30-#ifdef __cplusplus30+namespace AdaptiveMaxPoolCommon {
31-extern "C" {
32-#endif
33- 
34static const std::initializer_list<DataType> NULL_DTYPE_SUPPORT_LIST = {};31static const std::initializer_list<DataType> NULL_DTYPE_SUPPORT_LIST = {};
35static const std::initializer_list<DataType> GRAD_DTYPE_SUPPORT_LIST = {32static const std::initializer_list<DataType> GRAD_DTYPE_SUPPORT_LIST = {
36 DataType::DT_BF16, DataType::DT_FLOAT16, DataType::DT_FLOAT};33 DataType::DT_BF16, DataType::DT_FLOAT16, DataType::DT_FLOAT};
@@ -57,8 +54,7 @@ bool CheckNotNullPtr(
57 OP_CHECK_NULL(gradInput, return false);54 OP_CHECK_NULL(gradInput, return false);
58 return true;55 return true;
59}56}
60- 57+const std::initializer_list<op::DataType> GetDtypeSupportListBySocVersion()
61-static const std::initializer_list<op::DataType> GetDtypeSupportListBySocVersion()
62{58{
63 auto socVersion = GetCurrentPlatformInfo().GetSocVersion();59 auto socVersion = GetCurrentPlatformInfo().GetSocVersion();
64 switch (socVersion) {60 switch (socVersion) {
@@ -107,7 +103,7 @@ bool CheckShapeSame(
107 return true;103 return true;
108}104}
109 105 
110-static bool CheckDtypeValid(106+bool CheckDtypeValid(
111 const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, const aclTensor* gradInput)107 const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, const aclTensor* gradInput)
112{108{
113 OP_CHECK_DTYPE_NOT_SAME(self, gradOutput, return false);109 OP_CHECK_DTYPE_NOT_SAME(self, gradOutput, return false);
@@ -183,7 +179,5 @@ const aclTensor* selectLevelZeroOperation(
183 179 
184 return nullptr;180 return nullptr;
185}181}
186- 
187-#ifdef __cplusplus
188}182}
189-#endif183+ 
@@ -16,17 +16,13 @@
16#include "opdev/make_op_executor.h"16#include "opdev/make_op_executor.h"
17#include "opdev/framework_op.h"17#include "opdev/framework_op.h"
18 18 
19-#ifdef __cplusplus19+namespace AdaptiveMaxPoolCommon {
20-extern "C" {
21-#endif
22bool CheckNotNullPtr(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, aclTensor* gradInput);20bool CheckNotNullPtr(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, aclTensor* gradInput);
23-static const std::initializer_list<op::DataType> GetDtypeSupportListBySocVersion();21+const std::initializer_list<op::DataType> GetDtypeSupportListBySocVersion();
24bool CheckShapeSame(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, const aclTensor* gradInput);22bool CheckShapeSame(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, const aclTensor* gradInput);
25-static bool CheckDtypeValid(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, const aclTensor* gradInput);23+bool CheckDtypeValid(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, const aclTensor* gradInput);
26aclnnStatus CheckParams(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, aclTensor* gradInput);24aclnnStatus CheckParams(const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, aclTensor* gradInput);
27const aclTensor* selectLevelZeroOperation(25const aclTensor* selectLevelZeroOperation(
28 const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, aclTensor* /* gradInput */,26 const aclTensor* gradOutput, const aclTensor* self, const aclTensor* indices, aclTensor* /* gradInput */,
29 aclOpExecutor* executor);27 aclOpExecutor* executor);
30-#ifdef __cplusplus
31}28}
32-#endif
@@ -46,6 +46,7 @@
46#include "pooling/pool_3d_common/op_api/pool_3d_util.h"46#include "pooling/pool_3d_common/op_api/pool_3d_util.h"
47using namespace avgpool2d_conv2d_input_util;47using namespace avgpool2d_conv2d_input_util;
48using namespace op;48using namespace op;
49+using namespace Pool3DCommon;
49namespace op {50namespace op {
50static aclnnStatus CheckArrayDataAvgPoolBackWard(51static aclnnStatus CheckArrayDataAvgPoolBackWard(
51 const aclIntArray* kernelSize, const aclIntArray* stride, const aclIntArray* padding)52 const aclIntArray* kernelSize, const aclIntArray* stride, const aclIntArray* padding)
@@ -27,7 +27,7 @@
27#include "opdev/platform.h"27#include "opdev/platform.h"
28#include "op_api/aclnn_util.h"28#include "op_api/aclnn_util.h"
29#include "pooling/pool_3d_common/op_api/pool_3d_util.h"29#include "pooling/pool_3d_common/op_api/pool_3d_util.h"
30- 30+using namespace Pool3DCommon;
31using namespace op;31using namespace op;
32#ifdef __cplusplus32#ifdef __cplusplus
33extern "C" {33extern "C" {
@@ -25,7 +25,7 @@
25#include "opdev/framework_op.h"25#include "opdev/framework_op.h"
26#include "op_api/aclnn_util.h"26#include "op_api/aclnn_util.h"
27#include "pooling/pool_3d_common/op_api/pool_3d_util.h"27#include "pooling/pool_3d_common/op_api/pool_3d_util.h"
28- 28+using namespace Pool3DCommon;
29using namespace op;29using namespace op;
30#ifdef __cplusplus30#ifdef __cplusplus
31extern "C" {31extern "C" {
@@ -22,9 +22,7 @@
22#include "opdev/platform.h"22#include "opdev/platform.h"
23#include "pool_3d_util.h"23#include "pool_3d_util.h"
24 24 
25-#ifdef __cplusplus25+namespace Pool3DCommon {
26-extern "C" {
27-#endif
28const aclTensor* View3Das5D(const aclTensor* input, aclOpExecutor* executor)26const aclTensor* View3Das5D(const aclTensor* input, aclOpExecutor* executor)
29{27{
30 // CHW -> unsqueeze -> reformat -> NCDHW28 // CHW -> unsqueeze -> reformat -> NCDHW
@@ -128,6 +126,4 @@ const aclTensor* View5DasCDHW(const aclTensor* input, const op::Format& format,
128 return reformatInput; 126 return reformatInput;
129 }127 }
130 128 
131-#ifdef __cplusplus
132}129}
133-#endif
@@ -15,10 +15,7 @@
15#include "opdev/platform.h"15#include "opdev/platform.h"
16#include "opdev/format_utils.h"16#include "opdev/format_utils.h"
17 17 
18-#ifdef __cplusplus18+namespace Pool3DCommon {
19-extern "C" {
20-#endif
21- 
22const aclTensor* View3Das5D(const aclTensor* input, aclOpExecutor* executor);19const aclTensor* View3Das5D(const aclTensor* input, aclOpExecutor* executor);
23const aclTensor* View4Das5D(const aclTensor* input, aclOpExecutor* executor);20const aclTensor* View4Das5D(const aclTensor* input, aclOpExecutor* executor);
24const aclTensor* View5Das3D(const aclTensor* input, const op::Format& format, aclOpExecutor* executor);21const aclTensor* View5Das3D(const aclTensor* input, const op::Format& format, aclOpExecutor* executor);
@@ -26,8 +23,7 @@ const aclTensor* View5Das4D(const aclTensor* input, const op::Format& format, ac
26const aclTensor* View3Das4D(const aclTensor* input, aclOpExecutor* executor);23const aclTensor* View3Das4D(const aclTensor* input, aclOpExecutor* executor);
27const aclTensor* ViewCDHWas5D(const aclTensor* input, aclOpExecutor* executor);24const aclTensor* ViewCDHWas5D(const aclTensor* input, aclOpExecutor* executor);
28const aclTensor* View5DasCDHW(const aclTensor* input, const op::Format& format, aclOpExecutor* executor);25const aclTensor* View5DasCDHW(const aclTensor* input, const op::Format& format, aclOpExecutor* executor);
29-#ifdef __cplusplus
30}26}
31-#endif27+ 
32 28 
33#endif29#endif