File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
extension/apple/ExecuTorch/Exported Expand file tree Collapse file tree 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) {
2424 ET_CHECK (nativeTensor);
2525 return *nativeTensor;
2626 }
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+ }
2736 ET_CHECK_MSG (false , " Unsupported ExecuTorchValue type" );
2837 return EValue ();
2938}
@@ -33,6 +42,22 @@ static inline EValue toEValue(ExecuTorchValue *value) {
3342 auto nativeInstance = make_tensor_ptr (value.toTensor ());
3443 return [ExecuTorchValue valueWithTensor: [[ExecuTorchTensor alloc ] initWithNativeInstance: &nativeInstance]];
3544 }
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+ }
3661 ET_CHECK_MSG (false , " Unsupported EValue type" );
3762 return [ExecuTorchValue new ];
3863}
You can’t perform that action at this time.
0 commit comments