From 97812e5818b6c38a5488f1b1e2e49536249fa210 Mon Sep 17 00:00:00 2001 From: Tianlei Wu Date: Fri, 17 Jan 2025 21:20:43 -0800 Subject: [PATCH] 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] ``` --- onnxruntime/core/framework/debug_node_inputs_outputs_utils.cc | 3 +++ onnxruntime/core/framework/debug_node_inputs_outputs_utils.h | 1 + onnxruntime/core/framework/print_tensor_statistics_utils.h | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/framework/debug_node_inputs_outputs_utils.cc b/onnxruntime/core/framework/debug_node_inputs_outputs_utils.cc index d4ab3a4ac1..7bd825a9b0 100644 --- a/onnxruntime/core/framework/debug_node_inputs_outputs_utils.cc +++ b/onnxruntime/core/framework/debug_node_inputs_outputs_utils.cc @@ -8,7 +8,10 @@ #include "core/framework/print_tensor_statistics_utils.h" #include #include +#include #include +#include +#include #ifdef DEBUG_NODE_INPUTS_OUTPUTS_ENABLE_DUMP_TO_SQLDB #include diff --git a/onnxruntime/core/framework/debug_node_inputs_outputs_utils.h b/onnxruntime/core/framework/debug_node_inputs_outputs_utils.h index 990df27a2b..2ea7d59ad6 100644 --- a/onnxruntime/core/framework/debug_node_inputs_outputs_utils.h +++ b/onnxruntime/core/framework/debug_node_inputs_outputs_utils.h @@ -20,6 +20,7 @@ #include "core/framework/session_state.h" #include "core/graph/graph.h" #include +#include #include #include diff --git a/onnxruntime/core/framework/print_tensor_statistics_utils.h b/onnxruntime/core/framework/print_tensor_statistics_utils.h index 60057150f4..c2030424ef 100644 --- a/onnxruntime/core/framework/print_tensor_statistics_utils.h +++ b/onnxruntime/core/framework/print_tensor_statistics_utils.h @@ -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::value) { tensor_statistics.is_float = true; - tensor_statistics.float_min = static_cast(min); - tensor_statistics.float_max = static_cast(max); + tensor_statistics.float_min = static_cast(min); + tensor_statistics.float_max = static_cast(max); } }