File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
extension/apple/ExecuTorch/Exported Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ typedef NSInteger ExecuTorchIntegerValue
4040 NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME (IntegerValue);
4141typedef double ExecuTorchDoubleValue
4242 NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME (DoubleValue);
43+ typedef float ExecuTorchFloatValue
44+ NS_SWIFT_BRIDGED_TYPEDEF NS_SWIFT_NAME (FloatValue);
4345
4446/* *
4547 * A dynamic value type used by ExecuTorch.
@@ -100,6 +102,13 @@ __attribute__((deprecated("This API is experimental.")))
100102 */
101103@property(nonatomic, readonly) ExecuTorchDoubleValue doubleValue NS_SWIFT_NAME (double );
102104
105+ /* *
106+ * The float value if the tag is ExecuTorchValueTagDouble.
107+ *
108+ * @return An float representing the float value.
109+ */
110+ @property(nonatomic, readonly) ExecuTorchFloatValue floatValue NS_SWIFT_NAME (float );
111+
103112/* *
104113 * Returns YES if the value is of type None.
105114 *
@@ -149,6 +158,13 @@ __attribute__((deprecated("This API is experimental.")))
149158 */
150159@property(nonatomic, readonly) BOOL isDouble;
151160
161+ /* *
162+ * Returns YES if the value is a float.
163+ *
164+ * @return A BOOL indicating whether the value is a float.
165+ */
166+ @property(nonatomic, readonly) BOOL isFloat;
167+
152168/* *
153169 * Creates an instance encapsulating a Tensor.
154170 *
Original file line number Diff line number Diff line change @@ -88,6 +88,11 @@ - (ExecuTorchDoubleValue)doubleValue {
8888 return [(ExecuTorchScalarValue)_value doubleValue ];
8989}
9090
91+ - (ExecuTorchFloatValue)floatValue {
92+ ET_CHECK (self.isFloat );
93+ return [(ExecuTorchScalarValue)_value floatValue ];
94+ }
95+
9196- (BOOL )isNone {
9297 return _tag == ExecuTorchValueTagNone;
9398}
@@ -118,6 +123,11 @@ - (BOOL)isDouble {
118123 return _tag == ExecuTorchValueTagDouble;
119124}
120125
126+ - (BOOL )isFloat {
127+ // EValue does not have a separate tag for float.
128+ return _tag == ExecuTorchValueTagDouble;
129+ }
130+
121131- (BOOL )isEqualToValue : (nullable ExecuTorchValue *)other {
122132 if (!other) {
123133 return NO ;
You can’t perform that action at this time.
0 commit comments