Skip to content

Commit

Permalink
fix fill inplace call for aclnn
Browse files Browse the repository at this point in the history
  • Loading branch information
jingguo-st committed Jun 13, 2024
1 parent f6baaf8 commit 1f0b8a7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion impl/ascend/functions/nlllossv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ diopiError_t diopiNLLLossV2(diopiContextHandle_t ctx, diopiTensorHandle_t out, d
AscendTensor inputAt(input);
if (inputAt.numel() <= 0) {
if (diopiReduction_t::ReductionMean == reduction) {
DIOPI_ASCEND_CALL_ACLNN(aclnnInpalceFillScalar, ctx, out, std::nanf(""));
diopiScalar_t nans{diopi_dtype_float64, std::nanf("")};
DIOPI_ASCEND_CALL_ACLNN(aclnnInplaceFillScalar, ctx, out, &nans);
} else if (diopiReduction_t::ReductionSum == reduction || diopiReduction_t::ReductionNone == reduction) {
DIOPI_ASCEND_CALL_ACLNN(aclnnInplaceZero, ctx, out);
}
Expand Down

0 comments on commit 1f0b8a7

Please sign in to comment.