From c8ec7782bdc64237d6b8102b0bbce35d941a8a27 Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Thu, 3 Mar 2022 15:18:33 -0800 Subject: [PATCH] Fix unused variable warning, move variable definitions closer to usages. (#10757) --- .../core/optimizer/graph_transformer_utils.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/onnxruntime/core/optimizer/graph_transformer_utils.cc b/onnxruntime/core/optimizer/graph_transformer_utils.cc index c9bfddb56f..f953a12f3c 100644 --- a/onnxruntime/core/optimizer/graph_transformer_utils.cc +++ b/onnxruntime/core/optimizer/graph_transformer_utils.cc @@ -160,14 +160,6 @@ InlinedVector> GenerateTransformers( InlinedVector> transformers; const bool disable_quant_qdq = session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsDisableQuantQDQ, "0") == "1"; - const bool enable_quant_qdq_cleanup = - session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsEnableQuantQDQCleanup, "0") == "1"; - const bool qdq_is_int8_allowed = - session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsQDQIsInt8Allowed, QDQIsInt8Allowed() ? "1" : "0") == "1"; -#ifndef DISABLE_CONTRIB_OPS - const bool enable_gelu_approximation = - session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsEnableGeluApproximation, "0") == "1"; -#endif switch (level) { case TransformerLevel::Level1: { @@ -196,9 +188,16 @@ InlinedVector> GenerateTransformers( } break; case TransformerLevel::Level2: { - const InlinedHashSet cpu_ep = {onnxruntime::kCpuExecutionProvider}; - + const bool enable_quant_qdq_cleanup = + session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsEnableQuantQDQCleanup, "0") == "1"; #ifndef DISABLE_CONTRIB_OPS + const bool qdq_is_int8_allowed = + session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsQDQIsInt8Allowed, + QDQIsInt8Allowed() ? "1" : "0") == "1"; + const bool enable_gelu_approximation = + session_options.config_options.GetConfigOrDefault(kOrtSessionOptionsEnableGeluApproximation, "0") == "1"; + + const InlinedHashSet cpu_ep = {onnxruntime::kCpuExecutionProvider}; const InlinedHashSet cuda_rocm_eps = {onnxruntime::kCudaExecutionProvider, onnxruntime::kRocmExecutionProvider}; const InlinedHashSet cpu_cuda_rocm_eps = {onnxruntime::kCpuExecutionProvider,