Skip to content

Commit bdaebd9

Browse files
committed
Update JNI binding layer comments to indicate that forward/execute is not thread-safe (#6947)
Summary: Update doc comments on forward and execute to document that these functions are not thread-safe. Differential Revision: D66144668
1 parent 86cb5d7 commit bdaebd9

File tree

1 file changed

+6
-4
lines changed
  • extension/android/src/main/java/org/pytorch/executorch

1 file changed

+6
-4
lines changed

extension/android/src/main/java/org/pytorch/executorch/Module.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ public static Module load(final String modelPath) {
6666
/**
6767
* Runs the 'forward' method of this module with the specified arguments.
6868
*
69-
* @param inputs arguments for the ExecuTorch module's 'forward' method. Note: if method 'forward'
70-
* requires inputs but no inputs are given, the function will not error out, but run 'forward'
71-
* with sample inputs.
69+
* @param inputs arguments for the ExecuTorch module's 'forward' method. This function is not
70+
* thread safe and must not be called while a previous inference is in progress. Additionally,
71+
* if method 'forward' requires inputs but no inputs are given, the function will not error
72+
* out, but run 'forward' with sample inputs.
7273
* @return return value from the 'forward' method.
7374
*/
7475
public EValue[] forward(EValue... inputs) {
7576
return mNativePeer.forward(inputs);
7677
}
7778

7879
/**
79-
* Runs the specified method of this module with the specified arguments.
80+
* Runs the specified method of this module with the specified arguments. This function is not
81+
* thread safe and must not be called while a previous inference is in progress.
8082
*
8183
* @param methodName name of the ExecuTorch method to run.
8284
* @param inputs arguments that will be passed to ExecuTorch method.

0 commit comments

Comments
 (0)