Skip to content
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
25 changes: 25 additions & 0 deletions extension/apple/ExecuTorch/Exported/ExecuTorchModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ static inline EValue toEValue(ExecuTorchValue *value) {
ET_CHECK(nativeTensor);
return *nativeTensor;
}
if (value.isDouble) {
return EValue(value.doubleValue);
}
if (value.isInteger) {
return EValue(static_cast<int64_t>(value.intValue));
}
if (value.isBoolean) {
return EValue(value.boolValue);
}
ET_CHECK_MSG(false, "Unsupported ExecuTorchValue type");
return EValue();
}
Expand All @@ -33,6 +42,22 @@ static inline EValue toEValue(ExecuTorchValue *value) {
auto nativeInstance = make_tensor_ptr(value.toTensor());
return [ExecuTorchValue valueWithTensor:[[ExecuTorchTensor alloc] initWithNativeInstance:&nativeInstance]];
}
if (value.isDouble()) {
return [ExecuTorchValue valueWithDouble:value.toDouble()];
}
if (value.isInt()) {
return [ExecuTorchValue valueWithInteger:value.toInt()];
}
if (value.isBool()) {
return [ExecuTorchValue valueWithBoolean:value.toBool()];
}
if (value.isString()) {
const auto stringView = value.toString();
NSString *string = [[NSString alloc] initWithBytes:stringView.data()
length:stringView.size()
encoding:NSUTF8StringEncoding];
return [ExecuTorchValue valueWithString:string];
}
ET_CHECK_MSG(false, "Unsupported EValue type");
return [ExecuTorchValue new];
}
Expand Down
Loading