Skip to content

Commit e513036

Browse files
YUNQIUGUOrachguorachguo
authored
[Mobile/React_Native] Fix the model input rank used in the expo app (#321)
* fix the model input rank used in the app * fix the model input name for qa sample --------- Co-authored-by: rachguo <[email protected]> Co-authored-by: rachguo <[email protected]>
1 parent d3cab27 commit e513036

File tree

2 files changed

+2
-2
lines changed
  • mobile/examples
    • React_Native/ort-rn-basic-usage
    • question_answering/android/app/src/main/java/ai/onnxruntime/example/question_answering

2 files changed

+2
-2
lines changed

mobile/examples/React_Native/ort-rn-basic-usage/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function runModel() {
4242
// Note: In real use case, you must set the inputData to the actual input values
4343
const inputData = new Float32Array(28 * 28);
4444
const feeds:Record<string, ort.Tensor> = {};
45-
feeds[myModel.inputNames[0]] = new ort.Tensor(inputData, [1, 28, 28]);
45+
feeds[myModel.inputNames[0]] = new ort.Tensor(inputData, [1, 1, 28, 28]);
4646
// Run inference session
4747
const fetches = await myModel.run(feeds);
4848
// Process output

mobile/examples/question_answering/android/app/src/main/java/ai/onnxruntime/example/question_answering/MainActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class MainActivity : AppCompatActivity() {
111111
}
112112

113113
private fun readModel(): ByteArray {
114-
val modelID = R.raw.mobilebert_quant_with_pre_post_processing
114+
val modelID = R.raw.csarron_mobilebert_uncased_squad_v2_quant_with_pre_post_processing
115115
return resources.openRawResource(modelID).readBytes()
116116
}
117117

0 commit comments

Comments
 (0)