Skip to content

Commit

Permalink
Update migrating instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
karllessard committed Apr 5, 2024
1 parent 13ce91b commit b6d4d5a
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 18 deletions.
50 changes: 50 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,56 @@
TensorFlow Java is still in an alpha stage, therefore is subject to contain breaking changes between the different releases. This guide explain in detail
how to migrate your code from a previous version to a new one that includes some changes that are not backward compatible.

## Migrating to 1.0.0

TensorFlow-Java 1.0.0 requires Java 11 or later.

### Native Artifact Renaming

The native artifacts, that used to be distributed as `tensorflow-core-api`, are now distributed under `tensorflow-core-native`. If you still add
`tensorflow-core-platform` in your project, that won't affect you. But if you were adding dependencies to specific native runtimes, you need to update
them to reflect the new artifact name.

For example,
```xml
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.5.0</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>0.5.0</version>
<classifier>linux-x86_64</classifier>
</dependency>
```
will now be
```xml
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>1.0.0</version>
<classifier>linux-x86_64</classifier>
</dependency>
```
### Session Run Result

In versions before 0.4.0 `Session.Runner.run` and `TensorFunction.call` returned a `List<Tensor>`. In newer versions
they return a `Result` class which is `AutoCloseable` to make management of the tensor lifetime simpler. To migrate
users should wrap the `run` invocation in a try-with-resources statement rather than closing the output tensors
individually.

### Proto Definitions Moved

Some proto definitions under `org.tensorflow.proto` have been moved to a different location under the same package. You will need to reimport these
proto bindings to match the new location. Your IDE should easily be able to do this for you.

## Migrating to 0.3.0

### Non-parameterized Typed Tensors
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ systems with no GPU support, you should add the following dependencies:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
<classifier>linux-x86_64</classifier>
</dependency>
```
Expand All @@ -84,24 +84,24 @@ native dependencies as follows:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-api</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
<classifier>linux-x86_64-gpu</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
<classifier>macosx-arm64</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
<classifier>windows-x86_64</classifier>
</dependency>
```
Expand All @@ -122,7 +122,7 @@ simply add this dependency to your application:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-platform</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</dependency>
```

Expand Down Expand Up @@ -172,7 +172,7 @@ This table shows the mapping between TensorFlow, TensorFlow Java and minimum sup
| 0.4.1 | 2.7.1 | 8 |
| 0.4.2 | 2.7.4 | 8 |
| 0.5.0 | 2.10.1 | 11 |
| 1.0.0-rc1 | 2.16.1 | 11 |
| 1.0.0-rc.1 | 2.16.1 | 11 |
| 1.0.0-SNAPSHOT | 2.16.1 | 11 |

## How to Contribute?
Expand Down
6 changes: 3 additions & 3 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ For example,
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-platform</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</dependency>
```

Expand Down Expand Up @@ -118,7 +118,7 @@ repositories {
}
dependencies {
compile group: 'org.tensorflow', name: 'tensorflow-core-platform', version: '1.0.0-rc1'
compile group: 'org.tensorflow', name: 'tensorflow-core-platform', version: '1.0.0-rc.1'
}
```

Expand Down Expand Up @@ -164,7 +164,7 @@ add the TensorFlow dependency to the project's `pom.xml` file:
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-platform</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</dependency>
</dependencies>
</project>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-java</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
<packaging>pom</packaging>

<name>TensorFlow Java Parent</name>
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-java</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</parent>
<artifactId>tensorflow-core</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-core/tensorflow-core-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</parent>
<artifactId>tensorflow-core-api</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-core/tensorflow-core-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</parent>
<artifactId>tensorflow-core-generator</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-core/tensorflow-core-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</parent>
<artifactId>tensorflow-core-native</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-core/tensorflow-core-platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</parent>
<artifactId>tensorflow-core-platform</artifactId>
<name>TensorFlow API Platform</name>
Expand Down
2 changes: 1 addition & 1 deletion tensorflow-framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-java</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.1</version>
</parent>
<artifactId>tensorflow-framework</artifactId>
<packaging>jar</packaging>
Expand Down

0 comments on commit b6d4d5a

Please sign in to comment.