Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 构建DeepLearning4j来源:NoClassDefFoundError org.nd4j.linalg.factory.nd4j_Maven_Deeplearning4j - Fatal编程技术网

Maven 构建DeepLearning4j来源:NoClassDefFoundError org.nd4j.linalg.factory.nd4j

Maven 构建DeepLearning4j来源:NoClassDefFoundError org.nd4j.linalg.factory.nd4j,maven,deeplearning4j,Maven,Deeplearning4j,几个月来,我一直在尝试从源代码构建DL4J,但失败了。我甚至尝试过不同的发行版,但没有任何好处。我最近一次使用Ubuntu 19.10mvn安装-DskipTests可以工作,但在生成到nd4j/nd4j后端/nd4j测试后,建议使用的mvn clean test-P testresources,test-nd4j-native会产生以下错误。Ubuntu19.10运行在一个VirtualBox上,它有28GB和6个超线程 testSystemInfo(org.nd4j.systeminfo.T

几个月来,我一直在尝试从源代码构建DL4J,但失败了。我甚至尝试过不同的发行版,但没有任何好处。我最近一次使用Ubuntu 19.10
mvn安装-DskipTests
可以工作,但在生成到nd4j/nd4j后端/nd4j测试后,建议使用的
mvn clean test-P testresources,test-nd4j-native
会产生以下错误。Ubuntu19.10运行在一个VirtualBox上,它有28GB和6个超线程

testSystemInfo(org.nd4j.systeminfo.TestSystemInfo)  Time elapsed: 0.034 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.nd4j.linalg.factory.Nd4j
    at org.nd4j.systeminfo.SystemInfo.getSystemInfo(SystemInfo.java:159)
    at org.nd4j.systeminfo.SystemInfo.printSystemInfo(SystemInfo.java:419)
    at org.nd4j.systeminfo.TestSystemInfo.testSystemInfo(TestSystemInfo.java:25)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)


testSystemInfo(org.nd4j.systeminfo.testSystemInfo)经过的时间:0.034秒根据您上面提到的参数,您正在尝试为CPU后端构建。
为此,请使用以下命令:

mvn-B-V-U干净安装-Dmaven.test.skip=true

另外,确保您已经安装了所有必需的构建依赖项(jdk8、maven3、gcc7、cmake、python3)

如果确实要生成和运行测试,请使用以下命令:

  • 克隆和构建dl4j测试资源

    git clone https://github.com/KonduitAI/dl4j-test-resources.git
    cd dl4j-test-resources
    mvn -B -V -U clean install
    
  • 为CPU后端运行tests命令,但请注意,此时某些测试可能会失败

    mvn -B -V -U test -DreuseForks=false -P native-snapshots -P test-nd4j-native -P nd4j-tests-cpu -P tf-cpu -P nd4j-tf-cpu -P testresources
    

  • 另一个异常是导致该错误的原因。确保使用
    mvn-e-DtrimStackTrace=false…
    运行构建以获取更多消息。谢谢,我需要您的第二个命令。有了这些,我现在得到了
    失败的测试:compareKeras[0:backend(org.nd4j.linalg.cpu.nativecpu.CpuBackend)={1}](org.nd4j.linalg.coulsion.DeconvTests)测试错误:testPad[0:backend(org.nd4j.linalg.cpu.nativecpu.CpuBackend)={1}](org.nd4j.autodiff.opvalidation.TransformOpValidation):在op验证测试运行期间计算输出形状时出错:3704,失败:1,错误:1,跳过:155。。。但这似乎是一个单独的问题,所以我将把它标记为解决方案。