xref: /aosp_15_r20/external/executorch/runtime/core/tensor_shape_dynamism.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <cstdint>
12 
13 namespace executorch {
14 namespace runtime {
15 
16 /**
17  * The resizing capabilities of a Tensor.
18  *
19  * The rank of an ExecuTorch Tensors can never change, but shape sometimes can.
20  */
21 enum class TensorShapeDynamism : uint8_t {
22   /// Cannot change shape.
23   STATIC = 0,
24   /// Shape cannot exceed initial capacity.
25   DYNAMIC_BOUND = 1,
26   /// No restriction on shape and capacity.
27   DYNAMIC_UNBOUND = 2,
28 };
29 
30 } // namespace runtime
31 } // namespace executorch
32 
33 namespace torch {
34 namespace executor {
35 // TODO(T197294990): Remove these deprecated aliases once all users have moved
36 // to the new `::executorch` namespaces.
37 using ::executorch::runtime::TensorShapeDynamism;
38 } // namespace executor
39 } // namespace torch
40