Java: Tweak to address some Javadoc errors.

PiperOrigin-RevId: 171987329
This commit is contained in:
Asim Shankar 2017-10-12 11:31:21 -07:00 committed by TensorFlower Gardener
parent 4241b86dc8
commit 453515d166
5 changed files with 32 additions and 28 deletions

View File

@ -19,9 +19,7 @@ import java.util.HashMap;
import java.util.Map;
import org.tensorflow.types.UInt8;
/**
* Represents the type of elements in a {@link Tensor} as an enum.
*/
/** Represents the type of elements in a {@link Tensor} as an enum. */
public enum DataType {
/** 32-bit single precision floating point. */
FLOAT(1),
@ -59,7 +57,7 @@ public enum DataType {
int c() {
return value;
}
// Cached to avoid copying it
private static final DataType[] values = values();
@ -77,6 +75,9 @@ public enum DataType {
* Returns the DataType of a Tensor whose elements have the type specified by class {@code c}.
*
* @param c The class describing the TensorFlow type of interest.
* @return The {@code DataType} enum corresponding to {@code c}.
* @throws IllegalArgumentException if objects of {@code c} do not correspond to a TensorFlow
* datatype.
*/
public static DataType fromClass(Class<?> c) {
DataType dtype = typeCodes.get(c);

View File

@ -20,8 +20,8 @@ import java.util.Objects;
/**
* A symbolic handle to a tensor produced by an {@link Operation}.
*
* <p>An Output<T> is a symbolic handle to a Tensor<T>. The value of the tensor is computed by
* executing the {@link Operation} in a {@link Session}.
* <p>An {@code Output<T>} is a symbolic handle to a {@code Tensor<T>}. The value of the tensor is
* computed by executing the {@link Operation} in a {@link Session}.
*
* <p>By implementing the {@link Operand} interface, instances of this class also act as operands to
* {@link org.tensorflow.op.Op Op} instances.

View File

@ -47,11 +47,11 @@ public final class Tensor<T> implements AutoCloseable {
/**
* Creates a Tensor from a Java object.
*
* <p>A {@code Tensor} is a multi-dimensional array of elements of a limited set of types ({@link
* types}), so not all Java objects can be converted to a {@code Tensor}. In particular, the
* argument {@code obj} must be either a primitive (float, double, int, long, boolean, byte) or a
* multi-dimensional array of one of those primitives. The argument {@code type} specifies how to
* interpret the first argument as a TensorFlow type. For example:
* <p>A {@code Tensor} is a multi-dimensional array of elements of a limited set of types. Not all
* Java objects can be converted to a {@code Tensor}. In particular, the argument {@code obj} must
* be either a primitive (float, double, int, long, boolean, byte) or a multi-dimensional array of
* one of those primitives. The argument {@code type} specifies how to interpret the first
* argument as a TensorFlow type. For example:
*
* <pre>{@code
* // Valid: A 64-bit integer scalar.
@ -94,9 +94,9 @@ public final class Tensor<T> implements AutoCloseable {
* Tensor<String> m = Tensor.create(matrix, String.class);
* }</pre>
*
* @param obj The object to convert to a Tensor<T>. Note that whether it is compatible with the
* type T is not checked by the type system. For type-safe creation of tensors, use {@link
* Tensors}.
* @param obj The object to convert to a {@code Tensor<T>}. Note that whether it is compatible
* with the type T is not checked by the type system. For type-safe creation of tensors, use
* {@link Tensors}.
* @param type The class object representing the type T.
* @throws IllegalArgumentException if {@code obj} is not compatible with the TensorFlow type
* system.
@ -229,7 +229,8 @@ public final class Tensor<T> implements AutoCloseable {
*
* <p>Creates a Tensor with the provided shape of any type where the tensor's data has been
* encoded into {@code data} as per the specification of the TensorFlow <a
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C API</a>.
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C
* API</a>.
*
* @param <T> the tensor element type
* @param type the tensor element type, represented as a class object.
@ -249,7 +250,8 @@ public final class Tensor<T> implements AutoCloseable {
*
* <p>Creates a Tensor with the provided shape of any type where the tensor's data has been
* encoded into {@code data} as per the specification of the TensorFlow <a
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C API</a>.
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C
* API</a>.
*
* @param <T> The tensor element type
* @param type the tensor element type, specified as a DataType. This must agree with T.

View File

@ -134,10 +134,11 @@ public final class Constant<T> extends PrimitiveOp implements Operand<T> {
*
* <p>Creates a Constant with the provided shape of any type where the constant data has been
* encoded into {@code data} as per the specification of the TensorFlow <a
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C API</a>.
* href="https://www.tensorflow.org/code/tensorflow/c/c_api.h">C
* API</a>.
*
* @param scope is a scope used to add the underlying operation.
* @param dataType the tensor datatype.
* @param type the tensor datatype.
* @param shape the tensor shape.
* @param data a buffer containing the tensor data.
* @throws IllegalArgumentException If the tensor datatype or shape is not compatible with the

View File

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