我正在尝试在 Intellij IDEA 的 Kotlin 项目中使用 Nd4j。在 Project Structure -> Libraries 中,我使用“From Maven”命令添加以下库。
org.deeplearning4j:deeplearning4j-core:1.0.0-beta
org.nd4j:nd4j-native-platform:1.0.0-beta
org.datavec:datavec-api:1.0.0-beta
使用这些库,我可以编译我的项目,但是当我运行它时,它会因异常而失败。
Caused by: java.lang.RuntimeException: ND4J is probably missing dependencies. For more information, please refer to: http://nd4j.org/getstarted.html
at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:51)
at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:19)
... 10 more
Caused by: java.lang.UnsatisfiedLinkError: no jnind4jcpu in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1220)
at org.bytedeco.javacpp.Loader.load(Loader.java:980)
at org.bytedeco.javacpp.Loader.load(Loader.java:879)
at org.nd4j.nativeblas.Nd4jCpu.<clinit>(Nd4jCpu.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.bytedeco.javacpp.Loader.load(Loader.java:938)
at org.bytedeco.javacpp.Loader.load(Loader.java:879)
at org.nd4j.nativeblas.Nd4jCpu$NativeOps.<clinit>(Nd4jCpu.java:1310)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:29)
... 11 more
Caused by: java.lang.UnsatisfiedLinkError: no nd4jcpu in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1220)
at org.bytedeco.javacpp.Loader.load(Loader.java:965)
... 21 more
查看项目文件夹,我看到 IDEA 已经为 nd4j-native-platform 下载了很多 jar 文件,但是没有任何 JNI 库的迹象。我还需要做什么?