Fix type cast build error (#23423)

### Description

- Fix a type cast in
https://github.com/microsoft/onnxruntime/pull/23363.
- Include some headers which are suggested by code scanning in that PR.

### Motivation and Context

PostMerge has build error:
```
onnxruntime\core\framework\print_tensor_statistics_utils.h(92,55): error C2220: the following warning is treated as an error [D:\a\_work\1\b\Debug\onnxruntime_framework.vcxproj]
```
This commit is contained in:
Tianlei Wu 2025-01-17 21:20:43 -08:00 committed by GitHub
parent a05203b91c
commit 97812e5818
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View file

@ -8,7 +8,10 @@
#include "core/framework/print_tensor_statistics_utils.h"
#include <iomanip>
#include <cctype>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#ifdef DEBUG_NODE_INPUTS_OUTPUTS_ENABLE_DUMP_TO_SQLDB
#include <sqlite3.h>

View file

@ -20,6 +20,7 @@
#include "core/framework/session_state.h"
#include "core/graph/graph.h"
#include <unordered_set>
#include <unordered_map>
#include <mutex>
#include <string>

View file

@ -89,8 +89,8 @@ void PrintCommonStats(const T* data, size_t count, TensorStatisticsData& tensor_
// Statistics for float and double only for now.
if constexpr (std::is_same<T, float>::value) {
tensor_statistics.is_float = true;
tensor_statistics.float_min = static_cast<double>(min);
tensor_statistics.float_max = static_cast<double>(max);
tensor_statistics.float_min = static_cast<float>(min);
tensor_statistics.float_max = static_cast<float>(max);
}
}