已合并
修改重复代码 #6913
fitZepHYr创建于 7月2日
修改重复代码 #6913
已合并
共 6 个文件变更+10-10
Mconv/conv3d_backprop_filter_v2/op_kernel/arch32/conv3d_backprop_filter_impl/conv_bp_config_base.h+1-1
| @@ -59,7 +59,7 @@ struct GetDstType<bfloat16_t> { | |||
| 59 | using Type = float; | 59 | using Type = float; |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | -// ConvType,定义卷积输入输出对象的属性 | 62 | +// ConvType,定义卷积输入输出对象的属性。 |
| 63 | template <TPosition POSITION, CubeFormat FORMAT, typename T> | 63 | template <TPosition POSITION, CubeFormat FORMAT, typename T> |
| 64 | struct ConvType { | 64 | struct ConvType { |
| 65 | constexpr static TPosition pos = POSITION; // Convolution输入或输出时的scope | 65 | constexpr static TPosition pos = POSITION; // Convolution输入或输出时的scope |
| @@ -26,7 +26,7 @@ static ge::graphStatus InferShapeForConv3DBackpropInputV2(gert::InferShapeContex | |||
| 26 | { | 26 | { |
| 27 | auto const_tensor = context->GetInputTensor(0); | 27 | auto const_tensor = context->GetInputTensor(0); |
| 28 | OP_CHECK_IF( | 28 | OP_CHECK_IF( |
| 29 | - const_tensor == nullptr, CUBE_INNER_ERR_REPORT(context->GetNodeName(), "get null tensor"), | 29 | + const_tensor == nullptr, CUBE_INNER_ERR_REPORT(context->GetNodeName(), "get null tensor."), |
| 30 | return ge::GRAPH_FAILED); | 30 | return ge::GRAPH_FAILED); |
| 31 | size_t const_tensor_dim_num = static_cast<size_t>(const_tensor->GetOriginShape().GetShapeSize()); | 31 | size_t const_tensor_dim_num = static_cast<size_t>(const_tensor->GetOriginShape().GetShapeSize()); |
| 32 | 32 | ||
| @@ -221,7 +221,7 @@ static bool GetConv3DPads( | |||
| 221 | if (runtime_attrs->GetAttrNum() > padding_idx) { | 221 | if (runtime_attrs->GetAttrNum() > padding_idx) { |
| 222 | const auto padding = runtime_attrs->GetAttrPointer<char>(padding_idx); | 222 | const auto padding = runtime_attrs->GetAttrPointer<char>(padding_idx); |
| 223 | if (padding != nullptr && (strcmp(padding, "SAME") == 0)) { | 223 | if (padding != nullptr && (strcmp(padding, "SAME") == 0)) { |
| 224 | - OP_LOGD(context->GetNodeName(), "get padding SAME"); | 224 | + OP_LOGD(context->GetNodeName(), "get padding SAME."); |
| 225 | int64_t tails_d = shapes.id % attrs.strd; // non zero, checked in shape range infer logic | 225 | int64_t tails_d = shapes.id % attrs.strd; // non zero, checked in shape range infer logic |
| 226 | int64_t tails_h = shapes.ih % attrs.strh; // non zero, checked in shape range infer logic | 226 | int64_t tails_h = shapes.ih % attrs.strh; // non zero, checked in shape range infer logic |
| 227 | int64_t tails_w = shapes.iw % attrs.strw; // non zero, checked in shape range infer logic | 227 | int64_t tails_w = shapes.iw % attrs.strw; // non zero, checked in shape range infer logic |
| @@ -94,8 +94,8 @@ struct AdaptiveAvgPool3dNCDHWGradSmallKernelTilingDataV35 { | |||
| 94 | int64_t normalCoreProcessNum = 0; | 94 | int64_t normalCoreProcessNum = 0; |
| 95 | int64_t tailCoreProcessNum = 0; | 95 | int64_t tailCoreProcessNum = 0; |
| 96 | int64_t usedCoreNum = 0; | 96 | int64_t usedCoreNum = 0; |
| 97 | - int64_t outputBufferSize = 0; | ||
| 98 | int64_t gradInputBufferSize = 0; | 97 | int64_t gradInputBufferSize = 0; |
| 98 | + int64_t outputBufferSize = 0; | ||
| 99 | int64_t inputQueBufferSize = 0; | 99 | int64_t inputQueBufferSize = 0; |
| 100 | int64_t transQueBufferSize = 0; | 100 | int64_t transQueBufferSize = 0; |
| 101 | int64_t transOutQueBufferSize = 0; | 101 | int64_t transOutQueBufferSize = 0; |
| @@ -131,8 +131,8 @@ __aicore__ inline void KernelAvgPool3DGradTCast<T>::ProcessAndCopyout() | |||
| 131 | SetFlag<HardEvent::V_MTE2>(this->eventIdV2Mte2); | 131 | SetFlag<HardEvent::V_MTE2>(this->eventIdV2Mte2); |
| 132 | SetFlag<HardEvent::MTE3_V>(this->eventIdMte3ToV); | 132 | SetFlag<HardEvent::MTE3_V>(this->eventIdMte3ToV); |
| 133 | for (auto index = processStart; index < processEnd; index += this->nLine) { | 133 | for (auto index = processStart; index < processEnd; index += this->nLine) { |
| 134 | - auto indexStart = index; | ||
| 135 | auto indexEnd = this->min(index + this->nLine, processEnd); | 134 | auto indexEnd = this->min(index + this->nLine, processEnd); |
| 135 | + auto indexStart = index; | ||
| 136 | WaitFlag<HardEvent::V_MTE2>(this->eventIdV2Mte2); | 136 | WaitFlag<HardEvent::V_MTE2>(this->eventIdV2Mte2); |
| 137 | WaitFlag<HardEvent::MTE3_V>(this->eventIdMte3ToV); | 137 | WaitFlag<HardEvent::MTE3_V>(this->eventIdMte3ToV); |
| 138 | for (auto i = index; i < indexEnd; ++i) { | 138 | for (auto i = index; i < indexEnd; ++i) { |
| @@ -96,16 +96,16 @@ const aclTensor* MaxPool3DGradWithArgmax( | |||
| 96 | const int64_t strideH = (strideRef.Size() == 0) ? kernelH : ((strideRef.Size() == 1) ? strideD : strideRef[1]); | 96 | const int64_t strideH = (strideRef.Size() == 0) ? kernelH : ((strideRef.Size() == 1) ? strideD : strideRef[1]); |
| 97 | const int64_t strideW = (strideRef.Size() == 0) ? kernelW : ((strideRef.Size() == 1) ? strideD : strideRef[2]); | 97 | const int64_t strideW = (strideRef.Size() == 0) ? kernelW : ((strideRef.Size() == 1) ? strideD : strideRef[2]); |
| 98 | 98 | ||
| 99 | - const aclIntArray& paddingRef = *padding; | ||
| 100 | - const int64_t paddingD = paddingRef[0]; | ||
| 101 | - const int64_t paddingH = (paddingRef.Size() == 1) ? paddingD : paddingRef[1]; | ||
| 102 | - const int64_t paddingW = (paddingRef.Size() == 1) ? paddingD : paddingRef[2]; | ||
| 103 | - | ||
| 104 | const aclIntArray& dilationRef = *dilation; | 99 | const aclIntArray& dilationRef = *dilation; |
| 105 | const int64_t dilationD = dilationRef[0]; | 100 | const int64_t dilationD = dilationRef[0]; |
| 106 | const int64_t dilationH = (dilationRef.Size() == 1) ? dilationD : dilationRef[1]; | 101 | const int64_t dilationH = (dilationRef.Size() == 1) ? dilationD : dilationRef[1]; |
| 107 | const int64_t dilationW = (dilationRef.Size() == 1) ? dilationD : dilationRef[2]; | 102 | const int64_t dilationW = (dilationRef.Size() == 1) ? dilationD : dilationRef[2]; |
| 108 | 103 | ||
| 104 | + const aclIntArray& paddingRef = *padding; | ||
| 105 | + const int64_t paddingD = paddingRef[0]; | ||
| 106 | + const int64_t paddingH = (paddingRef.Size() == 1) ? paddingD : paddingRef[1]; | ||
| 107 | + const int64_t paddingW = (paddingRef.Size() == 1) ? paddingD : paddingRef[2]; | ||
| 108 | + | ||
| 109 | FVector<int64_t> kernelSizeData{kernelD, kernelH, kernelW}; | 109 | FVector<int64_t> kernelSizeData{kernelD, kernelH, kernelW}; |
| 110 | FVector<int64_t> strideSizeData{strideD, strideH, strideW}; | 110 | FVector<int64_t> strideSizeData{strideD, strideH, strideW}; |
| 111 | FVector<int64_t> paddingSizeData{paddingD, paddingH, paddingW}; | 111 | FVector<int64_t> paddingSizeData{paddingD, paddingH, paddingW}; |