From d60dfc90a38f9f25f6bc6227f5794657ea25a1e4 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 26 Sep 2025 16:21:45 -0400 Subject: [PATCH 1/5] Adding requirements.txt for doc generation and a few small Javadoc fixes. --- docs/tools/requirements.txt | 3 +++ .../internal/buffer/ByteSequenceTensorBuffer.java | 9 ++++----- .../org/tensorflow/internal/types/TUint16Mapper.java | 2 +- .../tensorflow/framework/losses/impl/LossesHelper.java | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 docs/tools/requirements.txt diff --git a/docs/tools/requirements.txt b/docs/tools/requirements.txt new file mode 100644 index 00000000000..681ed3bdde8 --- /dev/null +++ b/docs/tools/requirements.txt @@ -0,0 +1,3 @@ +GitPython +requests +tensorflow-docs \ No newline at end of file diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java index bd886d776b7..054fa1e5d63 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java @@ -40,10 +40,9 @@ *

The values are stored as an array of {@link TF_TString}, internally wrapped with {@code * tensorflow::tstring}, which is essentially a portable version of {@code std::string}. * - *

The data of the buffer must be initialized only once, by calling {@link #init(NdArray, - * Function)}, and the buffer must have been allocated with enough space (use {@link - * #computeSize(NdArray, Function)} priory to know exactly how many bytes are required to store the - * data). + *

The data of the buffer must be initialized only once, by calling {@link #init}, and the buffer + * must have been allocated with enough space (use {@link #computeSize} priory to know exactly how + * many bytes are required to store the data). * *

After its data has been initialized, the buffer is read-only as it is not possible to change * safely a value without reinitializing the whole data. @@ -66,7 +65,7 @@ public static long computeSize(ByteSequenceProvider byteSequenceProvider) * *

While it is not enforced programmatically, it is mandatory that this method is called only * once after the creation of the buffer. The buffer must have been allocated according to the - * same set of data, calling {@link #computeSize(NdArray, Function)} priory to make sure there is + * same set of data, calling {@link #computeSize} priory to make sure there is * enough space to store it. * * @param byteSequenceProvider produces sequences of bytes to use as the tensor data diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/types/TUint16Mapper.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/types/TUint16Mapper.java index d563302319a..43faa1199ed 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/types/TUint16Mapper.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/types/TUint16Mapper.java @@ -29,7 +29,7 @@ import org.tensorflow.types.TUint16; /** - * Maps memory of {@link org.tensorflow.proto.DataType#DT_Uint16} tensors to a n-dimensional data + * Maps memory of {@link org.tensorflow.proto.DataType#DT_UINT16} tensors to a n-dimensional data * space. */ public final class TUint16Mapper extends TensorMapper { diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/impl/LossesHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/impl/LossesHelper.java index 6c40149f3de..ccd801c4fea 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/impl/LossesHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/impl/LossesHelper.java @@ -299,7 +299,6 @@ private static Operand reduceWeightedLoss( * * @param tf the TensorFlow Ops * @param losses Operand whose elements contain individual loss measurements. - * @param numElements The number of measurable elements in losses. * @param the data type of the losses * @return A scalar representing the mean of losses. If numElements is * zero, then zero is returned. From 10655b01f86bbec0aeba3a85fcec64e43c202096 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 31 Oct 2025 15:19:15 -0400 Subject: [PATCH 2/5] Bumping maven-javadoc-plugin version. --- pom.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1a1853b15de..5db56c6d329 100644 --- a/pom.xml +++ b/pom.xml @@ -546,8 +546,17 @@ maven-javadoc-plugin - 3.6.0 + 3.12.0 + + javadoc-site + + javadoc + + + true + + attach-javadocs @@ -555,6 +564,7 @@ true + true From ab6fff2e0e588d0f5c839047ca4485f931c40ba5 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 31 Oct 2025 15:26:59 -0400 Subject: [PATCH 3/5] Spotless fixes. --- .../internal/buffer/ByteSequenceTensorBuffer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java index 054fa1e5d63..3bf262bec14 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/internal/buffer/ByteSequenceTensorBuffer.java @@ -23,13 +23,11 @@ import static org.tensorflow.internal.c_api.global.tensorflow.TF_TString_GetSize; import java.nio.ReadOnlyBufferException; -import java.util.function.Function; import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.Loader; import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.PointerScope; import org.tensorflow.internal.c_api.TF_TString; -import org.tensorflow.ndarray.NdArray; import org.tensorflow.ndarray.buffer.DataBuffer; import org.tensorflow.ndarray.impl.buffer.AbstractDataBuffer; import org.tensorflow.ndarray.impl.buffer.Validator; @@ -65,8 +63,8 @@ public static long computeSize(ByteSequenceProvider byteSequenceProvider) * *

While it is not enforced programmatically, it is mandatory that this method is called only * once after the creation of the buffer. The buffer must have been allocated according to the - * same set of data, calling {@link #computeSize} priory to make sure there is - * enough space to store it. + * same set of data, calling {@link #computeSize} priory to make sure there is enough space to + * store it. * * @param byteSequenceProvider produces sequences of bytes to use as the tensor data */ From 59319658a0139a492540349566a23917c653f39e Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 31 Oct 2025 15:30:28 -0400 Subject: [PATCH 4/5] Module info help text. --- .../tensorflow-core-api/src/main/java/module-info.java | 2 ++ .../tensorflow-core-generator/src/main/java/module-info.java | 5 +++++ .../tensorflow-core-native/src/main/java/module-info.java | 2 ++ tensorflow-framework/src/main/java/module-info.java | 2 ++ 4 files changed, 11 insertions(+) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/module-info.java b/tensorflow-core/tensorflow-core-api/src/main/java/module-info.java index f3e4875193d..b12e7042b48 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/module-info.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/module-info.java @@ -14,6 +14,8 @@ limitations under the License. ======================================================================= */ + +/** Core module implementing the TensorFlow Java API and operator definitions. */ module tensorflow { requires transitive org.tensorflow.ndarray; requires transitive tensorflow.nativelib; diff --git a/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java b/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java index 1b155bc3af1..b67d77568d1 100644 --- a/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java +++ b/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java @@ -14,6 +14,11 @@ limitations under the License. ======================================================================= */ + +/** + * Code to generate the Java side implementations of TensorFlow's ops based on the TensorFlow op + * definition files. + */ module tensorflow.generator { requires tensorflow.nativelib; requires java.compiler; diff --git a/tensorflow-core/tensorflow-core-native/src/main/java/module-info.java b/tensorflow-core/tensorflow-core-native/src/main/java/module-info.java index 2f7628187e3..f9fe6e3ea3d 100644 --- a/tensorflow-core/tensorflow-core-native/src/main/java/module-info.java +++ b/tensorflow-core/tensorflow-core-native/src/main/java/module-info.java @@ -14,6 +14,8 @@ limitations under the License. ======================================================================= */ + +/** Native interop with the TensorFlow C API. */ module tensorflow.nativelib { requires transitive org.bytedeco.javacpp; requires transitive com.google.protobuf; diff --git a/tensorflow-framework/src/main/java/module-info.java b/tensorflow-framework/src/main/java/module-info.java index 2c500bfc459..65251a7257c 100644 --- a/tensorflow-framework/src/main/java/module-info.java +++ b/tensorflow-framework/src/main/java/module-info.java @@ -14,6 +14,8 @@ limitations under the License. ======================================================================= */ + +/** Higher level TensorFlow framework containing model definition and training operations. */ module tensorflow.framework { requires tensorflow; requires org.tensorflow.ndarray; From 9e6abe363fa62310c1234110c083c2da971b2f54 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 31 Oct 2025 16:20:44 -0400 Subject: [PATCH 5/5] Fixing the pom files so the Javadoc generates correctly. --- pom.xml | 25 ++++++++++++----- tensorflow-core/tensorflow-core-api/pom.xml | 24 ---------------- .../src/main/java/module-info.java | 4 +-- .../tensorflow-core-native/pom.xml | 28 ------------------- .../src/main/java/module-info.java | 4 +-- 5 files changed, 22 insertions(+), 63 deletions(-) diff --git a/pom.xml b/pom.xml index 5db56c6d329..0d8086d9d59 100644 --- a/pom.xml +++ b/pom.xml @@ -547,25 +547,36 @@ maven-javadoc-plugin 3.12.0 + + ./docs/overview.md + + Copyright 2015, 2025 The TensorFlow Authors. All Rights Reserved. + + -Xmaxerrs + 65536 + -Xmaxwarns + 65536 + + false + 256m + 2048m + + https://protobuf.dev/reference/java/api-docs + https://bytedeco.org/javacpp/apidocs + + javadoc-site javadoc - - true - attach-javadocs jar - - true - true - diff --git a/tensorflow-core/tensorflow-core-api/pom.xml b/tensorflow-core/tensorflow-core-api/pom.xml index 0b87d9a17c2..59e1703d355 100644 --- a/tensorflow-core/tensorflow-core-api/pom.xml +++ b/tensorflow-core/tensorflow-core-api/pom.xml @@ -220,30 +220,6 @@ - - maven-javadoc-plugin - 3.6.0 - - - attach-javadocs - - jar - - - - -Xmaxerrs - 65536 - -Xmaxwarns - 65536 - - false - 256m - 2048m - - - - - org.codehaus.mojo exec-maven-plugin diff --git a/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java b/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java index b67d77568d1..a6efd2561a3 100644 --- a/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java +++ b/tensorflow-core/tensorflow-core-generator/src/main/java/module-info.java @@ -21,11 +21,11 @@ */ module tensorflow.generator { requires tensorflow.nativelib; - requires java.compiler; + requires transitive java.compiler; requires com.github.javaparser.core; requires com.google.protobuf; requires com.google.common; - requires com.squareup.javapoet; + requires transitive com.squareup.javapoet; requires org.commonmark; requires spring.core; diff --git a/tensorflow-core/tensorflow-core-native/pom.xml b/tensorflow-core/tensorflow-core-native/pom.xml index 59d84eb014d..bb9eb053c33 100644 --- a/tensorflow-core/tensorflow-core-native/pom.xml +++ b/tensorflow-core/tensorflow-core-native/pom.xml @@ -639,34 +639,6 @@ - - - maven-javadoc-plugin - 3.7.0 - - - attach-javadocs - - jar - - - - -Xmaxerrs - 65536 - -Xmaxwarns - 65536 - - false - 256m - 2048m - - https://protobuf.dev/reference/java/api-docs - http://bytedeco.org/javacpp/apidocs - - - - - diff --git a/tensorflow-framework/src/main/java/module-info.java b/tensorflow-framework/src/main/java/module-info.java index 65251a7257c..715d68331cc 100644 --- a/tensorflow-framework/src/main/java/module-info.java +++ b/tensorflow-framework/src/main/java/module-info.java @@ -17,8 +17,8 @@ /** Higher level TensorFlow framework containing model definition and training operations. */ module tensorflow.framework { - requires tensorflow; - requires org.tensorflow.ndarray; + requires transitive tensorflow; + requires transitive org.tensorflow.ndarray; exports org.tensorflow.framework.activations; exports org.tensorflow.framework.constraints;