已关闭
fix(weight_quant_preprocess): 删除 ErrMsg reason 字符串结尾多余的句号 #5126
马琦钧创建于 8月27日关闭于 8月31日
fix(weight_quant_preprocess): 删除 ErrMsg reason 字符串结尾多余的句号 #5126
已关闭
马琦钧创建于 8月27日关闭于 8月31日
共 1 个文件变更+35-35
@@ -209,13 +209,13 @@ static bool IsMMA16MXF4DataFlow(QuantContext& ctx)
209 209 
210static aclnnStatus CheckWeightNotEmpty(const QuantContext& ctx)210static aclnnStatus CheckWeightNotEmpty(const QuantContext& ctx)
211{211{
212- OP_CHECK(!ctx.weight->IsEmpty(),212+ OP_CHECK(
213- OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(213+ !ctx.weight->IsEmpty(),
214- "weight_quant_preprocess", "weight", std::to_string(ctx.weight->GetViewShape().GetShapeSize()).c_str(),214+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(
215- (std::string("weight must not be empty tensor when dataFlow is ") +215+ "weight_quant_preprocess", "weight", std::to_string(ctx.weight->GetViewShape().GetShapeSize()).c_str(),
216- QuantDataFlowToString(ctx.dataFlow) + ".")216+ (std::string("weight must not be empty tensor when dataFlow is ") + QuantDataFlowToString(ctx.dataFlow))
217- .c_str()),217+ .c_str()),
218- return ACLNN_ERR_PARAM_INVALID);218+ return ACLNN_ERR_PARAM_INVALID);
219 return ACLNN_SUCCESS;219 return ACLNN_SUCCESS;
220}220}
221 221 
@@ -286,7 +286,7 @@ static aclnnStatus CheckWeightPackingDimEven(const QuantContext& ctx)
286 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(286 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(
287 "weight_quant_preprocess", "weight", op::ToString(viewShape).GetString(),287 "weight_quant_preprocess", "weight", op::ToString(viewShape).GetString(),
288 (std::string("the packing dim of 4-bit weight must be even when dataFlow is ") +288 (std::string("the packing dim of 4-bit weight must be even when dataFlow is ") +
289- QuantDataFlowToString(ctx.dataFlow) + ".")289+ QuantDataFlowToString(ctx.dataFlow))
290 .c_str()),290 .c_str()),
291 return ACLNN_ERR_PARAM_INVALID);291 return ACLNN_ERR_PARAM_INVALID);
292 292 
@@ -337,7 +337,7 @@ static aclnnStatus CheckWeightScaleNotEmpty(const QuantContext& ctx)
337 "weight_quant_preprocess", "weightScale",337 "weight_quant_preprocess", "weightScale",
338 std::to_string(ctx.weightScale->GetViewShape().GetShapeSize()).c_str(),338 std::to_string(ctx.weightScale->GetViewShape().GetShapeSize()).c_str(),
339 (std::string("weightScale must not be empty tensor when dataFlow is ") +339 (std::string("weightScale must not be empty tensor when dataFlow is ") +
340- QuantDataFlowToString(ctx.dataFlow) + ".")340+ QuantDataFlowToString(ctx.dataFlow))
341 .c_str()),341 .c_str()),
342 return ACLNN_ERR_PARAM_INVALID);342 return ACLNN_ERR_PARAM_INVALID);
343 return ACLNN_SUCCESS;343 return ACLNN_SUCCESS;
@@ -377,7 +377,7 @@ static aclnnStatus CheckWeightScaleMx(const QuantContext& ctx)
377 (op::ToString(scaleViewShape).GetString() + std::string(", ") + op::ToString(weightViewShape).GetString())377 (op::ToString(scaleViewShape).GetString() + std::string(", ") + op::ToString(weightViewShape).GetString())
378 .c_str(),378 .c_str(),
379 (std::string("weightScale last three dims must be {ceildiv(K,64), N, 2} when dataFlow is ") +379 (std::string("weightScale last three dims must be {ceildiv(K,64), N, 2} when dataFlow is ") +
380- QuantDataFlowToString(ctx.dataFlow) + ".")380+ QuantDataFlowToString(ctx.dataFlow))
381 .c_str()),381 .c_str()),
382 return ACLNN_ERR_PARAM_INVALID);382 return ACLNN_ERR_PARAM_INVALID);
383 return ACLNN_SUCCESS;383 return ACLNN_SUCCESS;
@@ -431,7 +431,7 @@ static aclnnStatus CheckWeightScalePerTensorViewShape(const QuantContext& ctx)
431 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(431 OP_LOGE_FOR_INVALID_SHAPES_WITH_REASON(
432 "weight_quant_preprocess", "weightScale", op::ToString(scaleViewShape).GetString(),432 "weight_quant_preprocess", "weightScale", op::ToString(scaleViewShape).GetString(),
433 (std::string("weightScale must contain exactly one element when dataFlow is ") +433 (std::string("weightScale must contain exactly one element when dataFlow is ") +
434- QuantDataFlowToString(ctx.dataFlow) + ".")434+ QuantDataFlowToString(ctx.dataFlow))
435 .c_str()),435 .c_str()),
436 return ACLNN_ERR_PARAM_INVALID);436 return ACLNN_ERR_PARAM_INVALID);
437 return ACLNN_SUCCESS;437 return ACLNN_SUCCESS;
@@ -482,7 +482,7 @@ static aclnnStatus CheckWeightOffsetOptionalNotEmpty(const QuantContext& ctx)
482 "weight_quant_preprocess", "weightOffsetOptional",482 "weight_quant_preprocess", "weightOffsetOptional",
483 std::to_string(ctx.weightOffsetOptional->GetViewShape().GetShapeSize()).c_str(),483 std::to_string(ctx.weightOffsetOptional->GetViewShape().GetShapeSize()).c_str(),
484 (std::string("weightOffsetOptional must not be empty tensor when dataFlow is ") +484 (std::string("weightOffsetOptional must not be empty tensor when dataFlow is ") +
485- QuantDataFlowToString(ctx.dataFlow) + ".")485+ QuantDataFlowToString(ctx.dataFlow))
486 .c_str()),486 .c_str()),
487 return ACLNN_ERR_PARAM_INVALID);487 return ACLNN_ERR_PARAM_INVALID);
488 return ACLNN_SUCCESS;488 return ACLNN_SUCCESS;
@@ -514,7 +514,7 @@ static aclnnStatus CheckWeightOffsetOptionalDtypeSameAsScale(const QuantContext&
514 "weight_quant_preprocess", "weightOffsetOptional, weightScale",514 "weight_quant_preprocess", "weightOffsetOptional, weightScale",
515 (op::ToString(offsetDtype).GetString() + std::string(", ") + op::ToString(scaleDtype).GetString()).c_str(),515 (op::ToString(offsetDtype).GetString() + std::string(", ") + op::ToString(scaleDtype).GetString()).c_str(),
516 (std::string("weightOffsetOptional and weightScale must have the same dtype when dataFlow is ") +516 (std::string("weightOffsetOptional and weightScale must have the same dtype when dataFlow is ") +
517- QuantDataFlowToString(ctx.dataFlow) + ".")517+ QuantDataFlowToString(ctx.dataFlow))
518 .c_str()),518 .c_str()),
519 return ACLNN_ERR_PARAM_INVALID);519 return ACLNN_ERR_PARAM_INVALID);
520 return ACLNN_SUCCESS;520 return ACLNN_SUCCESS;
@@ -534,7 +534,7 @@ static aclnnStatus CheckWeightOffsetOptionalViewShapeSameAsScale(const QuantCont
534 (op::ToString(offsetViewShape).GetString() + std::string(", ") + op::ToString(scaleViewShape).GetString())534 (op::ToString(offsetViewShape).GetString() + std::string(", ") + op::ToString(scaleViewShape).GetString())
535 .c_str(),535 .c_str(),
536 (std::string("weightOffsetOptional and weightScale must have the same viewShape when dataFlow is ") +536 (std::string("weightOffsetOptional and weightScale must have the same viewShape when dataFlow is ") +
537- QuantDataFlowToString(ctx.dataFlow) + ".")537+ QuantDataFlowToString(ctx.dataFlow))
538 .c_str()),538 .c_str()),
539 return ACLNN_ERR_PARAM_INVALID);539 return ACLNN_ERR_PARAM_INVALID);
540 return ACLNN_SUCCESS;540 return ACLNN_SUCCESS;
@@ -550,7 +550,7 @@ static aclnnStatus CheckBiasOptionalNotEmpty(const QuantContext& ctx)
550 "weight_quant_preprocess", "biasOptional",550 "weight_quant_preprocess", "biasOptional",
551 std::to_string(ctx.biasOptional->GetViewShape().GetShapeSize()).c_str(),551 std::to_string(ctx.biasOptional->GetViewShape().GetShapeSize()).c_str(),
552 (std::string("biasOptional must not be empty tensor when dataFlow is ") +552 (std::string("biasOptional must not be empty tensor when dataFlow is ") +
553- QuantDataFlowToString(ctx.dataFlow) + ".")553+ QuantDataFlowToString(ctx.dataFlow))
554 .c_str()),554 .c_str()),
555 return ACLNN_ERR_PARAM_INVALID);555 return ACLNN_ERR_PARAM_INVALID);
556 return ACLNN_SUCCESS;556 return ACLNN_SUCCESS;
@@ -694,11 +694,11 @@ static aclnnStatus CheckOutWeightNotNullEmpty(const QuantContext& ctx)
694 return ACLNN_ERR_PARAM_NULLPTR);694 return ACLNN_ERR_PARAM_NULLPTR);
695 OP_CHECK(695 OP_CHECK(
696 !ctx.outWeight->IsEmpty(),696 !ctx.outWeight->IsEmpty(),
697- OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON("weight_quant_preprocess", "outWeight",697+ OP_LOGE_FOR_INVALID_SHAPESIZE_WITH_REASON(
698- std::to_string(ctx.outWeight->GetViewShape().GetShapeSize()).c_str(),698+ "weight_quant_preprocess", "outWeight",
699- (std::string("outWeight must not be empty tensor when dataFlow is ") +699+ std::to_string(ctx.outWeight->GetViewShape().GetShapeSize()).c_str(),
700- QuantDataFlowToString(ctx.dataFlow) + ".")700+ (std::string("outWeight must not be empty tensor when dataFlow is ") + QuantDataFlowToString(ctx.dataFlow))
701- .c_str()),701+ .c_str()),
702 return ACLNN_ERR_PARAM_INVALID);702 return ACLNN_ERR_PARAM_INVALID);
703 return ACLNN_SUCCESS;703 return ACLNN_SUCCESS;
704}704}
@@ -723,7 +723,7 @@ static aclnnStatus CheckOutWeightDtypeSame(const QuantContext& ctx)
723 (op::ToString(outWeightDtype).GetString() + std::string(", ") + op::ToString(weightDtype).GetString())723 (op::ToString(outWeightDtype).GetString() + std::string(", ") + op::ToString(weightDtype).GetString())
724 .c_str(),724 .c_str(),
725 (std::string("outWeight and weight must have the same dtype when dataFlow is ") +725 (std::string("outWeight and weight must have the same dtype when dataFlow is ") +
726- QuantDataFlowToString(ctx.dataFlow) + ".")726+ QuantDataFlowToString(ctx.dataFlow))
727 .c_str()),727 .c_str()),
728 return ACLNN_ERR_PARAM_INVALID);728 return ACLNN_ERR_PARAM_INVALID);
729 return ACLNN_SUCCESS;729 return ACLNN_SUCCESS;
@@ -740,7 +740,7 @@ static aclnnStatus CheckOutWeightViewShapeSame(const QuantContext& ctx)
740 (op::ToString(outViewShape).GetString() + std::string(", ") + op::ToString(weightViewShape).GetString())740 (op::ToString(outViewShape).GetString() + std::string(", ") + op::ToString(weightViewShape).GetString())
741 .c_str(),741 .c_str(),
742 (std::string("outWeight and weight must have the same viewShape when dataFlow is ") +742 (std::string("outWeight and weight must have the same viewShape when dataFlow is ") +
743- QuantDataFlowToString(ctx.dataFlow) + ".")743+ QuantDataFlowToString(ctx.dataFlow))
744 .c_str()),744 .c_str()),
745 return ACLNN_ERR_PARAM_INVALID);745 return ACLNN_ERR_PARAM_INVALID);
746 return ACLNN_SUCCESS;746 return ACLNN_SUCCESS;
@@ -794,7 +794,7 @@ static aclnnStatus CheckOutWeightTransNz(const QuantContext& ctx)
794 (op::ToString(outStorageShape).GetString() + std::string(", ") + op::ToString(weightViewShape).GetString())794 (op::ToString(outStorageShape).GetString() + std::string(", ") + op::ToString(weightViewShape).GetString())
795 .c_str(),795 .c_str(),
796 (std::string("outWeight storage shape last four dims must be ") + layoutDesc +796 (std::string("outWeight storage shape last four dims must be ") + layoutDesc +
797- std::string(" when dataFlow is ") + QuantDataFlowToString(ctx.dataFlow) + ".")797+ std::string(" when dataFlow is ") + QuantDataFlowToString(ctx.dataFlow))
798 .c_str()),798 .c_str()),
799 return ACLNN_ERR_PARAM_INVALID);799 return ACLNN_ERR_PARAM_INVALID);
800 800 
@@ -811,7 +811,7 @@ static aclnnStatus CheckOutWeightScaleNotNullEmpty(const QuantContext& ctx)
811 "weight_quant_preprocess", "outWeightScale",811 "weight_quant_preprocess", "outWeightScale",
812 std::to_string(ctx.outWeightScale->GetViewShape().GetShapeSize()).c_str(),812 std::to_string(ctx.outWeightScale->GetViewShape().GetShapeSize()).c_str(),
813 (std::string("outWeightScale must not be empty tensor when dataFlow is ") +813 (std::string("outWeightScale must not be empty tensor when dataFlow is ") +
814- QuantDataFlowToString(ctx.dataFlow) + ".")814+ QuantDataFlowToString(ctx.dataFlow))
815 .c_str()),815 .c_str()),
816 return ACLNN_ERR_PARAM_INVALID);816 return ACLNN_ERR_PARAM_INVALID);
817 return ACLNN_SUCCESS;817 return ACLNN_SUCCESS;
@@ -838,7 +838,7 @@ static aclnnStatus CheckOutWeightScaleDtypeSame(const QuantContext& ctx)
838 (op::ToString(outScaleDtype).GetString() + std::string(", ") + op::ToString(scaleDtype).GetString())838 (op::ToString(outScaleDtype).GetString() + std::string(", ") + op::ToString(scaleDtype).GetString())
839 .c_str(),839 .c_str(),
840 (std::string("outWeightScale and weightScale must have the same dtype when dataFlow is ") +840 (std::string("outWeightScale and weightScale must have the same dtype when dataFlow is ") +
841- QuantDataFlowToString(ctx.dataFlow) + ".")841+ QuantDataFlowToString(ctx.dataFlow))
842 .c_str()),842 .c_str()),
843 return ACLNN_ERR_PARAM_INVALID);843 return ACLNN_ERR_PARAM_INVALID);
844 return ACLNN_SUCCESS;844 return ACLNN_SUCCESS;
@@ -855,7 +855,7 @@ static aclnnStatus CheckOutWeightScaleViewShapeSame(const QuantContext& ctx)
855 (op::ToString(outScaleViewShape).GetString() + std::string(", ") + op::ToString(scaleViewShape).GetString())855 (op::ToString(outScaleViewShape).GetString() + std::string(", ") + op::ToString(scaleViewShape).GetString())
856 .c_str(),856 .c_str(),
857 (std::string("outWeightScale and weightScale must have the same viewShape when dataFlow is ") +857 (std::string("outWeightScale and weightScale must have the same viewShape when dataFlow is ") +
858- QuantDataFlowToString(ctx.dataFlow) + ".")858+ QuantDataFlowToString(ctx.dataFlow))
859 .c_str()),859 .c_str()),
860 return ACLNN_ERR_PARAM_INVALID);860 return ACLNN_ERR_PARAM_INVALID);
861 return ACLNN_SUCCESS;861 return ACLNN_SUCCESS;
@@ -872,7 +872,7 @@ static aclnnStatus CheckOutWeightScaleStorageShapeSame(const QuantContext& ctx)
872 op::ToString(scaleStorageShape).GetString())872 op::ToString(scaleStorageShape).GetString())
873 .c_str(),873 .c_str(),
874 (std::string("outWeightScale and weightScale must have the same storageShape when dataFlow is ") +874 (std::string("outWeightScale and weightScale must have the same storageShape when dataFlow is ") +
875- QuantDataFlowToString(ctx.dataFlow) + ".")875+ QuantDataFlowToString(ctx.dataFlow))
876 .c_str()),876 .c_str()),
877 return ACLNN_ERR_PARAM_INVALID);877 return ACLNN_ERR_PARAM_INVALID);
878 return ACLNN_SUCCESS;878 return ACLNN_SUCCESS;
@@ -892,7 +892,7 @@ static aclnnStatus CheckOutBiasOptionalNotNullEmpty(const QuantContext& ctx)
892 "weight_quant_preprocess", "outBiasOptional",892 "weight_quant_preprocess", "outBiasOptional",
893 std::to_string(ctx.outBiasOptional->GetViewShape().GetShapeSize()).c_str(),893 std::to_string(ctx.outBiasOptional->GetViewShape().GetShapeSize()).c_str(),
894 (std::string("outBiasOptional must not be empty tensor when dataFlow is ") +894 (std::string("outBiasOptional must not be empty tensor when dataFlow is ") +
895- QuantDataFlowToString(ctx.dataFlow) + ".")895+ QuantDataFlowToString(ctx.dataFlow))
896 .c_str()),896 .c_str()),
897 return ACLNN_ERR_PARAM_INVALID);897 return ACLNN_ERR_PARAM_INVALID);
898 return ACLNN_SUCCESS;898 return ACLNN_SUCCESS;
@@ -936,7 +936,7 @@ static aclnnStatus CheckOutBiasOptionalDtypeSame(const QuantContext& ctx)
936 "weight_quant_preprocess", "outBiasOptional, biasOptional",936 "weight_quant_preprocess", "outBiasOptional, biasOptional",
937 (op::ToString(outBiasDtype).GetString() + std::string(", ") + op::ToString(biasDtype).GetString()).c_str(),937 (op::ToString(outBiasDtype).GetString() + std::string(", ") + op::ToString(biasDtype).GetString()).c_str(),
938 (std::string("outBiasOptional and biasOptional must have the same dtype when dataFlow is ") +938 (std::string("outBiasOptional and biasOptional must have the same dtype when dataFlow is ") +
939- QuantDataFlowToString(ctx.dataFlow) + ".")939+ QuantDataFlowToString(ctx.dataFlow))
940 .c_str()),940 .c_str()),
941 return ACLNN_ERR_PARAM_INVALID);941 return ACLNN_ERR_PARAM_INVALID);
942 return ACLNN_SUCCESS;942 return ACLNN_SUCCESS;
@@ -956,7 +956,7 @@ static aclnnStatus CheckOutBiasOptionalViewShapeSame(const QuantContext& ctx)
956 (op::ToString(outBiasViewShape).GetString() + std::string(", ") + op::ToString(biasViewShape).GetString())956 (op::ToString(outBiasViewShape).GetString() + std::string(", ") + op::ToString(biasViewShape).GetString())
957 .c_str(),957 .c_str(),
958 (std::string("outBiasOptional and biasOptional must have the same viewShape when dataFlow is ") +958 (std::string("outBiasOptional and biasOptional must have the same viewShape when dataFlow is ") +
959- QuantDataFlowToString(ctx.dataFlow) + ".")959+ QuantDataFlowToString(ctx.dataFlow))
960 .c_str()),960 .c_str()),
961 return ACLNN_ERR_PARAM_INVALID);961 return ACLNN_ERR_PARAM_INVALID);
962 return ACLNN_SUCCESS;962 return ACLNN_SUCCESS;
@@ -976,7 +976,7 @@ static aclnnStatus CheckOutBiasOptionalStorageShapeSame(const QuantContext& ctx)
976 op::ToString(biasStorageShape).GetString())976 op::ToString(biasStorageShape).GetString())
977 .c_str(),977 .c_str(),
978 (std::string("outBiasOptional and biasOptional must have the same storageShape when dataFlow is ") +978 (std::string("outBiasOptional and biasOptional must have the same storageShape when dataFlow is ") +
979- QuantDataFlowToString(ctx.dataFlow) + ".")979+ QuantDataFlowToString(ctx.dataFlow))
980 .c_str()),980 .c_str()),
981 return ACLNN_ERR_PARAM_INVALID);981 return ACLNN_ERR_PARAM_INVALID);
982 return ACLNN_SUCCESS;982 return ACLNN_SUCCESS;
@@ -997,7 +997,7 @@ static aclnnStatus CheckOutWeightOffsetOptionalNotNullEmpty(const QuantContext&
997 "weight_quant_preprocess", "outWeightOffsetOptional",997 "weight_quant_preprocess", "outWeightOffsetOptional",
998 std::to_string(ctx.outWeightOffsetOptional->GetViewShape().GetShapeSize()).c_str(),998 std::to_string(ctx.outWeightOffsetOptional->GetViewShape().GetShapeSize()).c_str(),
999 (std::string("outWeightOffsetOptional must not be empty tensor when dataFlow is ") +999 (std::string("outWeightOffsetOptional must not be empty tensor when dataFlow is ") +
1000- QuantDataFlowToString(ctx.dataFlow) + ".")1000+ QuantDataFlowToString(ctx.dataFlow))
1001 .c_str()),1001 .c_str()),
1002 return ACLNN_ERR_PARAM_INVALID);1002 return ACLNN_ERR_PARAM_INVALID);
1003 return ACLNN_SUCCESS;1003 return ACLNN_SUCCESS;
@@ -1030,7 +1030,7 @@ static aclnnStatus CheckOutWeightOffsetOptionalDtypeSame(const QuantContext& ctx
1030 .c_str(),1030 .c_str(),
1031 (std::string("outWeightOffsetOptional and weightOffsetOptional must have the same dtype when "1031 (std::string("outWeightOffsetOptional and weightOffsetOptional must have the same dtype when "
1032 "dataFlow is ") +1032 "dataFlow is ") +
1033- QuantDataFlowToString(ctx.dataFlow) + ".")1033+ QuantDataFlowToString(ctx.dataFlow))
1034 .c_str()),1034 .c_str()),
1035 return ACLNN_ERR_PARAM_INVALID);1035 return ACLNN_ERR_PARAM_INVALID);
1036 return ACLNN_SUCCESS;1036 return ACLNN_SUCCESS;
@@ -1051,7 +1051,7 @@ static aclnnStatus CheckOutWeightOffsetOptionalViewShapeSame(const QuantContext&
1051 .c_str(),1051 .c_str(),
1052 (std::string("outWeightOffsetOptional and weightOffsetOptional must have the same viewShape when "1052 (std::string("outWeightOffsetOptional and weightOffsetOptional must have the same viewShape when "
1053 "dataFlow is ") +1053 "dataFlow is ") +
1054- QuantDataFlowToString(ctx.dataFlow) + ".")1054+ QuantDataFlowToString(ctx.dataFlow))
1055 .c_str()),1055 .c_str()),
1056 return ACLNN_ERR_PARAM_INVALID);1056 return ACLNN_ERR_PARAM_INVALID);
1057 return ACLNN_SUCCESS;1057 return ACLNN_SUCCESS;
@@ -1072,7 +1072,7 @@ static aclnnStatus CheckOutWeightOffsetOptionalStorageShapeSame(const QuantConte
1072 .c_str(),1072 .c_str(),
1073 (std::string("outWeightOffsetOptional and weightOffsetOptional must have the same storageShape when "1073 (std::string("outWeightOffsetOptional and weightOffsetOptional must have the same storageShape when "
1074 "dataFlow is ") +1074 "dataFlow is ") +
1075- QuantDataFlowToString(ctx.dataFlow) + ".")1075+ QuantDataFlowToString(ctx.dataFlow))
1076 .c_str()),1076 .c_str()),
1077 return ACLNN_ERR_PARAM_INVALID);1077 return ACLNN_ERR_PARAM_INVALID);
1078 return ACLNN_SUCCESS;1078 return ACLNN_SUCCESS;