Skip to content

Commit bfea626

Browse files
authored
Restore explicit so load in Module.java
Differential Revision: D75994546 Pull Request resolved: #11385
1 parent 48e866b commit bfea626

File tree

1 file changed

+10
-0
lines changed
  • extension/android/executorch_android/src/main/java/org/pytorch/executorch

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import android.util.Log;
1212
import com.facebook.jni.HybridData;
1313
import com.facebook.jni.annotations.DoNotStrip;
14+
import com.facebook.soloader.nativeloader.NativeLoader;
15+
import com.facebook.soloader.nativeloader.SystemDelegate;
1416
import java.io.File;
1517
import java.util.HashMap;
1618
import java.util.Map;
@@ -26,6 +28,14 @@
2628
@Experimental
2729
public class Module {
2830

31+
static {
32+
if (!NativeLoader.isInitialized()) {
33+
NativeLoader.init(new SystemDelegate());
34+
}
35+
// Loads libexecutorch.so from jniLibs
36+
NativeLoader.loadLibrary("executorch");
37+
}
38+
2939
/** Load mode for the module. Load the whole file as a buffer. */
3040
public static final int LOAD_MODE_FILE = 0;
3141

0 commit comments

Comments
 (0)