简体   繁体   中英

How can we import a tensorflow 2.x model to Java?

Since Tensorflow's Java API is still using 1.15, can we import a model made with Python and version 2.x to Java. If so, how?

TensorFlow 2.x support for Java is actually in progress and available only through snapshots on Sonatype OSS.

If you add this to your POM, you should be able to load and use them. Note that this only works for Linux and MacOSx at the moment since there is a bug with the Windows build. Also, the API varies a bit from the 1.15 version so you might need to adapt some pieces of code.

 <repositories>
    <repository>
        <id>tensorflow-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
 </repositories>
 <dependencies>
    <dependency>
        <groupId>org.tensorflow</groupId>
        <artifactId>tensorflow-core-platform</artifactId>
        <version>0.1.0-SNAPSHOT</version>
    </dependency>
 </dependencies>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM