Skip to content

Enum for Tensor scalar type and shape dynamism. #9609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions extension/apple/ExecuTorch/Exported/ExecuTorchTensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,57 @@

NS_ASSUME_NONNULL_BEGIN

/**
* Enum to define the data type of a Tensor.
* Values can be a subset, but must numerically match exactly those defined in
* runtime/core/portable_type/scalar_type.h
*/
typedef NS_ENUM(int8_t, ExecuTorchDataType) {
ExecuTorchDataTypeByte,
ExecuTorchDataTypeChar,
ExecuTorchDataTypeShort,
ExecuTorchDataTypeInt,
ExecuTorchDataTypeLong,
ExecuTorchDataTypeHalf,
ExecuTorchDataTypeFloat,
ExecuTorchDataTypeDouble,
ExecuTorchDataTypeComplexHalf,
ExecuTorchDataTypeComplexFloat,
ExecuTorchDataTypeComplexDouble,
ExecuTorchDataTypeBool,
ExecuTorchDataTypeQInt8,
ExecuTorchDataTypeQUInt8,
ExecuTorchDataTypeQInt32,
ExecuTorchDataTypeBFloat16,
ExecuTorchDataTypeQUInt4x2,
ExecuTorchDataTypeQUInt2x4,
ExecuTorchDataTypeBits1x8,
ExecuTorchDataTypeBits2x4,
ExecuTorchDataTypeBits4x2,
ExecuTorchDataTypeBits8,
ExecuTorchDataTypeBits16,
ExecuTorchDataTypeFloat8_e5m2,
ExecuTorchDataTypeFloat8_e4m3fn,
ExecuTorchDataTypeFloat8_e5m2fnuz,
ExecuTorchDataTypeFloat8_e4m3fnuz,
ExecuTorchDataTypeUInt16,
ExecuTorchDataTypeUInt32,
ExecuTorchDataTypeUInt64,
ExecuTorchDataTypeUndefined,
ExecuTorchDataTypeNumOptions,
} NS_SWIFT_NAME(DataType);

/**
* Enum to define the shape dynamism of a Tensor.
* Values can be a subset, but must numerically match exactly those defined in
* runtime/core/tensor_shape_dynamism.h
*/
typedef NS_ENUM(uint8_t, ExecuTorchShapeDynamism) {
ExecuTorchShapeDynamismStatic,
ExecuTorchShapeDynamismDynamicBound,
ExecuTorchShapeDynamismDynamicUnbound,
} NS_SWIFT_NAME(ShapeDynamism);

NS_SWIFT_NAME(Tensor)
__attribute__((deprecated("This API is experimental.")))
@interface ExecuTorchTensor : NSObject
Expand Down
Loading