Skip to content

Android runtime execution - Execution of method forward failed with status 0x12 #14804

@adonnini

Description

@adonnini

Hi,

After loading my model in my Android application, when I attempted to run it execution failed with Execution of method forward failed with status 0x12 error.

Below you will find the trceback log produced by the error and the code where the error occurred.

I tried to look into the EValue and NativePeer source code but did not see anything that would explain what happened as I think the error occurred in NativePeer native source code (not visible to me)

Please let me know if you need any additional information

Thanks

SOURCE CODE

			float[] flat = flatten(tmpData);
			final long[]  shapeArrDataPytorchFlattened = new long[]{tmpData.length, 4, 1};
			arrDataPytorch = Tensor.fromBlob(flat, shapeArrDataPytorchFlattened);
			
			//arrDataPytorch IS float[][]
.
.
.

			try {
				Log.i(TAG, " - neuralNetworkloadAndRunPytorch - About to load module --- ");
				mModule = Module.load(moduleFileAbsoluteFilePath);   //EXECUTORCH
			} catch (Exception e) {
				Log.i(TAG, " - neuralNetworkloadAndRunPytorch - Loading of module FAILED --- ");
				throw new RuntimeException(e);
			}

			Tensor outputTensor = null;

			float[] scores = new float[1];

			try {
				Log.i(TAG, " - neuralNetworkloadAndRunPytorch - Abut to run inference --- ");
				outputTensor = mModule.forward()[0].toTensor();   //EXECUTORCH
				Log.i(TAG, " - neuralNetworkloadAndRunPytorch - outputTensor - "+outputTensor);

//FAILURE OCCURS HERE		outputTensor = mModule.forward(EValue.from(arrDataPytorch))[0].toTensor();   //EXECUTORCH
				Log.i(TAG, " - neuralNetworkloadAndRunPytorch - outputTensor - "+outputTensor);

			} catch (Exception e) {
				Log.i(TAG, " - neuralNetworkloadAndRunPytorch - Inference FAILED --- ");
				throw new RuntimeException(e);
			}

TRACEBACK LOG

10-04 12:28:02.544: E/ExecuTorch(21206): input 1 is none
10-04 12:28:02.546: I/NeuralNetworkService(21206):  - neuralNetworkloadAndRunPytorch - Inference FAILED --- 
10-04 12:28:02.547: W/System.err(21206): java.lang.RuntimeException: java.lang.Exception: Execution of method forward failed with status 0x12
10-04 12:28:02.547: W/System.err(21206): 	at com.android.contextq.neuralNetwork.NeuralNetworkService.neuralNetworkloadAndRunPytorch(NeuralNetworkService.java:3043)
10-04 12:28:02.547: W/System.err(21206): 	at com.android.contextq.neuralNetwork.NeuralNetworkService$NeuralNetworkServiceRunnable.run(NeuralNetworkService.java:10035)
10-04 12:28:02.548: W/System.err(21206): 	at java.lang.Thread.run(Thread.java:1119)
10-04 12:28:02.548: W/System.err(21206): Caused by: java.lang.Exception: Execution of method forward failed with status 0x12
10-04 12:28:02.548: W/System.err(21206): 	at org.pytorch.executorch.NativePeer.forward(Native Method)
10-04 12:28:02.548: W/System.err(21206): 	at org.pytorch.executorch.Module.forward(Module.java:75)
10-04 12:28:02.548: W/System.err(21206): 	at com.android.contextq.neuralNetwork.NeuralNetworkService.neuralNetworkloadAndRunPytorch(NeuralNetworkService.java:3035)
10-04 12:28:02.548: W/System.err(21206): 	... 2 more

cc @kirklandsign @cbilgin

Metadata

Metadata

Assignees

Labels

module: androidIssues related to Android code, build, and executionneed-user-inputThe issue needs more information from the reporter before moving forward

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions