Skip to content

Commit 453515d

Browse files
asimshankartensorflower-gardener
authored andcommitted
Java: Tweak to address some Javadoc errors.
PiperOrigin-RevId: 171987329
1 parent 4241b86 commit 453515d

5 files changed

Lines changed: 32 additions & 28 deletions

File tree

tensorflow/java/src/main/java/org/tensorflow/DataType.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
import java.util.Map;
2020
import org.tensorflow.types.UInt8;
2121

22-
/**
23-
* Represents the type of elements in a {@link Tensor} as an enum.
24-
*/
22+
/** Represents the type of elements in a {@link Tensor} as an enum. */
2523
public enum DataType {
2624
/** 32-bit single precision floating point. */
2725
FLOAT(1),
@@ -59,7 +57,7 @@ public enum DataType {
5957
int c() {
6058
return value;
6159
}
62-
60+
6361
// Cached to avoid copying it
6462
private static final DataType[] values = values();
6563

@@ -77,6 +75,9 @@ static DataType fromC(int c) {
7775
* Returns the DataType of a Tensor whose elements have the type specified by class {@code c}.
7876
*
7977
* @param c The class describing the TensorFlow type of interest.
78+
* @return The {@code DataType} enum corresponding to {@code c}.
79+
* @throws IllegalArgumentException if objects of {@code c} do not correspond to a TensorFlow
80+
* datatype.
8081
*/
8182
public static DataType fromClass(Class<?> c) {
8283
DataType dtype = typeCodes.get(c);

tensorflow/java/src/main/java/org/tensorflow/Output.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
/**
2121
* A symbolic handle to a tensor produced by an {@link Operation}.
2222
*
23-
* <p>An Output<T> is a symbolic handle to a Tensor<T>. The value of the tensor is computed by
24-
* executing the {@link Operation} in a {@link Session}.
23+
* <p>An {@code Output<T>} is a symbolic handle to a {@code Tensor<T>}. The value of the tensor is
24+
* computed by executing the {@link Operation} in a {@link Session}.
2525
*
2626
* <p>By implementing the {@link Operand} interface, instances of this class also act as operands to
2727
* {@link org.tensorflow.op.Op Op} instances.

tensorflow/java/src/main/java/org/tensorflow/Tensor.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public final class Tensor<T> implements AutoCloseable {
4747
/**
4848
* Creates a Tensor from a Java object.
4949
*
50-
* <p>A {@code Tensor} is a multi-dimensional array of elements of a limited set of types ({@link
51-
* types}), so not all Java objects can be converted to a {@code Tensor}. In particular, the
52-
* argument {@code obj} must be either a primitive (float, double, int, long, boolean, byte) or a
53-
* multi-dimensional array of one of those primitives. The argument {@code type} specifies how to
54-
* interpret the first argument as a TensorFlow type. For example:
50+
* <p>A {@code Tensor} is a multi-dimensional array of elements of a limited set of types. Not all
51+
* Java objects can be converted to a {@code Tensor}. In particular, the argument {@code obj} must
52+
* be either a primitive (float, double, int, long, boolean, byte) or a multi-dimensional array of
53+
* one of those primitives. The argument {@code type} specifies how to interpret the first
54+
* argument as a TensorFlow type. For example:
5555
*
5656
* <pre>{@code
5757
* // Valid: A 64-bit integer scalar.
@@ -94,9 +94,9 @@ public final class Tensor<T> implements AutoCloseable {
9494
* Tensor<String> m = Tensor.create(matrix, String.class);
9595
* }</pre>
9696
*
97-
* @param obj The object to convert to a Tensor<T>. Note that whether it is compatible with the
98-
* type T is not checked by the type system. For type-safe creation of tensors, use {@link
99-
* Tensors}.
97+
* @param obj The object to convert to a {@code Tensor<T>}. Note that whether it is compatible
98+
* with the type T is not checked by the type system. For type-safe creation of tensors, use
99+
* {@link Tensors}.
100100
* @param type The class object representing the type T.
101101
* @throws IllegalArgumentException if {@code obj} is not compatible with the TensorFlow type
102102
* system.
@@ -229,7 +229,8 @@ public static Tensor<Long> create(long[] shape, LongBuffer data) {
229229
*
230230
* <p>Creates a Tensor with the provided shape of any type where the tensor's data has been
231231
* encoded into {@code data} as per the specification of the TensorFlow <a
232-
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C API</a>.
232+
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C
233+
* API</a>.
233234
*
234235
* @param <T> the tensor element type
235236
* @param type the tensor element type, represented as a class object.
@@ -249,7 +250,8 @@ public static <T> Tensor<T> create(Class<T> type, long[] shape, ByteBuffer data)
249250
*
250251
* <p>Creates a Tensor with the provided shape of any type where the tensor's data has been
251252
* encoded into {@code data} as per the specification of the TensorFlow <a
252-
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C API</a>.
253+
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C
254+
* API</a>.
253255
*
254256
* @param <T> The tensor element type
255257
* @param type the tensor element type, specified as a DataType. This must agree with T.

tensorflow/java/src/main/java/org/tensorflow/op/core/Constant.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ public static Constant<Long> create(Scope scope, long[] shape, LongBuffer data)
134134
*
135135
* <p>Creates a Constant with the provided shape of any type where the constant data has been
136136
* encoded into {@code data} as per the specification of the TensorFlow <a
137-
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C API</a>.
137+
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C
138+
* API</a>.
138139
*
139140
* @param scope is a scope used to add the underlying operation.
140-
* @param dataType the tensor datatype.
141+
* @param type the tensor datatype.
141142
* @param shape the tensor shape.
142143
* @param data a buffer containing the tensor data.
143144
* @throws IllegalArgumentException If the tensor datatype or shape is not compatible with the

tensorflow/java/src/main/java/org/tensorflow/types/package-info.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
==============================================================================*/
1515

1616
/**
17-
* Defines classes that represent TensorFlow data types. For each possible data type
18-
* that can be used in a tensor, there is a corresponding class that
19-
* is used to represent it. For example, the TensorFlow int32 type is represented by
20-
* the type {@link Integer} and by the class object {@code Integer.class}. The former is used to
21-
* support compile-time checking of tensor element types and the latter is used for
22-
* run-time checking of element types. Classes appearing in this package, such as
23-
* UInt8, represent TensorFlow data types for which there is no existing Java equivalent.
17+
* Defines classes that represent TensorFlow data types. For each possible data type that can be
18+
* used in a tensor, there is a corresponding class that is used to represent it. For example, the
19+
* TensorFlow int32 type is represented by the type {@link java.lang.Integer} and by the class
20+
* object {@code Integer.class}. The former is used to support compile-time checking of tensor
21+
* element types and the latter is used for run-time checking of element types. Classes appearing in
22+
* this package, such as UInt8, represent TensorFlow data types for which there is no existing Java
23+
* equivalent.
2424
*
25-
* <p>TensorFlow element types are also separately represented by the {@link DataType} enum, with
26-
* one enum value per element type. The enum representation is not usually needed, but
27-
* can be obtained using {@link DataType.fromClass}.
25+
* <p>TensorFlow element types are also separately represented by the {@link
26+
* org.tensorflow.DataType} enum, with one enum value per element type. The enum representation is
27+
* not usually needed, but can be obtained using {@link org.tensorflow.DataType.fromClass}.
2828
*/
2929
package org.tensorflow.types;

0 commit comments

Comments
 (0)