File tree Expand file tree Collapse file tree
packages/react-native-executorch/common/rnexecutorch/models/embeddings/image Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,16 +20,12 @@ ImageEmbeddings::runInference(cv::Mat image) {
2020 cv::Mat preprocessed = preprocess (image);
2121 auto inputTensor = createInputTensor (preprocessed);
2222
23- auto forwardResult = BaseModel::forward (inputTensor);
23+ auto outputs = forwardOrThrow (
24+ inputTensor,
25+ " The model's forward function did not succeed. Ensure the model input "
26+ " is correct." );
2427
25- if (!forwardResult.ok ()) {
26- throw RnExecutorchError (
27- forwardResult.error (),
28- " The model's forward function did not succeed. Ensure the model input "
29- " is correct." );
30- }
31-
32- auto forwardResultTensor = forwardResult->at (0 ).toTensor ();
28+ auto forwardResultTensor = outputs.at (0 ).toTensor ();
3329 return std::make_shared<OwningArrayBuffer>(
3430 forwardResultTensor.const_data_ptr (), forwardResultTensor.nbytes ());
3531}
You can’t perform that action at this time.
0 commit comments