File tree 1 file changed +25
-0
lines changed
extension/apple/ExecuTorch/Exported 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,15 @@ static inline EValue toEValue(ExecuTorchValue *value) {
24
24
ET_CHECK (nativeTensor);
25
25
return *nativeTensor;
26
26
}
27
+ if (value.isDouble ) {
28
+ return EValue (value.doubleValue );
29
+ }
30
+ if (value.isInteger ) {
31
+ return EValue (static_cast <int64_t >(value.intValue ));
32
+ }
33
+ if (value.isBoolean ) {
34
+ return EValue (value.boolValue );
35
+ }
27
36
ET_CHECK_MSG (false , " Unsupported ExecuTorchValue type" );
28
37
return EValue ();
29
38
}
@@ -33,6 +42,22 @@ static inline EValue toEValue(ExecuTorchValue *value) {
33
42
auto nativeInstance = make_tensor_ptr (value.toTensor ());
34
43
return [ExecuTorchValue valueWithTensor: [[ExecuTorchTensor alloc ] initWithNativeInstance: &nativeInstance]];
35
44
}
45
+ if (value.isDouble ()) {
46
+ return [ExecuTorchValue valueWithDouble: value.toDouble ()];
47
+ }
48
+ if (value.isInt ()) {
49
+ return [ExecuTorchValue valueWithInteger: value.toInt ()];
50
+ }
51
+ if (value.isBool ()) {
52
+ return [ExecuTorchValue valueWithBoolean: value.toBool ()];
53
+ }
54
+ if (value.isString ()) {
55
+ const auto stringView = value.toString ();
56
+ NSString *string = [[NSString alloc ] initWithBytes: stringView.data ()
57
+ length: stringView.size ()
58
+ encoding: NSUTF8StringEncoding];
59
+ return [ExecuTorchValue valueWithString: string];
60
+ }
36
61
ET_CHECK_MSG (false , " Unsupported EValue type" );
37
62
return [ExecuTorchValue new ];
38
63
}
You can’t perform that action at this time.
0 commit comments