Skip to content

Commit b14bc39

Browse files
committed
Small pre-release adjustments
1 parent 22e370a commit b14bc39

23 files changed

+149
-58
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Bug/Performance Issue
3+
about: Use this template for reporting a bug or a performance issue.
4+
5+
---
6+
7+
<em>Please make sure that this is a bug. As per our [GitHub Policy](https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md), we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template</em>
8+
9+
**System information**
10+
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
11+
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04 x86\_64):
12+
- TensorFlow installed from (source or binary):
13+
- TensorFlow version (use command below):
14+
- Java version (i.e., the output of `java -version`):
15+
- Java command line flags (e.g., GC parameters):
16+
- Python version (if transferring a model trained in Python):
17+
- Bazel version (if compiling from source):
18+
- GCC/Compiler version (if compiling from source):
19+
- CUDA/cuDNN version:
20+
- GPU model and memory:
21+
22+
**Describe the current behavior**
23+
24+
**Describe the expected behavior**
25+
26+
**Code to reproduce the issue**
27+
Provide a reproducible test case that is the bare minimum necessary to generate the problem.
28+
29+
**Other info / logs**
30+
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Build/Installation Issue
3+
about: Use this template for build/installation issues
4+
5+
---
6+
7+
<em>Please make sure that this is a build/installation issue. As per our [GitHub Policy](https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md), we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template</em>
8+
9+
**System information**
10+
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04 x86\_64):
11+
- TensorFlow installed from (source or binary):
12+
- TensorFlow version:
13+
- Java version (i.e., the output of `java -version`):
14+
- Java command line flags (e.g., GC parameters):
15+
- Installed from Maven Central?:
16+
- Bazel version (if compiling from source):
17+
- GCC/Compiler version (if compiling from source):
18+
- CUDA/cuDNN version:
19+
- GPU model and memory:
20+
21+
22+
**Describe the problem**
23+
24+
**Provide the exact sequence of commands / steps that you executed before running into the problem**
25+
26+
**Any other info / logs**
27+
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Documentation Issue
3+
about: Use this template for documentation related issues
4+
5+
---
6+
7+
<em>Please make sure that this is a documentation issue. As per our [GitHub Policy](https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md), we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:doc_template</em>
8+
9+
10+
**System information**
11+
- TensorFlow version:
12+
- Doc Link:
13+
14+
15+
**Describe the documentation issue**
16+
17+
**We welcome contributions by users. Will you be able to update submit a PR (use the [doc style guide](https://www.tensorflow.org/community/documentation)) to fix the doc Issue?**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Feature Request
3+
about: Use this template for raising a feature request
4+
5+
---
6+
7+
<em>Please make sure that this is a feature request. As per our [GitHub Policy](https://github.com/tensorflow/tensorflow/blob/master/ISSUES.md), we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template</em>
8+
9+
10+
**System information**
11+
- TensorFlow version (you are using):
12+
- Are you willing to contribute it (Yes/No):
13+
14+
15+
16+
**Describe the feature and the current behavior/state.**
17+
18+
**Will this change the current api? How?**
19+
20+
**Who will benefit with this feature?**
21+
22+
**Any Other info.**
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Other Issues
3+
about: Use this template for any other non-support related issues
4+
5+
---
6+
7+
This template is for miscellaneous issues not covered by the other issue categories.
8+
9+
For questions on how to work with TensorFlow, or support for problems that are not verified bugs in TensorFlow, please go to [StackOverflow](https://stackoverflow.com/questions/tagged/tensorflow).
10+
11+
If you are reporting a vulnerability, please use the [dedicated reporting process](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md).
12+
13+
For high-level discussions about TensorFlow, please post to [email protected], for questions about the development or internal workings of TensorFlow, or if you would like to know how to contribute to TensorFlow, please post to [email protected].

.github/workflows/build.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@ jobs:
190190
java-version: '11'
191191
- name: Checkout repository
192192
uses: actions/checkout@v1
193+
- name: Build project
194+
run: |
195+
java -version
196+
mvn -version
197+
mvn clean install -B -U -e
193198
- name: Deploy snapshot artifacts
194199
run: |
195200
echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.CI_DEPLOY_USERNAME }}</username><password>${{ secrets.CI_DEPLOY_PASSWORD }}</password></server></servers></settings>" > $HOME/.m2/settings.xml
196-
mvn clean deploy -Pdeploying -B -e
201+
mvn deploy -Pdeploying -B -e -Dmaven.test.skip=true

CONTRIBUTING.md

+5-25
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,12 @@ This can be done in `.mvn/jvm.config` or `MAVEN_OPTS`.
3535
### Native Builds
3636

3737
By default, the build will attempt to download the existing TensorFlow binaries from the web for the platform it is running on (so you need to have an active internet connection).
38-
If such binaries are not available for your platform, you will need to build the TensorFlow runtime library from sources, by adding the `-Dnative.build` argument to your Maven
38+
If such binaries are not available for your platform, you will need to build the TensorFlow runtime library from sources, by appending the `-Dnative.build` argument to your Maven
3939
command. This requires a valid environment for building TensorFlow, including the [bazel](https://bazel.build/) build tool and a few Python dependencies
4040
(please read [TensorFlow documentation](https://www.tensorflow.org/install/source) for more details). Note that building from sources can take multiple hours on a regular laptop.
4141

42-
### GPU Support
43-
44-
Currently, due to build time constraints, the GPU binaries only support compute capacities 3.5 and 7.0.
45-
To use with un-supported GPUs, you have to build it yourself, after changing the value [here](tensorflow-core/tensorflow-core-api/build.sh#L27),
46-
setting the environment variable `TF_CUDA_COMPUTE_CAPABILITIES`, or configuring it in a bazel rc file (
47-
i.e. `build --action_env TF_CUDA_COMPUTE_CAPABILITIES="6.1"`). While this is far from ideal, we are working on getting more build resources, and for
48-
now this is the best option.
49-
50-
To build for GPU, pass `-Djavacpp.platform.extension=-gpu` to maven. By default, the CI options are used for the bazel build, see the above section
51-
for more info. If you add `bazelrc` files, make sure the `TF_CUDA_COMPUTE_CAPABILITIES` value in them matches the value set elsewhere, as it will take
52-
precedence if present.
53-
54-
### Apple Silicon
55-
56-
The TensorFlow Java project relies on [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners)
57-
to build and distribute the native binaries for TensorFlow. Unfortunately at the moment, GitHub Actions still does not support runners with a
58-
Apple Silicon chip (such as M1). Therefore, we cannot distribute artifacts for this platform, so they must be build locally on these systems.
59-
60-
Please follow the present [procedure](CONTRIBUTING.md#building) for building TensorFlow Java.
42+
To build for GPU, pass `-Djavacpp.platform.extension=-gpu` to maven. If you want to use TensorFlow Java with unsupported GPUs, set the environment variable `TF_CUDA_COMPUTE_CAPABILITIES`, or
43+
configure it in a bazel rc file (i.e. `build --action_env TF_CUDA_COMPUTE_CAPABILITIES="6.1"`).
6144

6245
### Native Crashes
6346

@@ -115,14 +98,12 @@ patches are found in `tensorflow-core/tensorflow-core-native/external`.
11598
- To create a new patch or update one, you can make a copy of the TensorFlow source file to change, make your change and generate a patch using `git diff <file> <file-updated>`
11699
- If more than one file needs to be added to the patch, it's easier to clone the [TensorFlow repository](https://github.com/tensorflow/tensorflow), apply the changes and use `git diff` at the root of the tree
117100

118-
Once these steps have been executed, you can run `mvn install` to build the new version but make sure to delete completely the `src/gen` directory of `tensorflow-core-api` first.
119-
120101
### Generating Java Bindings
121102

122103
After upgrading the TensorFlow library, you need to regenerate all Java bindings that depends on the native code. That includes Java protos, C API bindings (JavaCPP) and
123104
operator classes. You can trigger the regeneration of these bindings with the Maven command `mvn clean install -Pgenerating`.
124105

125-
This will trigger a small Bazel build of the TensorFlow sources to regenerate the Java protos, so make sure your [environment](CONTRIBUTING.md#native-builds) is setup properly.
106+
This will also trigger a small Bazel build of the TensorFlow sources to regenerate the Java protos, so make sure your [environment](CONTRIBUTING.md#native-builds) is setup properly.
126107

127108
#### Operations Classification
128109

@@ -182,5 +163,4 @@ org.tensorflow.exceptions.TensorFlowException: No gradient defined for op: ReadV
182163
```
183164
The description in the [linked file](https://www.tensorflow.org/code/tensorflow/cc/gradients/README.md) are accurate for adding C++ Graph gradients, which are used by our `Graph`. Examples of doing that are [tensorflow/tensorflow#46115](https://github.com/tensorflow/tensorflow/pull/46115) and [tensorflow/tensorflow#47774](https://github.com/tensorflow/tensorflow/pull/47774).
184165

185-
However, Tensorflow Core is in the process of migrating gradient definitions to [`c/experimental/gradients`](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/c/experimental/gradients), which will be what our eager mode uses once it has gradient support.
186-
Anyone adding gradients is strongly encouraged to add one there as well, and eventually it should replace the legacy `cc/gradients` gradients.
166+
You can also code and register the missing gradients in Java, using the TensorFlow Java custom gradient registration capabilities. Check at the JavaDoc of `tensorflow-core-api` for more details.

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ only binaries for the followings are being **supported and distributed** by this
5959
- `linux-x86_64`: Linux platforms on Intel chips
6060
- `linux-x86_64-gpu`: Linux platforms on Intel chips with Cuda GPU support
6161
- `macosx-x86_64`: MacOS X platforms on Intel chips
62+
- `macosx-arm64`: MacOS X platforms on Apple Silicon chips
6263
- `windows-x86_64`: Windows platforms on Intel chips
6364

64-
*Note: No binaries are distributed to run TensorFlow Java on machines with Apple Silicon chips (`macosx-arm64`), these
65-
should be build from sources. See [here](CONTRIBUTING.md#apple-silicon) for more details.*
66-
6765
For example, for building a JAR that uses TensorFlow and is targeted to be deployed only on Linux
6866
systems with no GPU support, you should add the following dependencies:
6967
```xml
@@ -98,7 +96,7 @@ native dependencies as follows:
9896
<groupId>org.tensorflow</groupId>
9997
<artifactId>tensorflow-core-native</artifactId>
10098
<version>0.5.0</version>
101-
<classifier>macosx-x86_64</classifier>
99+
<classifier>macosx-arm64</classifier>
102100
</dependency>
103101
<dependency>
104102
<groupId>org.tensorflow</groupId>
@@ -116,7 +114,7 @@ Only one dependency can be added per platform, meaning that you cannot add nativ
116114
In some cases, it might be preferable to add a single dependency that includes transitively all the artifacts
117115
required to run TensorFlow Java on any [supported platforms](README.md#individual-dependencies)
118116

119-
- `tensorflow-core-platform`: Includes supports for `linux-x86_64`, `macosx-x86_64` and `windows-x86_64`
117+
- `tensorflow-core-platform`: Includes `tensorflow-core-api`, plus native artifacts for `linux-x86_64`, `macosx-arm64`, `macosx-x86_64` and `windows-x86_64`
120118

121119
For example, to run TensorFlow Java on any platform for which a binary is being distributed by this project, you can
122120
simply add this dependency to your application:

RELEASE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ for temporary staging.
160160
2. Execute the `release.sh` script. This will deploy artifacts on OSS Sonatype. All native artifacts
161161
previously temporarily staged by GitHub Actions will be fetched, signed and redeployed as well.
162162
163-
The script takes in paramater the sequence number of the staging repository created in OSSRH
163+
The script takes in a parameter the sequence number of the staging repository created in OSSRH
164164
by the GitHub Actions workflow. You can retrieve this ID by looking in the staging repositories
165165
in OSSRH console directly, or check at the output of the step `Create Staging Repository` of the
166166
`prepare` job in the workflow execution, where the ID is printed.

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
</snapshots>
6464
</repository>
6565
</repositories>
66+
6667
<pluginRepositories>
6768
<pluginRepository>
6869
<id>ossrh-snapshots</id>

release.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434
# To get a shell to poke around the maven artifacts with.
3535
if [[ -z "${CMD}" ]]
3636
then
37-
CMD="mvn clean deploy -B -e --settings ./settings.xml -Pdeploying -Preleasing"
37+
CMD="mvn clean deploy -B -e --settings ./settings.xml -Pdeploying -Preleasing -DstagingRepositoryId=${STAGING_SEQ}"
3838
fi
3939

4040
export GPG_TTY=$(tty)
@@ -46,8 +46,6 @@ then
4646
fi
4747

4848
docker run \
49-
-e IN_CONTAINER="true" \
50-
-e STAGING_SEQ="${STAGING_SEQ}" \
5149
-e GPG_TTY="${GPG_TTY}" \
5250
-v ${PWD}:/tensorflow-java \
5351
-v ${HOME}/.gnupg:/root/.gnupg \

tensorflow-core/tensorflow-core-api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<description>Platform-dependent native code and pure-Java code for the TensorFlow machine intelligence library.</description>
1616

1717
<properties>
18-
<ndarray.version>0.4.0</ndarray.version>
18+
<ndarray.version>1.0.0-rc.1</ndarray.version>
1919
<truth.version>1.1.5</truth.version>
2020
<test.download.skip>false</test.download.skip>
2121
<test.download.folder>${project.build.directory}/tf-text-download/</test.download.folder>

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TBfloat16.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static TBfloat16 tensorOf(Shape shape) {
104104
* @return the new tensor
105105
*/
106106
static TBfloat16 tensorOf(Shape shape, FloatDataBuffer data) {
107-
return Tensor.of(TBfloat16.class, shape, d -> d.write(data));
107+
return Tensor.of(TBfloat16.class, shape, d -> d.copyFrom(data));
108108
}
109109

110110
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TBool.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static TBool tensorOf(Shape shape) {
9595
* @return the new tensor
9696
*/
9797
static TBool tensorOf(Shape shape, BooleanDataBuffer data) {
98-
return Tensor.of(TBool.class, shape, d -> d.write(data));
98+
return Tensor.of(TBool.class, shape, d -> d.copyFrom(data));
9999
}
100100

101101
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TFloat16.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static TFloat16 tensorOf(Shape shape) {
101101
* @return the new tensor
102102
*/
103103
static TFloat16 tensorOf(Shape shape, FloatDataBuffer data) {
104-
return Tensor.of(TFloat16.class, shape, d -> d.write(data));
104+
return Tensor.of(TFloat16.class, shape, d -> d.copyFrom(data));
105105
}
106106

107107
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TFloat32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static TFloat32 tensorOf(Shape shape) {
8989
* @return the new tensor
9090
*/
9191
static TFloat32 tensorOf(Shape shape, FloatDataBuffer data) {
92-
return Tensor.of(TFloat32.class, shape, d -> d.write(data));
92+
return Tensor.of(TFloat32.class, shape, d -> d.copyFrom(data));
9393
}
9494

9595
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TFloat64.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static TFloat64 tensorOf(Shape shape) {
8989
* @return the new tensor
9090
*/
9191
static TFloat64 tensorOf(Shape shape, DoubleDataBuffer data) {
92-
return Tensor.of(TFloat64.class, shape, d -> d.write(data));
92+
return Tensor.of(TFloat64.class, shape, d -> d.copyFrom(data));
9393
}
9494

9595
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TInt32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static TInt32 tensorOf(Shape shape) {
8888
* @return the new tensor
8989
*/
9090
static TInt32 tensorOf(Shape shape, IntDataBuffer data) {
91-
return Tensor.of(TInt32.class, shape, d -> d.write(data));
91+
return Tensor.of(TInt32.class, shape, d -> d.copyFrom(data));
9292
}
9393

9494
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TInt64.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static TInt64 tensorOf(Shape shape) {
8888
* @return the new tensor
8989
*/
9090
static TInt64 tensorOf(Shape shape, LongDataBuffer data) {
91-
return Tensor.of(TInt64.class, shape, d -> d.write(data));
91+
return Tensor.of(TInt64.class, shape, d -> d.copyFrom(data));
9292
}
9393

9494
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TUint16.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static TUint16 tensorOf(Shape shape) {
8989
* @return the new tensor
9090
*/
9191
static TUint16 tensorOf(Shape shape, ShortDataBuffer data) {
92-
return Tensor.of(TUint16.class, shape, d -> d.write(data));
92+
return Tensor.of(TUint16.class, shape, d -> d.copyFrom(data));
9393
}
9494

9595
/**

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/types/TUint8.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static TUint8 tensorOf(Shape shape) {
8888
* @return the new tensor
8989
*/
9090
static TUint8 tensorOf(Shape shape, ByteDataBuffer data) {
91-
return Tensor.of(TUint8.class, shape, d -> d.write(data));
91+
return Tensor.of(TUint8.class, shape, d -> d.copyFrom(data));
9292
}
9393

9494
/**

0 commit comments

Comments
 (0)