已合并
aclnnRandom支持非连续 #4422
wushuai创建于 17 天前
aclnnRandom支持非连续 #4422
已合并
共 2 个文件变更+45-25
| @@ -85,7 +85,7 @@ aclnnStatus aclnnInplaceRandomTensor( | |||
| 85 | <td>BFLOAT16、FLOAT16、FLOAT32、DOUBLE、INT32、INT64、INT16、INT8、UINT8、BOOL、COMPLEX64、COMPLEX128</td> | 85 | <td>BFLOAT16、FLOAT16、FLOAT32、DOUBLE、INT32、INT64、INT16、INT8、UINT8、BOOL、COMPLEX64、COMPLEX128</td> |
| 86 | <td>ND</td> | 86 | <td>ND</td> |
| 87 | <td>0-8</td> | 87 | <td>0-8</td> |
| 88 | - <td>×</td> | 88 | + <td>√</td> |
| 89 | </tr> | 89 | </tr> |
| 90 | <tr> | 90 | <tr> |
| 91 | <td>from</td> | 91 | <td>from</td> |
| @@ -159,6 +159,10 @@ aclnnStatus aclnnInplaceRandomTensor( | |||
| 159 | </tr> | 159 | </tr> |
| 160 | </tbody></table> | 160 | </tbody></table> |
| 161 | 161 | ||
| 162 | +<!-- npu="950" id8 --> | ||
| 163 | + - <term>Ascend 950PR/Ascend 950DT</term>:数据类型不支持COMPLEX64、COMPLEX128。 | ||
| 164 | + <!-- end id8 --> | ||
| 165 | + | ||
| 162 | - **返回值:** | 166 | - **返回值:** |
| 163 | 167 | ||
| 164 | aclnnStatus:返回状态码,具体参见[aclnn返回码](../../../docs/zh/context/aclnn_return_code.md)。 | 168 | aclnnStatus:返回状态码,具体参见[aclnn返回码](../../../docs/zh/context/aclnn_return_code.md)。 |
| @@ -191,7 +195,7 @@ aclnnStatus aclnnInplaceRandomTensor( | |||
| 191 | <td>from大于等于to。</td> | 195 | <td>from大于等于to。</td> |
| 192 | </tr> | 196 | </tr> |
| 193 | <tr> | 197 | <tr> |
| 194 | - <td>to-1超过selfRef数据类型的取值范围。</td> | 198 | + <td>selfRef的shape超过8维。</td> |
| 195 | </tr> | 199 | </tr> |
| 196 | </tbody> | 200 | </tbody> |
| 197 | </table> | 201 | </table> |
| @@ -246,7 +250,7 @@ aclnnStatus aclnnInplaceRandomTensor( | |||
| 246 | 250 | ||
| 247 | <!-- npu="950" id7 --> | 251 | <!-- npu="950" id7 --> |
| 248 | - <term>Ascend 950PR/Ascend 950DT</term>: | 252 | - <term>Ascend 950PR/Ascend 950DT</term>: |
| 249 | - - offset必须为4的倍数。 | 253 | + - 通过aclnnSetPytorchRandom设置对标PyTorch模式时,offset必须为4的倍数。 |
| 250 | - from必须小于to,且from/to-1指定范围不可超出self数据类型的范围。 | 254 | - from必须小于to,且from/to-1指定范围不可超出self数据类型的范围。 |
| 251 | 255 | ||
| 252 | <!-- end id7 --> | 256 | <!-- end id7 --> |
| @@ -136,6 +136,11 @@ static const std::initializer_list<op::DataType> DTYPE_SUPPORT_LIST = { | |||
| 136 | op::DataType::DT_INT16, op::DataType::DT_INT8, op::DataType::DT_UINT8, op::DataType::DT_BOOL, | 136 | op::DataType::DT_INT16, op::DataType::DT_INT8, op::DataType::DT_UINT8, op::DataType::DT_BOOL, |
| 137 | op::DataType::DT_DOUBLE, op::DataType::DT_BF16, op::DataType::DT_COMPLEX64, op::DataType::DT_COMPLEX128}; | 137 | op::DataType::DT_DOUBLE, op::DataType::DT_BF16, op::DataType::DT_COMPLEX64, op::DataType::DT_COMPLEX128}; |
| 138 | 138 | ||
| 139 | +static const std::initializer_list<op::DataType> REGBASE_DTYPE_SUPPORT_LIST = { | ||
| 140 | + op::DataType::DT_FLOAT, op::DataType::DT_INT32, op::DataType::DT_INT64, op::DataType::DT_FLOAT16, | ||
| 141 | + op::DataType::DT_INT16, op::DataType::DT_INT8, op::DataType::DT_UINT8, op::DataType::DT_BOOL, | ||
| 142 | + op::DataType::DT_DOUBLE, op::DataType::DT_BF16}; | ||
| 143 | + | ||
| 139 | static const std::initializer_list<op::DataType> INT_DTYPE_LIST = {op::DataType::DT_INT32, op::DataType::DT_INT64, | 144 | static const std::initializer_list<op::DataType> INT_DTYPE_LIST = {op::DataType::DT_INT32, op::DataType::DT_INT64, |
| 140 | op::DataType::DT_INT16, op::DataType::DT_INT8, | 145 | op::DataType::DT_INT16, op::DataType::DT_INT8, |
| 141 | op::DataType::DT_UINT8, op::DataType::DT_BOOL}; | 146 | op::DataType::DT_UINT8, op::DataType::DT_BOOL}; |
| @@ -150,7 +155,12 @@ static bool CheckNotNull(const aclTensor* selfRef) | |||
| 150 | 155 | ||
| 151 | static bool CheckDtypeValid(const aclTensor* selfRef) | 156 | static bool CheckDtypeValid(const aclTensor* selfRef) |
| 152 | { | 157 | { |
| 153 | - OP_CHECK_DTYPE_NOT_SUPPORT(selfRef, DTYPE_SUPPORT_LIST, return false); | 158 | + if (IsRegBase()) { |
| 159 | + OP_CHECK_DTYPE_NOT_SUPPORT(selfRef, REGBASE_DTYPE_SUPPORT_LIST, return false); | ||
| 160 | + } else { | ||
| 161 | + OP_CHECK_DTYPE_NOT_SUPPORT(selfRef, DTYPE_SUPPORT_LIST, return false); | ||
| 162 | + } | ||
| 163 | + | ||
| 154 | return true; | 164 | return true; |
| 155 | } | 165 | } |
| 156 | 166 | ||
| @@ -345,10 +355,10 @@ aclnnStatus aclnnInplaceRandomGetWorkspaceSize(const aclTensor* selfRef, int64_t | |||
| 345 | int64_t offset, uint64_t* workspaceSize, aclOpExecutor** executor) | 355 | int64_t offset, uint64_t* workspaceSize, aclOpExecutor** executor) |
| 346 | { | 356 | { |
| 347 | L2_DFX_PHASE_1(aclnnInplaceRandom, DFX_IN(selfRef, from, to, seed, offset), DFX_OUT(selfRef)); | 357 | L2_DFX_PHASE_1(aclnnInplaceRandom, DFX_IN(selfRef, from, to, seed, offset), DFX_OUT(selfRef)); |
| 358 | + auto out = const_cast<aclTensor*>(selfRef); | ||
| 348 | auto ret = CheckParams(selfRef); | 359 | auto ret = CheckParams(selfRef); |
| 349 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 360 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 350 | CHECK_RET(CheckFromToRange(from, to), ACLNN_ERR_PARAM_INVALID); | 361 | CHECK_RET(CheckFromToRange(from, to), ACLNN_ERR_PARAM_INVALID); |
| 351 | - | ||
| 352 | auto uniqueExecutor = CREATE_EXECUTOR(); | 362 | auto uniqueExecutor = CREATE_EXECUTOR(); |
| 353 | CHECK_RET(uniqueExecutor.get() != nullptr, ACLNN_ERR_INNER_CREATE_EXECUTOR); | 363 | CHECK_RET(uniqueExecutor.get() != nullptr, ACLNN_ERR_INNER_CREATE_EXECUTOR); |
| 354 | 364 | ||
| @@ -357,16 +367,18 @@ aclnnStatus aclnnInplaceRandomGetWorkspaceSize(const aclTensor* selfRef, int64_t | |||
| 357 | uniqueExecutor.ReleaseTo(executor); | 367 | uniqueExecutor.ReleaseTo(executor); |
| 358 | return ACLNN_SUCCESS; | 368 | return ACLNN_SUCCESS; |
| 359 | } | 369 | } |
| 370 | + auto selfContiguous = l0op::Contiguous(selfRef, uniqueExecutor.get()); | ||
| 371 | + CHECK_RET(selfContiguous != nullptr, ACLNN_ERR_PARAM_NULLPTR); | ||
| 360 | 372 | ||
| 361 | // 更新from、to,将from、to移动到下一个最接近且不会超出[from, to)范围的值 | 373 | // 更新from、to,将from、to移动到下一个最接近且不会超出[from, to)范围的值 |
| 362 | - ret = updateFrom(from, selfRef->GetDataType()); | 374 | + ret = updateFrom(from, selfContiguous->GetDataType()); |
| 363 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 375 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 364 | - ret = updateTo(to, selfRef->GetDataType()); | 376 | + ret = updateTo(to, selfContiguous->GetDataType()); |
| 365 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 377 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 366 | 378 | ||
| 367 | const aclTensor* computeOut = nullptr; | 379 | const aclTensor* computeOut = nullptr; |
| 368 | if (GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_2201) { | 380 | if (GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_2201) { |
| 369 | - auto inputShape = op::ToShapeVector(selfRef->GetViewShape()); | 381 | + auto inputShape = op::ToShapeVector(selfContiguous->GetViewShape()); |
| 370 | auto inputShapeArray = uniqueExecutor.get()->AllocIntArray(inputShape.data(), inputShape.size()); | 382 | auto inputShapeArray = uniqueExecutor.get()->AllocIntArray(inputShape.data(), inputShape.size()); |
| 371 | CHECK_RET(inputShapeArray != nullptr, ACLNN_ERR_INNER_NULLPTR); | 383 | CHECK_RET(inputShapeArray != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 372 | auto low = uniqueExecutor.get()->AllocScalar(static_cast<float>(from)); | 384 | auto low = uniqueExecutor.get()->AllocScalar(static_cast<float>(from)); |
| @@ -375,20 +387,20 @@ aclnnStatus aclnnInplaceRandomGetWorkspaceSize(const aclTensor* selfRef, int64_t | |||
| 375 | CHECK_RET(high != nullptr, ACLNN_ERR_INNER_NULLPTR); | 387 | CHECK_RET(high != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 376 | computeOut = l0op::DSARandomUniform(inputShapeArray, seed, offset, low, high, uniqueExecutor.get()); | 388 | computeOut = l0op::DSARandomUniform(inputShapeArray, seed, offset, low, high, uniqueExecutor.get()); |
| 377 | } else { | 389 | } else { |
| 378 | - computeOut = randomDavidPath(selfRef, seed, offset, from, to, uniqueExecutor.get()); | 390 | + computeOut = randomDavidPath(selfContiguous, seed, offset, from, to, uniqueExecutor.get()); |
| 379 | } | 391 | } |
| 380 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 392 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 381 | 393 | ||
| 382 | - if (selfRef->GetDataType() == op::DataType::DT_BOOL) { | 394 | + if (selfContiguous->GetDataType() == op::DataType::DT_BOOL) { |
| 383 | int64_t decimals = 0; | 395 | int64_t decimals = 0; |
| 384 | computeOut = l0op::RoundDecimals(computeOut, decimals, uniqueExecutor.get()); | 396 | computeOut = l0op::RoundDecimals(computeOut, decimals, uniqueExecutor.get()); |
| 385 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 397 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 386 | } | 398 | } |
| 387 | 399 | ||
| 388 | - auto castResult = CastProcess(selfRef, computeOut, uniqueExecutor.get()); | 400 | + auto castResult = CastProcess(out, computeOut, uniqueExecutor.get()); |
| 389 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 401 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 390 | 402 | ||
| 391 | - auto viewCopyResult = l0op::ViewCopy(castResult, selfRef, uniqueExecutor.get()); | 403 | + auto viewCopyResult = l0op::ViewCopy(castResult, out, uniqueExecutor.get()); |
| 392 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 404 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 393 | 405 | ||
| 394 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); | 406 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); |
| @@ -409,7 +421,7 @@ aclnnStatus aclnnInplaceRandomTensorGetWorkspaceSize(const aclTensor* selfRef, i | |||
| 409 | { | 421 | { |
| 410 | L2_DFX_PHASE_1(aclnnInplaceRandomTensor, DFX_IN(selfRef, from, to, seedTensor, offsetTensor, offset), | 422 | L2_DFX_PHASE_1(aclnnInplaceRandomTensor, DFX_IN(selfRef, from, to, seedTensor, offsetTensor, offset), |
| 411 | DFX_OUT(selfRef)); | 423 | DFX_OUT(selfRef)); |
| 412 | - | 424 | + auto out = const_cast<aclTensor*>(selfRef); |
| 413 | auto ret = CheckParams(selfRef); | 425 | auto ret = CheckParams(selfRef); |
| 414 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 426 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 415 | CHECK_RET(CheckFromToRange(from, to), ACLNN_ERR_PARAM_INVALID); | 427 | CHECK_RET(CheckFromToRange(from, to), ACLNN_ERR_PARAM_INVALID); |
| @@ -421,18 +433,20 @@ aclnnStatus aclnnInplaceRandomTensorGetWorkspaceSize(const aclTensor* selfRef, i | |||
| 421 | uniqueExecutor.ReleaseTo(executor); | 433 | uniqueExecutor.ReleaseTo(executor); |
| 422 | return ACLNN_SUCCESS; | 434 | return ACLNN_SUCCESS; |
| 423 | } | 435 | } |
| 436 | + auto selfContiguous = l0op::Contiguous(selfRef, uniqueExecutor.get()); | ||
| 437 | + CHECK_RET(selfContiguous != nullptr, ACLNN_ERR_PARAM_NULLPTR); | ||
| 424 | 438 | ||
| 425 | // 更新from、to,将from、to移动到下一个最接近且不会超出[from, to)范围的值 | 439 | // 更新from、to,将from、to移动到下一个最接近且不会超出[from, to)范围的值 |
| 426 | - ret = updateFrom(from, selfRef->GetDataType()); | 440 | + ret = updateFrom(from, selfContiguous->GetDataType()); |
| 427 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 441 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 428 | - ret = updateTo(to, selfRef->GetDataType()); | 442 | + ret = updateTo(to, selfContiguous->GetDataType()); |
| 429 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 443 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 430 | 444 | ||
| 431 | const aclTensor* computeOut = nullptr; | 445 | const aclTensor* computeOut = nullptr; |
| 432 | if (GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_2201) { | 446 | if (GetCurrentPlatformInfo().GetCurNpuArch() == NpuArch::DAV_2201) { |
| 433 | auto concatTensor = ProcessOffsetTensor(offsetTensor, offset, uniqueExecutor.get()); | 447 | auto concatTensor = ProcessOffsetTensor(offsetTensor, offset, uniqueExecutor.get()); |
| 434 | CHECK_RET(concatTensor != nullptr, ACLNN_ERR_INNER_NULLPTR); | 448 | CHECK_RET(concatTensor != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 435 | - auto inputShape = op::ToShapeVector(selfRef->GetViewShape()); | 449 | + auto inputShape = op::ToShapeVector(selfContiguous->GetViewShape()); |
| 436 | auto inputShapeArray = uniqueExecutor.get()->AllocIntArray(inputShape.data(), inputShape.size()); | 450 | auto inputShapeArray = uniqueExecutor.get()->AllocIntArray(inputShape.data(), inputShape.size()); |
| 437 | CHECK_RET(inputShapeArray != nullptr, ACLNN_ERR_INNER_NULLPTR); | 451 | CHECK_RET(inputShapeArray != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 438 | auto low = uniqueExecutor.get()->AllocScalar(static_cast<float>(from)); | 452 | auto low = uniqueExecutor.get()->AllocScalar(static_cast<float>(from)); |
| @@ -443,20 +457,21 @@ aclnnStatus aclnnInplaceRandomTensorGetWorkspaceSize(const aclTensor* selfRef, i | |||
| 443 | computeOut = l0op::DSARandomUniformTensor(inputShapeArray, seedTensor, concatTensor, low, high, | 457 | computeOut = l0op::DSARandomUniformTensor(inputShapeArray, seedTensor, concatTensor, low, high, |
| 444 | uniqueExecutor.get()); | 458 | uniqueExecutor.get()); |
| 445 | } else { | 459 | } else { |
| 446 | - computeOut = randomTensorDavidPath(selfRef, seedTensor, offsetTensor, offset, from, to, uniqueExecutor.get()); | 460 | + computeOut = randomTensorDavidPath(selfContiguous, seedTensor, offsetTensor, offset, from, to, |
| 461 | + uniqueExecutor.get()); | ||
| 447 | } | 462 | } |
| 448 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 463 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 449 | 464 | ||
| 450 | - if (selfRef->GetDataType() == op::DataType::DT_BOOL) { | 465 | + if (out->GetDataType() == op::DataType::DT_BOOL) { |
| 451 | int64_t decimals = 0; | 466 | int64_t decimals = 0; |
| 452 | computeOut = l0op::RoundDecimals(computeOut, decimals, uniqueExecutor.get()); | 467 | computeOut = l0op::RoundDecimals(computeOut, decimals, uniqueExecutor.get()); |
| 453 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 468 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 454 | } | 469 | } |
| 455 | 470 | ||
| 456 | - auto castResult = CastProcess(selfRef, computeOut, uniqueExecutor.get()); | 471 | + auto castResult = CastProcess(out, computeOut, uniqueExecutor.get()); |
| 457 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 472 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 458 | 473 | ||
| 459 | - auto viewCopyResult = l0op::ViewCopy(castResult, selfRef, uniqueExecutor.get()); | 474 | + auto viewCopyResult = l0op::ViewCopy(castResult, out, uniqueExecutor.get()); |
| 460 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 475 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 461 | 476 | ||
| 462 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); | 477 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); |
| @@ -476,6 +491,7 @@ aclnnStatus aclnnInplaceRandomWithoutFromToGetWorkspaceSize(const aclTensor* sel | |||
| 476 | uint64_t* workspaceSize, aclOpExecutor** executor) | 491 | uint64_t* workspaceSize, aclOpExecutor** executor) |
| 477 | { | 492 | { |
| 478 | L2_DFX_PHASE_1(aclnnInplaceRandomWithoutFromTo, DFX_IN(selfRef, seed, offset), DFX_OUT(selfRef)); | 493 | L2_DFX_PHASE_1(aclnnInplaceRandomWithoutFromTo, DFX_IN(selfRef, seed, offset), DFX_OUT(selfRef)); |
| 494 | + auto out = const_cast<aclTensor*>(selfRef); | ||
| 479 | auto ret = CheckParams(selfRef); | 495 | auto ret = CheckParams(selfRef); |
| 480 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 496 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 481 | auto uniqueExecutor = CREATE_EXECUTOR(); | 497 | auto uniqueExecutor = CREATE_EXECUTOR(); |
| @@ -502,10 +518,10 @@ aclnnStatus aclnnInplaceRandomWithoutFromToGetWorkspaceSize(const aclTensor* sel | |||
| 502 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 518 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 503 | } | 519 | } |
| 504 | 520 | ||
| 505 | - auto castResult = CastProcess(selfContiguous, computeOut, uniqueExecutor.get()); | 521 | + auto castResult = CastProcess(out, computeOut, uniqueExecutor.get()); |
| 506 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 522 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 507 | 523 | ||
| 508 | - auto viewCopyResult = l0op::ViewCopy(castResult, selfRef, uniqueExecutor.get()); | 524 | + auto viewCopyResult = l0op::ViewCopy(castResult, out, uniqueExecutor.get()); |
| 509 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 525 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 510 | 526 | ||
| 511 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); | 527 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); |
| @@ -527,7 +543,7 @@ aclnnStatus aclnnInplaceRandomWithoutFromToTensorGetWorkspaceSize(const aclTenso | |||
| 527 | { | 543 | { |
| 528 | L2_DFX_PHASE_1(aclnnInplaceRandomWithoutFromToTensor, DFX_IN(selfRef, seedTensor, offsetTensor, offset), | 544 | L2_DFX_PHASE_1(aclnnInplaceRandomWithoutFromToTensor, DFX_IN(selfRef, seedTensor, offsetTensor, offset), |
| 529 | DFX_OUT(selfRef)); | 545 | DFX_OUT(selfRef)); |
| 530 | - | 546 | + auto out = const_cast<aclTensor*>(selfRef); |
| 531 | auto ret = CheckParams(selfRef); | 547 | auto ret = CheckParams(selfRef); |
| 532 | CHECK_RET(ret == ACLNN_SUCCESS, ret); | 548 | CHECK_RET(ret == ACLNN_SUCCESS, ret); |
| 533 | auto uniqueExecutor = CREATE_EXECUTOR(); | 549 | auto uniqueExecutor = CREATE_EXECUTOR(); |
| @@ -571,10 +587,10 @@ aclnnStatus aclnnInplaceRandomWithoutFromToTensorGetWorkspaceSize(const aclTenso | |||
| 571 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); | 587 | CHECK_RET(computeOut != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 572 | } | 588 | } |
| 573 | 589 | ||
| 574 | - auto castResult = CastProcess(selfContiguous, computeOut, uniqueExecutor.get()); | 590 | + auto castResult = CastProcess(out, computeOut, uniqueExecutor.get()); |
| 575 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 591 | CHECK_RET(castResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 576 | 592 | ||
| 577 | - auto viewCopyResult = l0op::ViewCopy(castResult, selfRef, uniqueExecutor.get()); | 593 | + auto viewCopyResult = l0op::ViewCopy(castResult, out, uniqueExecutor.get()); |
| 578 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); | 594 | CHECK_RET(viewCopyResult != nullptr, ACLNN_ERR_INNER_NULLPTR); |
| 579 | 595 | ||
| 580 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); | 596 | *workspaceSize = uniqueExecutor->GetWorkspaceSize(); |