Skip to content

Commit

Permalink
Add OptionalIntArrayRef used by torchgen. (pytorch#5735)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#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
  • Loading branch information
mcremon-meta authored and facebook-github-bot committed Oct 3, 2024
1 parent 70aee72 commit 0e5b92d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/core/exec_aten/exec_aten.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ using IntArrayRef = at::IntArrayRef;

template <typename T>
using OptionalArrayRef = c10::OptionalArrayRef<T>;
using OptionalIntArrayRef = OptionalArrayRef<int64_t>;

inline ssize_t compute_numel(const SizesType* sizes, ssize_t dim) {
return static_cast<ssize_t>(
Expand Down Expand Up @@ -132,6 +133,7 @@ using IntArrayRef = torch::executor::IntArrayRef;
template <typename T>
using OptionalArrayRef =
torch::executor::optional<torch::executor::ArrayRef<T>>;
using OptionalIntArrayRef = OptionalArrayRef<int64_t>;

using torch::executor::compute_numel;

Expand Down

0 comments on commit 0e5b92d

Please sign in to comment.