已合并
debug exp=1 #3534
wym_666创建于 6月25日
debug exp=1 #3534
已合并
共 1 个文件变更+4-0
| @@ -34,6 +34,7 @@ extern "C" { | |||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | const float SQRT_EXP = 0.5; | 36 | const float SQRT_EXP = 0.5; |
| 37 | +const float NOOP_EXP = 1.0; | ||
| 37 | const float SQUARE_EXP = 2.0; | 38 | const float SQUARE_EXP = 2.0; |
| 38 | const float CUBE_EXP = 3.0; | 39 | const float CUBE_EXP = 3.0; |
| 39 | const float NEGTIVE_SQRT_EXP = -0.5; | 40 | const float NEGTIVE_SQRT_EXP = -0.5; |
| @@ -433,6 +434,7 @@ aclnnStatus aclnnPowTensorScalarGetWorkspaceSize(const aclTensor *self, | |||
| 433 | selfCast->GetDataType() == op::DataType::DT_INT64 || | 434 | selfCast->GetDataType() == op::DataType::DT_INT64 || |
| 434 | selfCast->GetDataType() == op::DataType::DT_COMPLEX64 || | 435 | selfCast->GetDataType() == op::DataType::DT_COMPLEX64 || |
| 435 | selfCast->GetDataType() == op::DataType::DT_COMPLEX128))); | 436 | selfCast->GetDataType() == op::DataType::DT_COMPLEX128))); |
| 437 | + bool canNoUseOp = static_cast<float>(exponent->ToFloat()) == NOOP_EXP && !IsRegBase(); | ||
| 436 | if (CheckSupportPows(selfCast, exponent)) { | 438 | if (CheckSupportPows(selfCast, exponent)) { |
| 437 | auto expTensor = uniqueExecutor.get()->ConvertToTensor(exponent, promoteType); | 439 | auto expTensor = uniqueExecutor.get()->ConvertToTensor(exponent, promoteType); |
| 438 | CHECK_RET(expTensor != nullptr, ACLNN_ERR_INNER_NULLPTR); | 440 | CHECK_RET(expTensor != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| @@ -446,6 +448,8 @@ aclnnStatus aclnnPowTensorScalarGetWorkspaceSize(const aclTensor *self, | |||
| 446 | } | 448 | } |
| 447 | // 当exponent为2.0时,使用square算子计算 | 449 | // 当exponent为2.0时,使用square算子计算 |
| 448 | powOut = const_cast<aclTensor *>(l0op::Square(squareInput, uniqueExecutor.get())); | 450 | powOut = const_cast<aclTensor *>(l0op::Square(squareInput, uniqueExecutor.get())); |
| 451 | + } else if (canNoUseOp) { | ||
| 452 | + powOut = const_cast<aclTensor *>(selfCast); | ||
| 449 | } else { | 453 | } else { |
| 450 | auto expTensor = uniqueExecutor.get()->ConvertToTensor(exponent, promoteType); | 454 | auto expTensor = uniqueExecutor.get()->ConvertToTensor(exponent, promoteType); |
| 451 | CHECK_RET(expTensor != nullptr, ACLNN_ERR_INNER_NULLPTR); | 455 | CHECK_RET(expTensor != nullptr, ACLNN_ERR_INNER_NULLPTR); |