Skip to content

Commit 610f398

Browse files
authored
Enum for Tensor scalar type and shape dynamism.
Differential Revision: D71752748 Pull Request resolved: #9609
1 parent 811352d commit 610f398

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h

+51
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,57 @@
1010

1111
NS_ASSUME_NONNULL_BEGIN
1212

13+
/**
14+
* Enum to define the data type of a Tensor.
15+
* Values can be a subset, but must numerically match exactly those defined in
16+
* runtime/core/portable_type/scalar_type.h
17+
*/
18+
typedef NS_ENUM(int8_t, ExecuTorchDataType) {
19+
ExecuTorchDataTypeByte,
20+
ExecuTorchDataTypeChar,
21+
ExecuTorchDataTypeShort,
22+
ExecuTorchDataTypeInt,
23+
ExecuTorchDataTypeLong,
24+
ExecuTorchDataTypeHalf,
25+
ExecuTorchDataTypeFloat,
26+
ExecuTorchDataTypeDouble,
27+
ExecuTorchDataTypeComplexHalf,
28+
ExecuTorchDataTypeComplexFloat,
29+
ExecuTorchDataTypeComplexDouble,
30+
ExecuTorchDataTypeBool,
31+
ExecuTorchDataTypeQInt8,
32+
ExecuTorchDataTypeQUInt8,
33+
ExecuTorchDataTypeQInt32,
34+
ExecuTorchDataTypeBFloat16,
35+
ExecuTorchDataTypeQUInt4x2,
36+
ExecuTorchDataTypeQUInt2x4,
37+
ExecuTorchDataTypeBits1x8,
38+
ExecuTorchDataTypeBits2x4,
39+
ExecuTorchDataTypeBits4x2,
40+
ExecuTorchDataTypeBits8,
41+
ExecuTorchDataTypeBits16,
42+
ExecuTorchDataTypeFloat8_e5m2,
43+
ExecuTorchDataTypeFloat8_e4m3fn,
44+
ExecuTorchDataTypeFloat8_e5m2fnuz,
45+
ExecuTorchDataTypeFloat8_e4m3fnuz,
46+
ExecuTorchDataTypeUInt16,
47+
ExecuTorchDataTypeUInt32,
48+
ExecuTorchDataTypeUInt64,
49+
ExecuTorchDataTypeUndefined,
50+
ExecuTorchDataTypeNumOptions,
51+
} NS_SWIFT_NAME(DataType);
52+
53+
/**
54+
* Enum to define the shape dynamism of a Tensor.
55+
* Values can be a subset, but must numerically match exactly those defined in
56+
* runtime/core/tensor_shape_dynamism.h
57+
*/
58+
typedef NS_ENUM(uint8_t, ExecuTorchShapeDynamism) {
59+
ExecuTorchShapeDynamismStatic,
60+
ExecuTorchShapeDynamismDynamicBound,
61+
ExecuTorchShapeDynamismDynamicUnbound,
62+
} NS_SWIFT_NAME(ShapeDynamism);
63+
1364
NS_SWIFT_NAME(Tensor)
1465
__attribute__((deprecated("This API is experimental.")))
1566
@interface ExecuTorchTensor : NSObject

0 commit comments

Comments
 (0)