mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-23 19:32:23 +00:00
Change to std::fill (#21759)
### Description
Replace `memset(0)` with `std::fill(T{})`. This would ensure that all
the types are initialized in a portable way.
### Motivation and Context
Some platforms exhibit intermittent failures with NaN results.
Follow up to: https://github.com/microsoft/onnxruntime/pull/21525
Cc: @ranjitshs
This commit is contained in:
parent
b9f3a5d5b6
commit
754dba2674
1 changed files with 2 additions and 1 deletions
|
|
@ -106,7 +106,8 @@ Status MatMul<T>::Compute(OpKernelContext* ctx) const {
|
|||
if (helper.K() == 0) {
|
||||
// When we have (M, 0, N) then the inputs are empty, but the output should
|
||||
// be filled out with zeros.
|
||||
memset(y->MutableDataRaw(), 0, y->SizeInBytes());
|
||||
auto output_span = y->MutableDataAsSpan<T>();
|
||||
std::fill(output_span.begin(), output_span.end(), T{});
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue