From e0fcdd42e88253c7a4562cbe3f4961b2d6a23321 Mon Sep 17 00:00:00 2001 From: pytorchbot Date: Thu, 10 Oct 2024 18:26:30 -0700 Subject: [PATCH] Add OptionalIntArrayRef used by torchgen. (#6145) Add OptionalIntArrayRef used by torchgen. (#5735) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/5735 Adds OptionalIntArrayRef for generated cpp using torchgen. Generated code with torchgen.api.types.CppSignatureGroup uses additional aliases that are not currently defined in exec_aten.h. This diff adds support for OptionalIntArrayRef. Example: aten::mean.dim uses an optional int array that would end up using `OptionalIntArrayRef`. Reviewed By: zonglinpeng Differential Revision: D63568016 fbshipit-source-id: fc87338632c5d2e84f1dd9b088d69ad304a13d1c (cherry picked from commit 0e5b92ddb66ba97ae4f053fd0276d4f7b52cd3d2) Co-authored-by: Matthias Cremon --- runtime/core/exec_aten/exec_aten.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/core/exec_aten/exec_aten.h b/runtime/core/exec_aten/exec_aten.h index 207b95bc07..df6ef60c83 100644 --- a/runtime/core/exec_aten/exec_aten.h +++ b/runtime/core/exec_aten/exec_aten.h @@ -87,6 +87,7 @@ using IntArrayRef = at::IntArrayRef; template using OptionalArrayRef = c10::OptionalArrayRef; +using OptionalIntArrayRef = OptionalArrayRef; inline ssize_t compute_numel(const SizesType* sizes, ssize_t dim) { return static_cast( @@ -132,6 +133,7 @@ using IntArrayRef = torch::executor::IntArrayRef; template using OptionalArrayRef = torch::executor::optional>; +using OptionalIntArrayRef = OptionalArrayRef; using torch::executor::compute_numel;