deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.07k stars 648 forks source link

Exception in thread "main" java.lang.UnsatisfiedLinkError: ai.djl.pytorch.jni.PyTorchLibrary.setGraphExecutorOptimize(Z)V #1274

Closed hongyaohongyao closed 2 years ago

hongyaohongyao commented 2 years ago

the error was thrown when I call the following function

JniUtils.setGraphExecutorOptimize(false);
frankfliu commented 2 years ago

@hongyaohongyao Thanks for reporting this issue. This is broken, will take a look.

frankfliu commented 2 years ago

@hongyaohongyao I think you have to make sure PyTorch engine is loaded before you call

        Engine engine = Engine.getEngine("PyTorch");
        JniUtils.setGraphExecutorOptimize(true);
frankfliu commented 2 years ago

I updated document: https://github.com/deepjavalibrary/djl/pull/1275

hongyaohongyao commented 2 years ago

@hongyaohongyao I think you have to make sure PyTorch engine is loaded before you call

        Engine engine = Engine.getEngine("PyTorch");
        JniUtils.setGraphExecutorOptimize(true);

it works,thanks