From 08ba895c6fc2666a982dfe5fe0cef59d24b05ac5 Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Tue, 25 Mar 2025 15:09:20 -0700 Subject: [PATCH 1/2] Rename deduceScalarType to deduceType --- extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h b/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h index d6f4c036637..28c62ee6fbd 100644 --- a/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h +++ b/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h @@ -23,7 +23,7 @@ using namespace runtime; * @param number The NSNumber instance whose scalar type is to be deduced. * @return The corresponding ScalarType. */ -static inline ScalarType deduceScalarType(NSNumber *number) { +static inline ScalarType deduceType(NSNumber *number) { auto type = [number objCType][0]; type = (type >= 'A' && type <= 'Z') ? type + ('a' - 'A') : type; if (type == 'c') { @@ -52,7 +52,7 @@ static inline ScalarType deduceScalarType(NSNumber *number) { */ template static inline T extractValue(NSNumber *number) { - ET_CHECK_MSG(!(isFloatingType(deduceScalarType(number)) && + ET_CHECK_MSG(!(isFloatingType(deduceType(number)) && isIntegralType(CppTypeToScalarType::value, true)), "Cannot convert floating point to integral type"); T value; From 115925c098dc81da9106cfb324751ab507cd30d5 Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Tue, 25 Mar 2025 15:10:50 -0700 Subject: [PATCH 2/2] Update ExecuTorchUtils.h --- extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h b/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h index 28c62ee6fbd..02b82d4a989 100644 --- a/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h +++ b/extension/apple/ExecuTorch/Internal/ExecuTorchUtils.h @@ -52,7 +52,7 @@ static inline ScalarType deduceType(NSNumber *number) { */ template static inline T extractValue(NSNumber *number) { - ET_CHECK_MSG(!(isFloatingType(deduceType(number)) && + ET_CHECK_MSG(!(isFloatingType(deduceScalarType(number)) && isIntegralType(CppTypeToScalarType::value, true)), "Cannot convert floating point to integral type"); T value;