contents) {
return DecodeGif.create(scope, contents);
}
+ /**
+ * Function for decode_bmp, decode_gif, decode_jpeg, and decode_png.
+ *
+ * Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the
+ * appropriate operation to convert the input bytes string into a Tensor of type
+ * dtype.
+ *
+ * NOTE: decode_gif returns a 4-D array [num_frames, height, width, 3], as
+ * opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays
+ * [height, width, num_channels]. Make sure to take this into account when
+ * constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or
+ * PNG files. Alternately, set the expand_animations argument of this function to
+ * False, in which case the op will return 3-dimensional tensors and will truncate
+ * animated GIF files to the first frame.
+ *
+ * NOTE: If the first frame of an animated GIF does not occupy the entire
+ * canvas (maximum frame width x maximum frame height), then it fills the
+ * unoccupied areas (in the first frame) with zeros (black). For frames after the
+ * first frame that does not occupy the entire canvas, it uses the previous
+ * frame to fill the unoccupied areas.
+ *
+ * @param data type for {@code image()} output
+ * @param contents 0-D. The encoded image bytes.
+ * @param options carries optional attributes values
+ * @return a new instance of DecodeImage
+ */
+ public DecodeImage decodeImage(Operand contents,
+ DecodeImage.Options... options) {
+ return DecodeImage.create(scope, contents, options);
+ }
+
+ /**
+ * Function for decode_bmp, decode_gif, decode_jpeg, and decode_png.
+ *
+ * Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the
+ * appropriate operation to convert the input bytes string into a Tensor of type
+ * dtype.
+ *
+ * NOTE: decode_gif returns a 4-D array [num_frames, height, width, 3], as
+ * opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays
+ * [height, width, num_channels]. Make sure to take this into account when
+ * constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or
+ * PNG files. Alternately, set the expand_animations argument of this function to
+ * False, in which case the op will return 3-dimensional tensors and will truncate
+ * animated GIF files to the first frame.
+ *
+ * NOTE: If the first frame of an animated GIF does not occupy the entire
+ * canvas (maximum frame width x maximum frame height), then it fills the
+ * unoccupied areas (in the first frame) with zeros (black). For frames after the
+ * first frame that does not occupy the entire canvas, it uses the previous
+ * frame to fill the unoccupied areas.
+ *
+ * @param data type for {@code image()} output
+ * @param contents 0-D. The encoded image bytes.
+ * @param dtype The desired DType of the returned Tensor.
+ * @param options carries optional attributes values
+ * @return a new instance of DecodeImage
+ */
+ public DecodeImage decodeImage(Operand contents, Class dtype,
+ DecodeImage.Options... options) {
+ return DecodeImage.create(scope, contents, dtype, options);
+ }
+
/**
* Decode a JPEG-encoded image to a uint8 tensor.
*
@@ -945,6 +1010,87 @@ public ScaleAndTranslate scaleAndTranslate(Operand extends TNumber> images,
return ScaleAndTranslate.create(scope, images, size, scale, translation, options);
}
+ /**
+ * Generate a randomly distorted bounding box for an image deterministically.
+ *
+ * Bounding box annotations are often supplied in addition to ground-truth labels
+ * in image recognition or object localization tasks. A common technique for
+ * training such a system is to randomly distort an image while preserving its
+ * content, i.e. data augmentation. This Op, given the same `seed`,
+ * deterministically outputs a randomly distorted localization of an object, i.e.
+ * bounding box, given an `image_size`, `bounding_boxes` and a series of
+ * constraints.
+ *
+ * The output of this Op is a single bounding box that may be used to crop the
+ * original image. The output is returned as 3 tensors: `begin`, `size` and
+ * `bboxes`. The first 2 tensors can be fed directly into `tf.slice` to crop the
+ * image. The latter may be supplied to `tf.image.draw_bounding_boxes` to visualize
+ * what the bounding box looks like.
+ *
+ * Bounding boxes are supplied and returned as `[y_min, x_min, y_max, x_max]`. The
+ * bounding box coordinates are floats in `[0.0, 1.0]` relative to the width and
+ * the height of the underlying image.
+ *
+ * The output of this Op is guaranteed to be the same given the same `seed` and is
+ * independent of how many times the function is called, and independent of global
+ * seed settings (e.g. `tf.random.set_seed`).
+ *
+ * Example usage:
+ *
+ * >>> image = np.array([[[1], [2], [3]], [[4], [5], [6]], [[7], [8], [9]]])
+ * >>> bbox = tf.constant(
+ * ... [0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4])
+ * >>> seed = (1, 2)
+ * >>> # Generate a single distorted bounding box.
+ * >>> bbox_begin, bbox_size, bbox_draw = (
+ * ... tf.image.stateless_sample_distorted_bounding_box(
+ * ... tf.shape(image), bounding_boxes=bbox, seed=seed))
+ * >>> # Employ the bounding box to distort the image.
+ * >>> tf.slice(image, bbox_begin, bbox_size)
+ *
+ * >>> # Draw the bounding box in an image summary.
+ * >>> colors = np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]])
+ * >>> tf.image.draw_bounding_boxes(
+ * ... tf.expand_dims(tf.cast(image, tf.float32),0), bbox_draw, colors)
+ *
+ *
+ * Note that if no bounding box information is available, setting
+ * `use_image_if_no_bounding_boxes = true` will assume there is a single implicit
+ * bounding box covering the whole image. If `use_image_if_no_bounding_boxes` is
+ * false and no bounding boxes are supplied, an error is raised.
+ *
+ * @param data type for {@code begin()} output
+ * @param imageSize 1-D, containing `[height, width, channels]`.
+ * @param boundingBoxes 3-D with shape `[batch, N, 4]` describing the N bounding boxes
+ * associated with the image.
+ * @param minObjectCovered The cropped area of the image must contain at least this
+ * fraction of any bounding box supplied. The value of this parameter should be
+ * non-negative. In the case of 0, the cropped area does not need to overlap
+ * any of the bounding boxes supplied.
+ * @param seed 1-D with shape `[2]`. The seed to the random number generator. Must have dtype
+ * `int32` or `int64`. (When using XLA, only `int32` is allowed.)
+ * @param options carries optional attributes values
+ * @return a new instance of StatelessSampleDistortedBoundingBox
+ */
+ public StatelessSampleDistortedBoundingBox statelessSampleDistortedBoundingBox(
+ Operand imageSize, Operand boundingBoxes, Operand minObjectCovered,
+ Operand extends TNumber> seed, StatelessSampleDistortedBoundingBox.Options... options) {
+ return StatelessSampleDistortedBoundingBox.create(scope, imageSize, boundingBoxes, minObjectCovered, seed, options);
+ }
+
/**
* Get the parent {@link Ops} object.
*/
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java
index f5d8d22e85e..a8e9c0d8a4c 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/LinalgOps.java
@@ -511,10 +511,9 @@ public EuclideanNorm euclideanNorm(Operand input,
}
/**
- * Computes the inverse of one or more square invertible matrices or their
- *
- * adjoints (conjugate transposes).
+ * Computes the inverse of one or more square invertible matrices or their adjoints (conjugate transposes).
*
+ *
* The input is a tensor of shape `[..., M, M]` whose inner-most 2 dimensions
* form square matrices. The output is a tensor of the same shape as the input
* containing the inverse for all input submatrices `[..., :, :]`.
@@ -611,9 +610,9 @@ public LoadAndRemapMatrix loadAndRemapMatrix(Operand ckptPath,
* The input is a tensor of shape `[N, M, M]` whose inner-most 2 dimensions
* form square matrices. The outputs are two tensors containing the signs and
* absolute values of the log determinants for all N input submatrices
- * `[..., :, :]` such that the determinant = sign*exp(log_abs_determinant).
- * The log_abs_determinant is computed as det(P)*sum(log(diag(LU))) where LU
- * is the LU decomposition of the input and P is the corresponding
+ * `[..., :, :]` such that `determinant = sign*exp(log_abs_determinant)`.
+ * The `log_abs_determinant` is computed as `det(P)*sum(log(diag(LU)))` where `LU`
+ * is the `LU` decomposition of the input and `P` is the corresponding
* permutation matrix.
*
* @param data type for {@code sign()} output
@@ -1334,6 +1333,10 @@ public MatrixSolveLs matrixSolveLs(Operand matrix, Opera
*
* Computes the QR decomposition of each inner matrix in `tensor` such that
* `tensor[..., :, :] = q[..., :, :] * r[..., :,:])`
+ *
+ * Currently, the gradient for the QR decomposition is well-defined only when
+ * the first `P` columns of the inner matrix are linearly independent, where
+ * `P` is the minimum of `M` and `N`, the 2 inner-most dimmensions of `tensor`.
*
{@code
* # a is a tensor.
* # q is a tensor of orthonormal matrices.
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java
index 5027828c262..a70e6d72717 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java
@@ -182,6 +182,11 @@ public AccumulateN accumulateN(Iterable> inputs,
/**
* Computes acos of x element-wise.
+ *
+ *
+ * Provided an input tensor, the `tf.math.acos` operation returns the inverse cosine of each element of the tensor. If `y = tf.math.cos(x)` then, `x = tf.math.acos(y)`.
+ *
+ * Input range is `[-1, 1]` and the output has a range of `[0, pi]`.
*
* @param data type for {@code y()} output
* @param x
@@ -214,6 +219,10 @@ public Acosh acosh(Operand x) {
*
* NOTE: `math.Add` supports broadcasting. `AddN` does not. More about broadcasting
* [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
+ *
+ * Given two input tensors, the `tf.add` operation computes the sum for every element in the tensor.
+ *
+ * Both input and output have a range `(-inf, inf)`.
*
* @param data type for {@code z()} output
* @param x
@@ -2072,7 +2081,7 @@ public Square square(Operand x) {
}
/**
- * Returns (x - y)(x - y) element-wise.
+ * Returns conj(x - y)(x - y) element-wise.
*
* NOTE: `math.SquaredDifference` supports broadcasting. More about broadcasting
* [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)
@@ -2129,10 +2138,11 @@ public Tan tan(Operand x) {
* element in the tensor. Input range is `[-inf, inf]` and
* output range is `[-1,1]`.
*
- *
{@code
- * x = tf.constant([-float("inf"), -5, -0.5, 1, 1.2, 2, 3, float("inf")])
- * tf.math.tanh(x) ==> [-1. -0.99990916 -0.46211717 0.7615942 0.8336547 0.9640276 0.9950547 1.]
- * }
+ * >>> x = tf.constant([-float("inf"), -5, -0.5, 1, 1.2, 2, 3, float("inf")])
+ * >>> tf.math.tanh(x)
+ *
*
* @param data type for {@code y()} output
* @param x
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java
index 5ec7f93020f..4f724578d14 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnOps.java
@@ -136,6 +136,9 @@ public AvgPool avgPool(Operand value, List ksize
/**
* Performs 3D average pooling on the input.
+ *
+ * Each entry in `output` is the mean of the corresponding size `ksize` window in
+ * `value`.
*
* @param data type for {@code output()} output
* @param input Shape `[batch, depth, rows, cols, channels]` tensor to pool over.
@@ -666,9 +669,28 @@ public DataFormatDimMap dataFormatDimMap(Operand x,
}
/**
- * Returns the permuted vector/tensor in the destination data format given the
+ * Permute input tensor from `src_format` to `dst_format`.
+ *
+ * Input tensor must be a vector of size 4, or a 4x2 tensor.
*
- * one in the source data format.
+ * For example, with `src_format` of `NHWC`, `dst_format` of `NCHW`, and inputs:
+ *
{@code
+ * [1, 2, 3, 4]
+ * }
+ * and
+ * {@code
+ * [[1, 2, 3, 4],
+ * [5, 6, 7, 8]]
+ * }
+ * , the outputs will be (respectively):
+ * {@code
+ * [1, 4, 2, 3]
+ * }
+ * and
+ * {@code
+ * [[1, 4, 2, 3],
+ * [5, 8, 6, 7]]
+ * }
*
* @param data type for {@code y()} output
* @param x Vector of size 4 or Tensor of shape (4, 2) in source data format.
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java
index 84736ada6a5..bb3a2098d86 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/Ops.java
@@ -67,6 +67,7 @@
import org.tensorflow.op.core.ConsumeMutexLock;
import org.tensorflow.op.core.ControlTrigger;
import org.tensorflow.op.core.CountUpTo;
+import org.tensorflow.op.core.DecodeProto;
import org.tensorflow.op.core.DeepCopy;
import org.tensorflow.op.core.DeleteSessionTensor;
import org.tensorflow.op.core.DestroyResourceOp;
@@ -76,6 +77,8 @@
import org.tensorflow.op.core.EditDistance;
import org.tensorflow.op.core.Empty;
import org.tensorflow.op.core.EmptyTensorList;
+import org.tensorflow.op.core.EmptyTensorMap;
+import org.tensorflow.op.core.EncodeProto;
import org.tensorflow.op.core.EnsureShape;
import org.tensorflow.op.core.ExpandDims;
import org.tensorflow.op.core.ExtractVolumePatches;
@@ -100,12 +103,14 @@
import org.tensorflow.op.core.InplaceSub;
import org.tensorflow.op.core.InplaceUpdate;
import org.tensorflow.op.core.IsVariableInitialized;
+import org.tensorflow.op.core.KthOrderStatistic;
import org.tensorflow.op.core.LookupTableExport;
import org.tensorflow.op.core.LookupTableFind;
import org.tensorflow.op.core.LookupTableImport;
import org.tensorflow.op.core.LookupTableInsert;
import org.tensorflow.op.core.LookupTableSize;
import org.tensorflow.op.core.LoopCond;
+import org.tensorflow.op.core.MakeUnique;
import org.tensorflow.op.core.MapClear;
import org.tensorflow.op.core.MapIncompleteSize;
import org.tensorflow.op.core.MapPeek;
@@ -243,6 +248,12 @@
import org.tensorflow.op.core.TensorListSetItem;
import org.tensorflow.op.core.TensorListSplit;
import org.tensorflow.op.core.TensorListStack;
+import org.tensorflow.op.core.TensorMapErase;
+import org.tensorflow.op.core.TensorMapHasKey;
+import org.tensorflow.op.core.TensorMapInsert;
+import org.tensorflow.op.core.TensorMapLookup;
+import org.tensorflow.op.core.TensorMapSize;
+import org.tensorflow.op.core.TensorMapStackKeys;
import org.tensorflow.op.core.TensorScatterNdAdd;
import org.tensorflow.op.core.TensorScatterNdMax;
import org.tensorflow.op.core.TensorScatterNdMin;
@@ -251,6 +262,8 @@
import org.tensorflow.op.core.TensorStridedSliceUpdate;
import org.tensorflow.op.core.Tile;
import org.tensorflow.op.core.Timestamp;
+import org.tensorflow.op.core.TopKUnique;
+import org.tensorflow.op.core.TopKWithUnique;
import org.tensorflow.op.core.TryRpc;
import org.tensorflow.op.core.Unbatch;
import org.tensorflow.op.core.UnbatchGrad;
@@ -337,6 +350,8 @@ public final class Ops {
public final SparseOps sparse;
+ public final TpuOps tpu;
+
public final BitwiseOps bitwise;
public final MathOps math;
@@ -345,10 +360,10 @@ public final class Ops {
public final SignalOps signal;
- public final TrainOps train;
-
public final QuantizationOps quantization;
+ public final TrainOps train;
+
private final Scope scope;
private Ops(Scope scope) {
@@ -366,12 +381,13 @@ private Ops(Scope scope) {
random = new RandomOps(this);
strings = new StringsOps(this);
sparse = new SparseOps(this);
+ tpu = new TpuOps(this);
bitwise = new BitwiseOps(this);
math = new MathOps(this);
audio = new AudioOps(this);
signal = new SignalOps(this);
- train = new TrainOps(this);
quantization = new QuantizationOps(this);
+ train = new TrainOps(this);
}
/**
@@ -1918,6 +1934,71 @@ public CountUpTo countUpTo(Operand ref, Long limit) {
return CountUpTo.create(scope, ref, limit);
}
+ /**
+ * The op extracts fields from a serialized protocol buffers message into tensors.
+ *
+ * The `decode_proto` op extracts fields from a serialized protocol buffers
+ * message into tensors. The fields in `field_names` are decoded and converted
+ * to the corresponding `output_types` if possible.
+ *
+ * A `message_type` name must be provided to give context for the field names.
+ * The actual message descriptor can be looked up either in the linked-in
+ * descriptor pool or a filename provided by the caller using the
+ * `descriptor_source` attribute.
+ *
+ * Each output tensor is a dense tensor. This means that it is padded to hold
+ * the largest number of repeated elements seen in the input minibatch. (The
+ * shape is also padded by one to prevent zero-sized dimensions). The actual
+ * repeat counts for each example in the minibatch can be found in the `sizes`
+ * output. In many cases the output of `decode_proto` is fed immediately into
+ * tf.squeeze if missing values are not a concern. When using tf.squeeze, always
+ * pass the squeeze dimension explicitly to avoid surprises.
+ *
+ * For the most part, the mapping between Proto field types and TensorFlow dtypes
+ * is straightforward. However, there are a few special cases:
+ *
+ * - A proto field that contains a submessage or group can only be converted
+ * to `DT_STRING` (the serialized submessage). This is to reduce the complexity
+ * of the API. The resulting string can be used as input to another instance of
+ * the decode_proto op.
+ *
+ * - TensorFlow lacks support for unsigned integers. The ops represent uint64
+ * types as a `DT_INT64` with the same twos-complement bit pattern (the obvious
+ * way). Unsigned int32 values can be represented exactly by specifying type
+ * `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in
+ * the `output_types` attribute.
+ *
+ * Both binary and text proto serializations are supported, and can be
+ * chosen using the `format` attribute.
+ *
+ * The `descriptor_source` attribute selects the source of protocol
+ * descriptors to consult when looking up `message_type`. This may be:
+ *
+ * - An empty string or "local://", in which case protocol descriptors are
+ * created for C++ (not Python) proto definitions linked to the binary.
+ *
+ * - A file, in which case protocol descriptors are created from the file,
+ * which is expected to contain a `FileDescriptorSet` serialized as a string.
+ * NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out`
+ * and `--include_imports` options to the protocol compiler `protoc`.
+ *
+ * - A "bytes://", in which protocol descriptors are created from ``,
+ * which is expected to be a `FileDescriptorSet` serialized as a string.
+ *
+ * @param bytes Tensor of serialized protos with shape `batch_shape`.
+ * @param messageType Name of the proto message type to decode.
+ * @param fieldNames List of strings containing proto field names. An extension field can be decoded
+ * by using its full name, e.g. EXT_PACKAGE.EXT_FIELD_NAME.
+ * @param outputTypes List of TF types to use for the respective field in field_names.
+ * @param options carries optional attributes values
+ * @return a new instance of DecodeProto
+ */
+ public DecodeProto decodeProto(Operand bytes, String messageType,
+ List fieldNames, List> outputTypes,
+ DecodeProto.Options... options) {
+ return DecodeProto.create(scope, bytes, messageType, fieldNames, outputTypes, options);
+ }
+
/**
* Makes a copy of `x`.
*
@@ -2158,6 +2239,73 @@ public EmptyTensorList emptyTensorList(Operand extends TNumb
return EmptyTensorList.create(scope, elementShape, maxNumElements, elementDtype);
}
+ /**
+ * Creates and returns an empty tensor map.
+ *
+ * handle: an empty tensor map
+ *
+ * @return a new instance of EmptyTensorMap
+ */
+ public EmptyTensorMap emptyTensorMap() {
+ return EmptyTensorMap.create(scope);
+ }
+
+ /**
+ * The op serializes protobuf messages provided in the input tensors.
+ *
+ * The types of the tensors in `values` must match the schema for the fields
+ * specified in `field_names`. All the tensors in `values` must have a common
+ * shape prefix, batch_shape.
+ *
+ * The `sizes` tensor specifies repeat counts for each field. The repeat count
+ * (last dimension) of a each tensor in `values` must be greater than or equal
+ * to corresponding repeat count in `sizes`.
+ *
+ * A `message_type` name must be provided to give context for the field names.
+ * The actual message descriptor can be looked up either in the linked-in
+ * descriptor pool or a filename provided by the caller using the
+ * `descriptor_source` attribute.
+ *
+ * For the most part, the mapping between Proto field types and TensorFlow dtypes
+ * is straightforward. However, there are a few special cases:
+ *
+ * - A proto field that contains a submessage or group can only be converted
+ * to `DT_STRING` (the serialized submessage). This is to reduce the complexity
+ * of the API. The resulting string can be used as input to another instance of
+ * the decode_proto op.
+ *
+ * - TensorFlow lacks support for unsigned integers. The ops represent uint64
+ * types as a `DT_INT64` with the same twos-complement bit pattern (the obvious
+ * way). Unsigned int32 values can be represented exactly by specifying type
+ * `DT_INT64`, or using twos-complement if the caller specifies `DT_INT32` in
+ * the `output_types` attribute.
+ *
+ * The `descriptor_source` attribute selects the source of protocol
+ * descriptors to consult when looking up `message_type`. This may be:
+ *
+ * - An empty string or "local://", in which case protocol descriptors are
+ * created for C++ (not Python) proto definitions linked to the binary.
+ *
+ * - A file, in which case protocol descriptors are created from the file,
+ * which is expected to contain a `FileDescriptorSet` serialized as a string.
+ * NOTE: You can build a `descriptor_source` file using the `--descriptor_set_out`
+ * and `--include_imports` options to the protocol compiler `protoc`.
+ *
+ * - A "bytes://", in which protocol descriptors are created from ``,
+ * which is expected to be a `FileDescriptorSet` serialized as a string.
+ *
+ * @param sizes Tensor of int32 with shape `[batch_shape, len(field_names)]`.
+ * @param values List of tensors containing values for the corresponding field.
+ * @param fieldNames List of strings containing proto field names.
+ * @param messageType Name of the proto message type to decode.
+ * @param options carries optional attributes values
+ * @return a new instance of EncodeProto
+ */
+ public EncodeProto encodeProto(Operand sizes, Iterable> values,
+ List fieldNames, String messageType, EncodeProto.Options... options) {
+ return EncodeProto.create(scope, sizes, values, fieldNames, messageType, options);
+ }
+
/**
* Ensures that the tensor's shape matches the expected shape.
*
@@ -2218,7 +2366,7 @@ public ExpandDims expandDims(Operand input,
}
/**
- * Extract `patches` from `input` and put them in the "depth" output dimension. 3D extension of `extract_image_patches`.
+ * Extract `patches` from `input` and put them in the `"depth"` output dimension. 3D extension of `extract_image_patches`.
*
* @param data type for {@code patches()} output
* @param input 5-D Tensor with shape `[batch, in_planes, in_rows, in_cols, depth]`.
@@ -2227,10 +2375,10 @@ public ExpandDims expandDims(Operand input,
* `input`. Must be: `[1, stride_planes, stride_rows, stride_cols, 1]`.
* @param padding The type of padding algorithm to use.
*
- * We specify the size-related attributes as:
+ * The size-related attributes are specified as follows:
*
{@code
- * ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1]
- * strides = [1, stride_planes, strides_rows, strides_cols, 1]
+ * ksizes = [1, ksize_planes, ksize_rows, ksize_cols, 1]
+ * strides = [1, stride_planes, strides_rows, strides_cols, 1]
* }
* @return a new instance of ExtractVolumePatches
*/
@@ -2863,6 +3011,32 @@ public IsVariableInitialized isVariableInitialized(Operand extends TType> ref)
return IsVariableInitialized.create(scope, ref);
}
+ /**
+ * Computes the Kth order statistic of a data set. The current
+ *
+ * implementation uses a binary search requiring exactly 32 passes over
+ * the input data. The running time is linear with respect to input
+ * size. The median-of-medians algorithm is probably faster, but is
+ * difficult to implement efficiently in XLA. The implementation imposes
+ * a total ordering on floats. The ordering is consistent with the usual
+ * partial order. Positive NaNs are greater than positive
+ * infinity. Negative NaNs are less than negative infinity. NaNs with
+ * distinct payloads are treated as distinct. Subnormal numbers are
+ * preserved (not flushed to zero). Positive infinity is greater than all
+ * numbers. Negative infinity is less than all numbers. Positive is
+ * greater than negative zero. There are less than k values greater than
+ * the kth order statistic. There are at least k values greater than or
+ * equal to the Kth order statistic. The semantics are not the same as
+ * top_k_unique.
+ *
+ * @param input
+ * @param k
+ * @return a new instance of KthOrderStatistic
+ */
+ public KthOrderStatistic kthOrderStatistic(Operand input, Long k) {
+ return KthOrderStatistic.create(scope, input, k);
+ }
+
/**
* Outputs all keys and values in the table.
*
@@ -2953,6 +3127,21 @@ public LoopCond loopCond(Operand input) {
return LoopCond.create(scope, input);
}
+ /**
+ * Make all elements in the non-Batch dimension unique, but \"close\" to
+ *
+ * their initial value. Never returns a sub-normal number. Never returns
+ * zero. The sign of each input element is always identical to the sign
+ * of the corresponding output element. Behavior for infinite elements is
+ * undefined. Behavior for subnormal elements is undefined.
+ *
+ * @param input
+ * @return a new instance of MakeUnique
+ */
+ public MakeUnique makeUnique(Operand input) {
+ return MakeUnique.create(scope, input);
+ }
+
/**
* Op removes all elements in the underlying container.
*
@@ -6694,6 +6883,103 @@ public TensorListStack tensorListStack(Operand> inputHand
return TensorListStack.create(scope, inputHandle, elementShape, elementDtype, options);
}
+ /**
+ * Returns a tensor map with item from given key erased.
+ *
+ * input_handle: the original map
+ * output_handle: the map with value from given key removed
+ * key: the key of the value to be erased
+ *
+ * @param inputHandle
+ * @param key
+ * @param valueDtype
+ * @return a new instance of TensorMapErase
+ */
+ public TensorMapErase tensorMapErase(Operand> inputHandle,
+ Operand extends TType> key, Class valueDtype) {
+ return TensorMapErase.create(scope, inputHandle, key, valueDtype);
+ }
+
+ /**
+ * Returns whether the given key exists in the map.
+ *
+ * input_handle: the input map
+ * key: the key to check
+ * has_key: whether the key is already in the map or not
+ *
+ * @param inputHandle
+ * @param key
+ * @return a new instance of TensorMapHasKey
+ */
+ public TensorMapHasKey tensorMapHasKey(Operand> inputHandle, Operand extends TType> key) {
+ return TensorMapHasKey.create(scope, inputHandle, key);
+ }
+
+ /**
+ * Returns a map that is the 'input_handle' with the given key-value pair inserted.
+ *
+ * input_handle: the original map
+ * output_handle: the map with key and value inserted
+ * key: the key to be inserted
+ * value: the value to be inserted
+ *
+ * @param inputHandle
+ * @param key
+ * @param value
+ * @return a new instance of TensorMapInsert
+ */
+ public TensorMapInsert tensorMapInsert(Operand> inputHandle, Operand extends TType> key,
+ Operand extends TType> value) {
+ return TensorMapInsert.create(scope, inputHandle, key, value);
+ }
+
+ /**
+ * Returns the value from a given key in a tensor map.
+ *
+ * input_handle: the input map
+ * key: the key to be looked up
+ * value: the value found from the given key
+ *
+ * @param data type for {@code value()} output
+ * @param inputHandle
+ * @param key
+ * @param valueDtype
+ * @return a new instance of TensorMapLookup
+ */
+ public TensorMapLookup tensorMapLookup(Operand> inputHandle,
+ Operand extends TType> key, Class valueDtype) {
+ return TensorMapLookup.create(scope, inputHandle, key, valueDtype);
+ }
+
+ /**
+ * Returns the number of tensors in the input tensor map.
+ *
+ * input_handle: the input map
+ * size: the number of tensors in the map
+ *
+ * @param inputHandle
+ * @return a new instance of TensorMapSize
+ */
+ public TensorMapSize tensorMapSize(Operand> inputHandle) {
+ return TensorMapSize.create(scope, inputHandle);
+ }
+
+ /**
+ * Returns a Tensor stack of all keys in a tensor map.
+ *
+ * input_handle: the input map
+ * keys: the returned Tensor of all keys in the map
+ *
+ * @param data type for {@code keys()} output
+ * @param inputHandle
+ * @param keyDtype
+ * @return a new instance of TensorMapStackKeys
+ */
+ public TensorMapStackKeys tensorMapStackKeys(Operand> inputHandle,
+ Class keyDtype) {
+ return TensorMapStackKeys.create(scope, inputHandle, keyDtype);
+ }
+
/**
* Adds sparse `updates` to an existing tensor according to `indices`.
*
@@ -6876,73 +7162,37 @@ public TensorScatterNdSub tensorScatterNdSub(Operand ten
* scattered onto an existing tensor (as opposed to a zero-tensor). If the memory
* for the existing tensor cannot be re-used, a copy is made and updated.
*
- * If `indices` contains duplicates, then their updates are accumulated (summed).
+ * If `indices` contains duplicates, then we pick the last update for the index.
*
- * WARNING: The order in which updates are applied is nondeterministic, so the
- * output will be nondeterministic if `indices` contains duplicates -- because
- * of some numerical approximation issues, numbers summed in different order
- * may yield different results.
+ * If an out of bound index is found on CPU, an error is returned.
*
- * `indices` is an integer tensor containing indices into a new tensor of shape
- * `shape`. The last dimension of `indices` can be at most the rank of `shape`:
- *
- * indices.shape[-1] <= shape.rank
- *
- * The last dimension of `indices` corresponds to indices into elements
- * (if `indices.shape[-1] = shape.rank`) or slices
- * (if `indices.shape[-1] < shape.rank`) along dimension `indices.shape[-1]` of
- * `shape`. `updates` is a tensor with shape
- *
- * indices.shape[:-1] + shape[indices.shape[-1]:]
+ * WARNING: There are some GPU specific semantics for this operation.
+ * - If an out of bound index is found, the index is ignored.
+ * - The order in which updates are applied is nondeterministic, so the output
+ * will be nondeterministic if `indices` contains duplicates.
*
- * The simplest form of scatter is to insert individual elements in a tensor by
- * index. For example, say we want to insert 4 scattered elements in a rank-1
- * tensor with 8 elements.
- *
- *
- *

- *
- *
- * In Python, this scatter operation would look like this:
- *
- * >>> indices = tf.constant([[4], [3], [1], [7]])
- * >>> updates = tf.constant([9, 10, 11, 12])
- * >>> tensor = tf.ones([8], dtype=tf.int32)
- * >>> print(tf.tensor_scatter_nd_update(tensor, indices, updates))
- * tf.Tensor([ 1 11 1 10 9 1 1 12], shape=(8,), dtype=int32)
- *
- * We can also, insert entire slices of a higher rank tensor all at once. For
- * example, if we wanted to insert two slices in the first dimension of a
- * rank-3 tensor with two matrices of new values.
- *
- * In Python, this scatter operation would look like this:
- *
- * >>> indices = tf.constant([[0], [2]])
- * >>> updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
- * ... [7, 7, 7, 7], [8, 8, 8, 8]],
- * ... [[5, 5, 5, 5], [6, 6, 6, 6],
- * ... [7, 7, 7, 7], [8, 8, 8, 8]]])
- * >>> tensor = tf.ones([4, 4, 4], dtype=tf.int32)
- * >>> print(tf.tensor_scatter_nd_update(tensor, indices, updates).numpy())
- * [[[5 5 5 5]
- * [6 6 6 6]
- * [7 7 7 7]
- * [8 8 8 8]]
- * [[1 1 1 1]
- * [1 1 1 1]
- * [1 1 1 1]
- * [1 1 1 1]]
- * [[5 5 5 5]
- * [6 6 6 6]
- * [7 7 7 7]
- * [8 8 8 8]]
- * [[1 1 1 1]
- * [1 1 1 1]
- * [1 1 1 1]
- * [1 1 1 1]]]
+ * `indices` is an integer tensor containing indices into a new tensor of shape
+ * `shape`.
+ *
+ * -
+ * `indices` must have at least 2 axes: `(num_updates, index_depth)`.
+ *
+ * -
+ * The last axis of `indices` is how deep to index into `tensor` so this index
+ * depth must be less than the rank of `tensor`: `indices.shape[-1] <= tensor.ndim`
+ *
+ *
+ * if `indices.shape[-1] = tensor.rank` this Op indexes and updates scalar elements.
+ * if `indices.shape[-1] < tensor.rank` it indexes and updates slices of the input
+ * `tensor`.
*
- * Note that on CPU, if an out of bound index is found, an error is returned.
- * On GPU, if an out of bound index is found, the index is ignored.
+ * Each `update` has a rank of `tensor.rank - indices.shape[-1]`.
+ * The overall shape of `updates` is:
+ *
{@code
+ * indices.shape[:-1] + tensor.shape[indices.shape[-1]:]
+ * }
+ * For usage examples see the python [tf.tensor_scatter_nd_update](
+ * https://www.tensorflow.org/api_docs/python/tf/tensor_scatter_nd_update) function
*
* @param data type for {@code output()} output
* @param tensor Tensor to copy/update.
@@ -7033,6 +7283,46 @@ public Timestamp timestamp() {
return Timestamp.create(scope);
}
+ /**
+ * Returns the TopK unique values in the array in sorted order. The
+ *
+ * running time is proportional to the product of K and the input
+ * size. Sorting the whole array is more efficient for sufficiently large
+ * values of K. The median-of-medians algorithm is probably faster, but
+ * difficult to implement efficiently in XLA. If there are fewer than K
+ * unique numbers (not NANs), the results are padded with negative
+ * infinity. NaNs are never returned. Subnormal numbers are flushed to
+ * zero. If an element appears at multiple indices, the highest index is
+ * returned. If a TopK element never appears in the input due to padding
+ * values, the indices are padded with negative one. If a padding value
+ * appears in the input and padding is needed, the highest index of the
+ * padding value will be returned. The semantics are not the same as
+ * kth_order_statistic.
+ *
+ * @param input
+ * @param k
+ * @return a new instance of TopKUnique
+ */
+ public TopKUnique topKUnique(Operand input, Long k) {
+ return TopKUnique.create(scope, input, k);
+ }
+
+ /**
+ * Returns the TopK values in the array in sorted order. This is a combination
+ *
+ * of MakeUnique and TopKUnique. The returned top-K will have its lower bits
+ * replaced by iota, thus it will be close to the original value but not exactly
+ * the same. The running time is proportional to the product of K and the input
+ * size. NaNs are never returned. Subnormal numbers are flushed to zero.
+ *
+ * @param input
+ * @param k
+ * @return a new instance of TopKWithUnique
+ */
+ public TopKWithUnique topKWithUnique(Operand input, Long k) {
+ return TopKWithUnique.create(scope, input, k);
+ }
+
/**
* Perform batches of RPC requests.
*
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java
index 812f2563605..13323a555af 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/QuantizationOps.java
@@ -27,6 +27,9 @@
import org.tensorflow.op.quantization.FakeQuantWithMinMaxVarsPerChannelGradient;
import org.tensorflow.op.quantization.Quantize;
import org.tensorflow.op.quantization.QuantizeAndDequantize;
+import org.tensorflow.op.quantization.QuantizeAndDequantizeV3;
+import org.tensorflow.op.quantization.QuantizeAndDequantizeV4;
+import org.tensorflow.op.quantization.QuantizeAndDequantizeV4Grad;
import org.tensorflow.op.quantization.QuantizeDownAndShrinkRange;
import org.tensorflow.op.quantization.QuantizedConcat;
import org.tensorflow.op.quantization.RequantizationRange;
@@ -530,6 +533,64 @@ public QuantizeAndDequantize quantizeAndDequantize(Operan
return QuantizeAndDequantize.create(scope, input, inputMin, inputMax, numBits, options);
}
+ /**
+ * Quantizes then dequantizes a tensor.
+ *
+ * This is almost identical to QuantizeAndDequantizeV2, except that num_bits is a
+ * tensor, so its value can change during training.
+ *
+ * @param data type for {@code output()} output
+ * @param input
+ * @param inputMin
+ * @param inputMax
+ * @param numBits
+ * @param options carries optional attributes values
+ * @return a new instance of QuantizeAndDequantizeV3
+ */
+ public QuantizeAndDequantizeV3 quantizeAndDequantizeV3(Operand input,
+ Operand inputMin, Operand inputMax, Operand numBits,
+ QuantizeAndDequantizeV3.Options... options) {
+ return QuantizeAndDequantizeV3.create(scope, input, inputMin, inputMax, numBits, options);
+ }
+
+ /**
+ * Returns the gradient of `quantization.QuantizeAndDequantizeV4`.
+ *
+ * This is almost identical to QuantizeAndDequantizeV2, except that it returns a
+ * gradient of 1 for inputs that are within the quantization range, or 0 otherwise.
+ *
+ * @param data type for {@code output()} output
+ * @param input
+ * @param inputMin
+ * @param inputMax
+ * @param options carries optional attributes values
+ * @return a new instance of QuantizeAndDequantizeV4
+ */
+ public QuantizeAndDequantizeV4 quantizeAndDequantizeV4(Operand input,
+ Operand inputMin, Operand inputMax, QuantizeAndDequantizeV4.Options... options) {
+ return QuantizeAndDequantizeV4.create(scope, input, inputMin, inputMax, options);
+ }
+
+ /**
+ * Returns the gradient of `QuantizeAndDequantizeV4`.
+ *
+ * Returns a gradient of 1 for inputs that are within the quantization range,
+ * or 0 otherwise.
+ *
+ * @param data type for {@code inputBackprop()} output
+ * @param gradients
+ * @param input
+ * @param inputMin
+ * @param inputMax
+ * @param options carries optional attributes values
+ * @return a new instance of QuantizeAndDequantizeV4Grad
+ */
+ public QuantizeAndDequantizeV4Grad quantizeAndDequantizeV4Grad(
+ Operand gradients, Operand input, Operand inputMin, Operand inputMax,
+ QuantizeAndDequantizeV4Grad.Options... options) {
+ return QuantizeAndDequantizeV4Grad.create(scope, gradients, input, inputMin, inputMax, options);
+ }
+
/**
* Convert the quantized 'input' tensor into a lower-precision 'output', using the
*
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java
index d2527c6563f..b9baf04fec6 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/StringsOps.java
@@ -494,7 +494,15 @@ public ToNumber toNumber(Operand stringTensor, C
*
* This operation converts Unicode code points to script codes corresponding to
* each code point. Script codes correspond to International Components for
- * Unicode (ICU) UScriptCode values. See http://icu-project.org/apiref/icu4c/uscript_8h.html.
+ * Unicode (ICU) UScriptCode values.
+ *
+ * See
+ * [ICU project docs](http://icu-project.org/apiref/icu4c/uscript_8h.html)
+ * for more details on script codes.
+ *
+ * For an example, see the unicode strings guide on [unicode scripts]
+ * (https://www.tensorflow.org/tutorials/load_data/unicode#representing_unicode).
+ *
* Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will
* match input shape.
*
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TpuOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TpuOps.java
new file mode 100644
index 00000000000..b9b13e9cc22
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TpuOps.java
@@ -0,0 +1,133 @@
+// Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ==============================================================================
+//
+// This class has been generated, DO NOT EDIT!
+//
+package org.tensorflow.op;
+
+import java.util.List;
+import org.tensorflow.Operand;
+import org.tensorflow.op.tpu.CompileSucceededAssert;
+import org.tensorflow.op.tpu.Execute;
+import org.tensorflow.op.tpu.ExecuteAndUpdateVariables;
+import org.tensorflow.op.tpu.PartitionedInput;
+import org.tensorflow.op.tpu.PartitionedOutput;
+import org.tensorflow.types.TString;
+import org.tensorflow.types.family.TType;
+
+/**
+ * An API for building {@code tpu} operations as {@link Op Op}s
+ *
+ * @see {@link Ops}
+ */
+public final class TpuOps {
+ private final Scope scope;
+
+ private final Ops ops;
+
+ TpuOps(Ops ops) {
+ this.scope = ops.scope();
+ this.ops = ops;
+ }
+
+ /**
+ * Asserts that compilation succeeded. This op produces no output and closes the
+ *
+ * device during failure to ensure all pending device interactions fail.
+ *
+ * 'compilation_status' is a serialized CompilationResultProto.
+ *
+ * @param compilationStatus
+ * @return a new instance of CompileSucceededAssert
+ */
+ public CompileSucceededAssert compileSucceededAssert(Operand compilationStatus) {
+ return CompileSucceededAssert.create(scope, compilationStatus);
+ }
+
+ /**
+ * Op that loads and executes a TPU program on a TPU device.
+ *
+ * For the internal use of the distributed TPU compiler.
+ *
+ * @param args
+ * @param key
+ * @param Tresults
+ * @return a new instance of Execute
+ */
+ public Execute execute(Iterable> args, Operand key,
+ List> Tresults) {
+ return Execute.create(scope, args, key, Tresults);
+ }
+
+ /**
+ * Op that executes a program with optional in-place variable updates.
+ *
+ * It (optionally) reads device variables, loads and executes a TPU program on a
+ * TPU device, and then (optionally) in-place updates variables using the program
+ * outputs, as specified in attributes device_var_reads_indices (program input
+ * indices from directly reading variables) and device_var_updates_indices (program
+ * output indices used to update variables, -1 means no-update/read-only). Such
+ * program outputs are consumed by these variables will not appear in the op
+ * output. For the internal use of the distributed TPU compiler.
+ *
+ * @param args
+ * @param key
+ * @param Tresults
+ * @param deviceVarReadsIndices
+ * @param deviceVarUpdatesIndices
+ * @return a new instance of ExecuteAndUpdateVariables
+ */
+ public ExecuteAndUpdateVariables executeAndUpdateVariables(Iterable> args,
+ Operand key, List> Tresults, List deviceVarReadsIndices,
+ List deviceVarUpdatesIndices) {
+ return ExecuteAndUpdateVariables.create(scope, args, key, Tresults, deviceVarReadsIndices, deviceVarUpdatesIndices);
+ }
+
+ /**
+ * An op that groups a list of partitioned inputs together. This op
+ *
+ * @param data type for {@code output()} output
+ * @param inputs A list of partitioned inputs which must have the same shape.
+ * @param options carries optional attributes values
+ * @return a new instance of PartitionedInput
+ */
+ public PartitionedInput partitionedInput(Iterable> inputs,
+ PartitionedInput.Options... options) {
+ return PartitionedInput.create(scope, inputs, options);
+ }
+
+ /**
+ * An op that demultiplexes a tensor to be sharded by XLA to a list of partitioned
+ *
+ * outputs outside the XLA computation.
+ *
+ * @param data type for {@code output()} output
+ * @param inputs A tensor which represents the full shape of partitioned tensors.
+ * @param numSplits
+ * @param options carries optional attributes values
+ * @return a new instance of PartitionedOutput
+ */
+ public PartitionedOutput partitionedOutput(Operand inputs, Long numSplits,
+ PartitionedOutput.Options... options) {
+ return PartitionedOutput.create(scope, inputs, numSplits, options);
+ }
+
+ /**
+ * Get the parent {@link Ops} object.
+ */
+ public final Ops ops() {
+ return ops;
+ }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java
index 87809e1a4c3..eb8d94bc6e4 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/TrainOps.java
@@ -312,7 +312,7 @@ public ApplyAddSign applyAddSign(Operand var, Operand
* @param mom Should be from a Variable().
* @param lr Scaling factor. Must be a scalar.
* @param rho Decay rate. Must be a scalar.
- * @param momentum
+ * @param momentum Momentum Scale. Must be a scalar.
* @param epsilon Ridge term. Must be a scalar.
* @param grad The gradient.
* @param options carries optional attributes values
@@ -809,7 +809,7 @@ public ResourceApplyAddSign resourceApplyAddSign(Operand> va
* @param mom Should be from a Variable().
* @param lr Scaling factor. Must be a scalar.
* @param rho Decay rate. Must be a scalar.
- * @param momentum
+ * @param momentum Momentum Scale. Must be a scalar.
* @param epsilon Ridge term. Must be a scalar.
* @param grad The gradient.
* @param options carries optional attributes values
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java
index d4e9c94d250..393a754ff47 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/XlaOps.java
@@ -37,6 +37,10 @@
import org.tensorflow.op.xla.Sharding;
import org.tensorflow.op.xla.Sort;
import org.tensorflow.op.xla.Svd;
+import org.tensorflow.op.xla.XlaRecvFromHost;
+import org.tensorflow.op.xla.XlaSendToHost;
+import org.tensorflow.op.xla.XlaSetBound;
+import org.tensorflow.types.TInt32;
import org.tensorflow.types.family.TNumber;
import org.tensorflow.types.family.TType;
@@ -382,6 +386,53 @@ public Svd svd(Operand a, Long maxIter, Float epsilon,
return Svd.create(scope, a, maxIter, epsilon, precisionConfig);
}
+ /**
+ * An op to receive a tensor from the host.
+ *
+ * output: the tensor that will be received from the host.
+ * Toutput: element type for output.
+ * shape: shape for output.
+ * key: A unique identifier for this region used to match up host transfers.
+ *
+ * @param data type for {@code output()} output
+ * @param Toutput
+ * @param shape
+ * @param key
+ * @return a new instance of XlaRecvFromHost
+ */
+ public XlaRecvFromHost xlaRecvFromHost(Class Toutput, Shape shape,
+ String key) {
+ return XlaRecvFromHost.create(scope, Toutput, shape, key);
+ }
+
+ /**
+ * An op to send a tensor to the host.
+ *
+ * input: the tensor that will be sent to the host.
+ * Tinput: element type for input.
+ * key: A unique identifier for this region used to match up host transfers.
+ *
+ * @param input
+ * @param key
+ * @return a new instance of XlaSendToHost
+ */
+ public XlaSendToHost xlaSendToHost(Operand extends TType> input, String key) {
+ return XlaSendToHost.create(scope, input, key);
+ }
+
+ /**
+ * Set a bound for the given input value as a hint to Xla compiler,
+ *
+ * returns the same value.
+ *
+ * @param input
+ * @param bound
+ * @return a new instance of XlaSetBound
+ */
+ public XlaSetBound xlaSetBound(Operand input, Operand bound) {
+ return XlaSetBound.create(scope, input, bound);
+ }
+
/**
* Get the parent {@link Ops} object.
*/
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java
new file mode 100644
index 00000000000..4a7968111e1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_AllocatorAttributes.java
@@ -0,0 +1,35 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+// #endif
+
+// Allocator Attributes used for tensor allocation.
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_AllocatorAttributes extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_AllocatorAttributes() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_AllocatorAttributes(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_AllocatorAttributes(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_AllocatorAttributes position(long position) {
+ return (TF_AllocatorAttributes)super.position(position);
+ }
+ @Override public TF_AllocatorAttributes getPointer(long i) {
+ return new TF_AllocatorAttributes(this).position(position + i);
+ }
+
+ public native @Cast("size_t") long struct_size(); public native TF_AllocatorAttributes struct_size(long setter);
+ // Set boolean to 1 for CPU allocation, else 0.
+ public native @Cast("unsigned char") byte on_host(); public native TF_AllocatorAttributes on_host(byte setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java
new file mode 100644
index 00000000000..3300f6416b1
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_StringView.java
@@ -0,0 +1,35 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+// --------------------------------------------------------------------------
+// Used to return strings across the C API. The caller does not take ownership
+// of the underlying data pointer and is not responsible for freeing it.
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_StringView extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_StringView() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_StringView(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_StringView(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_StringView position(long position) {
+ return (TF_StringView)super.position(position);
+ }
+ @Override public TF_StringView getPointer(long i) {
+ return new TF_StringView(this).position(position + i);
+ }
+
+ public native @Cast("const char*") BytePointer data(); public native TF_StringView data(BytePointer setter);
+ public native @Cast("size_t") long len(); public native TF_StringView len(long setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java
new file mode 100644
index 00000000000..1952ad9267d
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString.java
@@ -0,0 +1,37 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString position(long position) {
+ return (TF_TString)super.position(position);
+ }
+ @Override public TF_TString getPointer(long i) {
+ return new TF_TString(this).position(position + i);
+ }
+ // NOLINT
+ // small conflicts with '#define small char' in RpcNdr.h for MSVC, so we use
+ // smll instead.
+ @Name("u.smll") public native @ByRef TF_TString_Small u_smll(); public native TF_TString u_smll(TF_TString_Small setter);
+ @Name("u.large") public native @ByRef TF_TString_Large u_large(); public native TF_TString u_large(TF_TString_Large setter);
+ @Name("u.offset") public native @ByRef TF_TString_Offset u_offset(); public native TF_TString u_offset(TF_TString_Offset setter);
+ @Name("u.view") public native @ByRef TF_TString_View u_view(); public native TF_TString u_view(TF_TString_View setter);
+ @Name("u.raw") public native @ByRef TF_TString_Raw u_raw(); public native TF_TString u_raw(TF_TString_Raw setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java
new file mode 100644
index 00000000000..2edcc0e3808
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Large.java
@@ -0,0 +1,33 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString_Large extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString_Large() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString_Large(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString_Large(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString_Large position(long position) {
+ return (TF_TString_Large)super.position(position);
+ }
+ @Override public TF_TString_Large getPointer(long i) {
+ return new TF_TString_Large(this).position(position + i);
+ }
+ // NOLINT
+ public native @Cast("size_t") long size(); public native TF_TString_Large size(long setter);
+ public native @Cast("size_t") long cap(); public native TF_TString_Large cap(long setter);
+ public native @Cast("char*") BytePointer ptr(); public native TF_TString_Large ptr(BytePointer setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java
new file mode 100644
index 00000000000..d46c62ec004
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Offset.java
@@ -0,0 +1,33 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString_Offset extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString_Offset() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString_Offset(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString_Offset(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString_Offset position(long position) {
+ return (TF_TString_Offset)super.position(position);
+ }
+ @Override public TF_TString_Offset getPointer(long i) {
+ return new TF_TString_Offset(this).position(position + i);
+ }
+ // NOLINT
+ public native @Cast("uint32_t") int size(); public native TF_TString_Offset size(int setter);
+ public native @Cast("uint32_t") int offset(); public native TF_TString_Offset offset(int setter);
+ public native @Cast("uint32_t") int count(); public native TF_TString_Offset count(int setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java
new file mode 100644
index 00000000000..ffe3b6b087a
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Raw.java
@@ -0,0 +1,32 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString_Raw extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString_Raw() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString_Raw(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString_Raw(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString_Raw position(long position) {
+ return (TF_TString_Raw)super.position(position);
+ }
+ @Override public TF_TString_Raw getPointer(long i) {
+ return new TF_TString_Raw(this).position(position + i);
+ }
+ // NOLINT
+ public native @Cast("uint8_t") byte raw(int i); public native TF_TString_Raw raw(int i, byte setter);
+ @MemberGetter public native @Cast("uint8_t*") BytePointer raw();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java
new file mode 100644
index 00000000000..7ce9d5f9caf
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Small.java
@@ -0,0 +1,33 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString_Small extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString_Small() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString_Small(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString_Small(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString_Small position(long position) {
+ return (TF_TString_Small)super.position(position);
+ }
+ @Override public TF_TString_Small getPointer(long i) {
+ return new TF_TString_Small(this).position(position + i);
+ }
+ // NOLINT
+ public native @Cast("uint8_t") byte size(); public native TF_TString_Small size(byte setter);
+ public native @Cast("char") byte str(int i); public native TF_TString_Small str(int i, byte setter);
+ @MemberGetter public native @Cast("char*") BytePointer str();
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java
new file mode 100644
index 00000000000..ffa3cfeb5db
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_Union.java
@@ -0,0 +1,34 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString_Union extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString_Union() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString_Union(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString_Union(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString_Union position(long position) {
+ return (TF_TString_Union)super.position(position);
+ }
+ @Override public TF_TString_Union getPointer(long i) {
+ return new TF_TString_Union(this).position(position + i);
+ }
+ // NOLINT
+ public native @ByRef TF_TString_Large large(); public native TF_TString_Union large(TF_TString_Large setter);
+ public native @ByRef TF_TString_Offset offset(); public native TF_TString_Union offset(TF_TString_Offset setter);
+ public native @ByRef TF_TString_View view(); public native TF_TString_Union view(TF_TString_View setter);
+ public native @ByRef TF_TString_Raw raw(); public native TF_TString_Union raw(TF_TString_Raw setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java
new file mode 100644
index 00000000000..bec84468a53
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_TString_View.java
@@ -0,0 +1,32 @@
+// Targeted by JavaCPP version 1.5.4: DO NOT EDIT THIS FILE
+
+package org.tensorflow.internal.c_api;
+
+import java.nio.*;
+import org.bytedeco.javacpp.*;
+import org.bytedeco.javacpp.annotation.*;
+
+import static org.tensorflow.internal.c_api.global.tensorflow.*;
+
+
+@Properties(inherit = org.tensorflow.internal.c_api.presets.tensorflow.class)
+public class TF_TString_View extends Pointer {
+ static { Loader.load(); }
+ /** Default native constructor. */
+ public TF_TString_View() { super((Pointer)null); allocate(); }
+ /** Native array allocator. Access with {@link Pointer#position(long)}. */
+ public TF_TString_View(long size) { super((Pointer)null); allocateArray(size); }
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
+ public TF_TString_View(Pointer p) { super(p); }
+ private native void allocate();
+ private native void allocateArray(long size);
+ @Override public TF_TString_View position(long position) {
+ return (TF_TString_View)super.position(position);
+ }
+ @Override public TF_TString_View getPointer(long i) {
+ return new TF_TString_View(this).position(position + i);
+ }
+ // NOLINT
+ public native @Cast("size_t") long size(); public native TF_TString_View size(long setter);
+ public native @Cast("const char*") BytePointer ptr(); public native TF_TString_View ptr(BytePointer setter);
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java
index b1839dadd2d..d96c2757dc6 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/TF_Tensor.java
@@ -8,7 +8,6 @@
import static org.tensorflow.internal.c_api.global.tensorflow.*;
-// #endif
// --------------------------------------------------------------------------
// TF_Tensor holds a multi-dimensional array of elements of a single data type.
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java
index bdd9cc618ac..f83bc6c1394 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/internal/c_api/global/tensorflow.java
@@ -11,6 +11,264 @@
public class tensorflow extends org.tensorflow.internal.c_api.presets.tensorflow {
static { Loader.load(); }
+// Parsed from tensorflow/core/platform/ctstring_internal.h
+
+/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_CORE_PLATFORM_CTSTRING_INTERNAL_H_
+// #define TENSORFLOW_CORE_PLATFORM_CTSTRING_INTERNAL_H_
+
+// #include
+// #include
+// #include
+// #include
+
+// #if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) &&
+// __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) ||
+// defined(_WIN32)
+public static final int TF_TSTRING_LITTLE_ENDIAN = 1;
+// #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) &&
+// __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+// #else
+// #error "Unable to detect endianness."
+// #endif
+
+// #if defined(__clang__) ||
+// (defined(__GNUC__) &&
+// ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ >= 5))
+public static native @Cast("uint32_t") int TF_swap32(@Cast("uint32_t") int host_int);
+
+// #elif defined(_MSC_VER)
+
+// #elif defined(__APPLE__)
+
+// #else
+// #endif
+
+// #if TF_TSTRING_LITTLE_ENDIAN
+// #define TF_le32toh(x) TF_swap32(x)
+// #else // TF_TSTRING_LITTLE_ENDIAN
+// #endif // TF_TSTRING_LITTLE_ENDIAN
+
+public static native @Cast("size_t") long TF_align16(@Cast("size_t") long i);
+
+public static native @Cast("size_t") long TF_max(@Cast("size_t") long a, @Cast("size_t") long b);
+public static native @Cast("size_t") long TF_min(@Cast("size_t") long a, @Cast("size_t") long b);
+
+/** enum TF_TString_Type */
+public static final int // NOLINT
+ TF_TSTR_SMALL = 0x00,
+ TF_TSTR_LARGE = 0x01,
+ TF_TSTR_OFFSET = 0x02,
+ TF_TSTR_VIEW = 0x03,
+ TF_TSTR_TYPE_MASK = 0x03;
+// Targeting ../TF_TString_Large.java
+
+
+// Targeting ../TF_TString_Offset.java
+
+
+// Targeting ../TF_TString_View.java
+
+
+// Targeting ../TF_TString_Raw.java
+
+
+// Targeting ../TF_TString_Union.java
+
+
+
+/** enum */
+
+public static native @MemberGetter int TF_TString_SmallCapacity();
+public static final int
+ TF_TString_SmallCapacity = TF_TString_SmallCapacity();
+// Targeting ../TF_TString_Small.java
+
+
+// Targeting ../TF_TString.java
+
+
+
+// TODO(dero): Fix for OSS, and add C only build test.
+// _Static_assert(CHAR_BIT == 8);
+// _Static_assert(sizeof(TF_TString) == 24);
+
+public static native @Cast("TF_TString_Type") int TF_TString_GetType(@Const TF_TString str);
+
+// XXX(dero): For the big-endian case, this function could potentially be more
+// performant and readable by always storing the string size as little-endian
+// and always byte-swapping on big endian, resulting in a simple 'bswap'+'shr'
+// (for architectures that have a bswap op).
+public static native @Cast("size_t") long TF_TString_ToActualSizeT(@Cast("size_t") long size);
+
+public static native @Cast("size_t") long TF_TString_ToInternalSizeT(@Cast("size_t") long size,
+ @Cast("TF_TString_Type") int type);
+
+public static native void TF_TString_Init(TF_TString str);
+
+public static native void TF_TString_Dealloc(TF_TString str);
+
+public static native @Cast("size_t") long TF_TString_GetSize(@Const TF_TString str);
+
+public static native @Cast("size_t") long TF_TString_GetCapacity(@Const TF_TString str);
+
+public static native @Cast("const char*") BytePointer TF_TString_GetDataPointer(@Const TF_TString str);
+
+public static native @Cast("char*") BytePointer TF_TString_ResizeUninitialized(TF_TString str,
+ @Cast("size_t") long new_size);
+
+public static native @Cast("char*") BytePointer TF_TString_GetMutableDataPointer(TF_TString str);
+
+public static native void TF_TString_Reserve(TF_TString str, @Cast("size_t") long new_cap);
+
+public static native @Cast("char*") BytePointer TF_TString_Resize(TF_TString str, @Cast("size_t") long new_size,
+ @Cast("char") byte c);
+
+public static native void TF_TString_AssignView(TF_TString dst, @Cast("const char*") BytePointer src,
+ @Cast("size_t") long size);
+public static native void TF_TString_AssignView(TF_TString dst, String src,
+ @Cast("size_t") long size);
+
+public static native void TF_TString_AppendN(TF_TString dst, @Cast("const char*") BytePointer src,
+ @Cast("size_t") long src_size);
+public static native void TF_TString_AppendN(TF_TString dst, String src,
+ @Cast("size_t") long src_size);
+
+public static native void TF_TString_Append(TF_TString dst, @Const TF_TString src);
+
+public static native void TF_TString_Copy(TF_TString dst, @Cast("const char*") BytePointer src,
+ @Cast("size_t") long size);
+public static native void TF_TString_Copy(TF_TString dst, String src,
+ @Cast("size_t") long size);
+
+public static native void TF_TString_Assign(TF_TString dst, @Const TF_TString src);
+
+public static native void TF_TString_Move(TF_TString dst, TF_TString src);
+
+// #endif // TENSORFLOW_CORE_PLATFORM_CTSTRING_INTERNAL_H_
+
+
+// Parsed from tensorflow/core/platform/ctstring.h
+
+/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_CORE_PLATFORM_CTSTRING_H_
+// #define TENSORFLOW_CORE_PLATFORM_CTSTRING_H_
+
+// #include
+// #include
+
+// #include "tensorflow/core/platform/ctstring_internal.h"
+
+// Initialize a new tstring. This must be called before using any function
+// below.
+// Deallocate a tstring.
+
+// Resizes `str' to `new_size'. This function will appropriately grow or shrink
+// the string buffer to fit a `new_size' string. Grown regions of the string
+// will be initialized with `c'.
+// Similar to TF_TString_Resize, except the newly allocated regions will remain
+// uninitialized. This is useful if you plan on overwriting the newly grown
+// regions immediately after allocation; doing so will elide a superfluous
+// initialization of the new buffer.
+// Reserves a string buffer with a capacity of at least `new_cap'.
+// ResizeUninitialized will not change the size, or the contents of the existing
+// string. This is useful if you have a rough idea of `str's upperbound in
+// size, and want to avoid allocations as you append to `str'. It should not be
+// considered safe to write in the region between size and capacity; explicitly
+// resize before doing so.
+
+// Returns the size of the string.
+// Returns the capacity of the string buffer. It should not be considered safe
+// to write in the region between size and capacity---call Resize or
+// ResizeUninitialized before doing so.
+// Returns the underlying type of the tstring:
+// TF_TSTR_SMALL:
+// Small string optimization; the contents of strings
+// less than 22-bytes are stored in the TF_TString struct. This avoids any
+// heap allocations.
+// TF_TSTR_LARGE:
+// Heap allocated string.
+// TF_TSTR_OFFSET: (currently unused)
+// An offset defined string. The string buffer begins at an internally
+// defined little-endian offset from `str'; i.e. GetDataPointer() = str +
+// offset. This type is useful for memory mapping or reading string tensors
+// directly from file, without the need to deserialize the data. For
+// security reasons, it is imperative that OFFSET based string tensors are
+// validated before use, or are from a trusted source.
+// TF_TSTR_VIEW:
+// A view into an unowned character string.
+//
+// NOTE:
+// VIEW and OFFSET types are immutable, so any modifcation via Append,
+// AppendN, or GetMutableDataPointer of a VIEW/OFFSET based tstring will
+// result in a conversion to an owned type (SMALL/LARGE).
+
+// Returns a const char pointer to the start of the underlying string. The
+// underlying character buffer may not be null-terminated.
+// Returns a char pointer to a mutable representation of the underlying string.
+// In the case of VIEW and OFFSET types, `src' is converted to an owned type
+// (SMALL/LARGE). The underlying character buffer may not be null-terminated.
+
+// Sets `dst' as a VIEW type to `src'. `dst' will not take ownership of `src'.
+// It is the user's responsibility to ensure that the lifetime of `src' exceeds
+// `dst'. Any mutations to `dst' via Append, AppendN, or GetMutableDataPointer,
+// will result in a copy into an owned SMALL or LARGE type, and will not modify
+// `src'.
+
+// Appends `src' onto `dst'. If `dst' is a VIEW or OFFSET type, it will first
+// be converted to an owned LARGE or SMALL type. `dst' should not point to
+// memory owned by `src'.
+
+// Copy/Move/Assign semantics
+//
+// | src | dst | complexity
+// Copy | * | SMALL/LARGE | fixed/O(size)
+// Assign | SMALL | SMALL | fixed
+// Assign | OFFSET | VIEW | fixed
+// Assign | VIEW | VIEW | fixed
+// Assign | LARGE | LARGE | O(size)
+// Move | * | same as src | fixed
+
+// Copies `src' to `dst'. `dst' will be an owned type (SMALL/LARGE). `src'
+// should not point to memory owned by `dst'.
+// Assigns a `src' tstring to `dst'. An OFFSET `src' type will yield a `VIEW'
+// `dst'. LARGE `src' types will be copied to a new buffer; all other `src'
+// types will incur a fixed cost.
+// Moves a `src' tstring to `dst'. Moving a LARGE `src' to `dst' will result in
+// a valid but unspecified `src'. This function incurs a fixed cost for all
+// inputs.
+
+// #endif // TENSORFLOW_CORE_PLATFORM_CTSTRING_H_
+
+
// Parsed from tensorflow/core/util/port.h
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
@@ -103,6 +361,56 @@ public class tensorflow extends org.tensorflow.internal.c_api.presets.tensorflow
// #endif // TENSORFLOW_C_TF_ATTRTYPE_H_
+// Parsed from tensorflow/c/c_api_macros.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+// #ifndef TENSORFLOW_C_C_API_MACROS_H_
+// #define TENSORFLOW_C_C_API_MACROS_H_
+
+// #ifdef SWIG
+// #define TF_CAPI_EXPORT
+// #else
+// #if defined(_WIN32)
+// #ifdef TF_COMPILE_LIBRARY
+// #define TF_CAPI_EXPORT __declspec(dllexport)
+// #else
+// #define TF_CAPI_EXPORT __declspec(dllimport)
+// #endif // TF_COMPILE_LIBRARY
+// #else
+// #define TF_CAPI_EXPORT __attribute__((visibility("default")))
+// #endif // _WIN32
+// #endif // SWIG
+
+// TF_Bool is the C API typedef for unsigned char, while TF_BOOL is
+// the datatype for boolean tensors.
+// #ifndef TF_Bool
+// #define TF_Bool unsigned char
+// #endif // TF_Bool
+
+// Macro used to calculate struct size for maintaining ABI stability across
+// different struct implementations.
+// #ifndef TF_OFFSET_OF_END
+// #define TF_OFFSET_OF_END(TYPE, MEMBER)
+// (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
+// #endif // TF_OFFSET_OF_END
+
+// #endif // TENSORFLOW_C_C_API_MACROS_H_
+
+
// Parsed from tensorflow/c/tf_datatype.h
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
@@ -311,6 +619,7 @@ public static native void TF_SetStatusFromIOError(TF_Status s, int error_code,
// #include
// #include
+// #include "tensorflow/c/c_api_macros.h"
// #include "tensorflow/c/tf_datatype.h"
// #include "tensorflow/c/tf_status.h"
@@ -334,6 +643,12 @@ public static native void TF_SetStatusFromIOError(TF_Status s, int error_code,
// #endif // SWIG
// #ifdef __cplusplus
+// Targeting ../TF_AllocatorAttributes.java
+
+
+
+public static native @MemberGetter int TF_ALLOCATOR_ATTRIBUTES_STRUCT_SIZE();
+public static final int TF_ALLOCATOR_ATTRIBUTES_STRUCT_SIZE = TF_ALLOCATOR_ATTRIBUTES_STRUCT_SIZE();
// Targeting ../TF_Tensor.java
@@ -438,67 +753,6 @@ public static native void TF_TensorBitcastFrom(@Const TF_Tensor from,
int num_new_dims,
TF_Status status);
-// --------------------------------------------------------------------------
-// Encode the string `src` (`src_len` bytes long) into `dst` in the format
-// required by TF_STRING tensors. Does not write to memory more than `dst_len`
-// bytes beyond `*dst`. `dst_len` should be at least
-// TF_StringEncodedSize(src_len).
-//
-// On success returns the size in bytes of the encoded string.
-// Returns an error into `status` otherwise.
-public static native @Cast("size_t") long TF_StringEncode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("char*") BytePointer dst, @Cast("size_t") long dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringEncode(String src, @Cast("size_t") long src_len,
- @Cast("char*") ByteBuffer dst, @Cast("size_t") long dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringEncode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("char*") byte[] dst, @Cast("size_t") long dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringEncode(String src, @Cast("size_t") long src_len,
- @Cast("char*") BytePointer dst, @Cast("size_t") long dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringEncode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("char*") ByteBuffer dst, @Cast("size_t") long dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringEncode(String src, @Cast("size_t") long src_len,
- @Cast("char*") byte[] dst, @Cast("size_t") long dst_len,
- TF_Status status);
-
-// Decode a string encoded using TF_StringEncode.
-//
-// On success, sets `*dst` to the start of the decoded string and `*dst_len` to
-// its length. Returns the number of bytes starting at `src` consumed while
-// decoding. `*dst` points to memory within the encoded buffer. On failure,
-// `*dst` and `*dst_len` are undefined and an error is set in `status`.
-//
-// Does not read memory more than `src_len` bytes beyond `src`.
-public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("const char**") PointerPointer dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("const char**") @ByPtrPtr BytePointer dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringDecode(String src, @Cast("size_t") long src_len,
- @Cast("const char**") @ByPtrPtr ByteBuffer dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("const char**") @ByPtrPtr byte[] dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringDecode(String src, @Cast("size_t") long src_len,
- @Cast("const char**") @ByPtrPtr BytePointer dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringDecode(@Cast("const char*") BytePointer src, @Cast("size_t") long src_len,
- @Cast("const char**") @ByPtrPtr ByteBuffer dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-public static native @Cast("size_t") long TF_StringDecode(String src, @Cast("size_t") long src_len,
- @Cast("const char**") @ByPtrPtr byte[] dst, @Cast("size_t*") SizeTPointer dst_len,
- TF_Status status);
-
-// Return the size in bytes required to encode a string `len` bytes long into a
-// TF_STRING tensor.
-public static native @Cast("size_t") long TF_StringEncodedSize(@Cast("size_t") long len);
-
// Returns bool iff this tensor is aligned.
public static native @Cast("bool") boolean TF_TensorIsAligned(@Const TF_Tensor arg0);
@@ -508,6 +762,30 @@ public static native void TF_TensorBitcastFrom(@Const TF_Tensor from,
// #endif // TENSORFLOW_C_TF_TENSOR_H_
+// Parsed from tensorflow/c/tf_tstring.h
+
+/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+// #ifndef TENSORFLOW_C_TF_TSTRING_H_
+// #define TENSORFLOW_C_TF_TSTRING_H_
+
+// #include "tensorflow/core/platform/ctstring.h"
+
+// #endif // THIRD_PARTY_TENSORFLOW_C_TF_TSTRING_H_
+
+
// Parsed from tensorflow/c/c_api.h
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
@@ -535,6 +813,7 @@ public static native void TF_TensorBitcastFrom(@Const TF_Tensor from,
// #include "tensorflow/c/tf_datatype.h"
// #include "tensorflow/c/tf_status.h"
// #include "tensorflow/c/tf_tensor.h"
+// #include "tensorflow/c/tf_tstring.h"
// --------------------------------------------------------------------------
// C API for TensorFlow.
@@ -623,6 +902,9 @@ public static native TF_Buffer TF_NewBufferFromString(@Const Pointer proto,
public static native void TF_DeleteBuffer(TF_Buffer arg0);
public static native @ByVal TF_Buffer TF_GetBuffer(TF_Buffer buffer);
+// Targeting ../TF_StringView.java
+
+
// Targeting ../TF_SessionOptions.java
@@ -2699,6 +2981,10 @@ public static native TF_Buffer TF_GetRegisteredKernelsForOp(
@Cast("const char*") BytePointer name, TF_Status status);
public static native TF_Buffer TF_GetRegisteredKernelsForOp(
String name, TF_Status status);
+
+// Update edge, switch input/ output in a node
+public static native void TF_UpdateEdge(TF_Graph graph, @ByVal TF_Output new_src,
+ @ByVal TF_Input dst, TF_Status status);
// Targeting ../TF_Server.java
@@ -2743,6 +3029,15 @@ public static native void TF_RegisterLogListener(
public static native void TF_RegisterLogListener(
Listener_String listener);
+// Register a FileSystem plugin from filename `plugin_filename`.
+//
+// On success, place OK in status.
+// On failure, place an error status in status.
+public static native void TF_RegisterFilesystemPlugin(
+ @Cast("const char*") BytePointer plugin_filename, TF_Status status);
+public static native void TF_RegisterFilesystemPlugin(
+ String plugin_filename, TF_Status status);
+
// #ifdef __cplusplus /* end extern "C" */
// #endif
@@ -2771,8 +3066,10 @@ public static native void TF_RegisterLogListener(
// #include
+// #include "tensorflow/c/c_api.h"
// #include "tensorflow/c/tf_datatype.h"
// #include "tensorflow/c/tf_status.h"
+// #include "tensorflow/c/tf_tensor.h"
// Macro to control visibility of exported symbols in the shared library (.so,
// .dylib, .dll).
@@ -2839,6 +3136,10 @@ public static native void TF_KernelBuilder_HostMemory(
public static native void TF_KernelBuilder_HostMemory(
TF_KernelBuilder kernel_builder, String arg_name);
+// Specify a priority number for this kernel.
+public static native void TF_KernelBuilder_Priority(
+ TF_KernelBuilder kernel_builder, int priority_number);
+
// Register the given kernel builder with the TensorFlow runtime. If
// registration fails, the given status will be populated.
//
@@ -2947,6 +3248,10 @@ public static native void TF_OpKernelConstruction_GetAttrInt32(
TF_OpKernelConstruction ctx, String attr_name, int[] val,
TF_Status status);
+// Returns the unique operation name for this OpKernel.
+public static native @ByVal TF_StringView TF_OpKernelConstruction_GetName(
+ TF_OpKernelConstruction ctx);
+
// Allocates Tensor for output at given index. Caller takes ownership of
// returned TF_Tensor and should deallocate it using TF_DeleteTensor(tensor).
//
@@ -2965,6 +3270,40 @@ public static native TF_Tensor TF_AllocateOutput(TF_OpKernelContext context,
@Cast("int64_t*") long[] dims, int num_dims,
@Cast("size_t") long len, TF_Status status);
+// Tries to forward one of the inputs given in input_indices to
+// output[output_index]. If none of the given inputs can be forwarded, calls
+// allocate_output() to allocate a new output buffer. The index of the
+// forwarded input will be assign to output argument forwarded_input (if it's
+// not nullptr). If no inputs are forwarded, forwarded_input will be assigned
+// -1.
+public static native TF_Tensor TF_ForwardInputOrAllocateOutput(
+ TF_OpKernelContext context, IntPointer candidate_input_indices,
+ int num_candidate_input_indices, int output_index, @Cast("int64_t*") LongPointer output_dims,
+ int output_num_dims, IntPointer forwarded_input, TF_Status status);
+public static native TF_Tensor TF_ForwardInputOrAllocateOutput(
+ TF_OpKernelContext context, IntBuffer candidate_input_indices,
+ int num_candidate_input_indices, int output_index, @Cast("int64_t*") LongBuffer output_dims,
+ int output_num_dims, IntBuffer forwarded_input, TF_Status status);
+public static native TF_Tensor TF_ForwardInputOrAllocateOutput(
+ TF_OpKernelContext context, int[] candidate_input_indices,
+ int num_candidate_input_indices, int output_index, @Cast("int64_t*") long[] output_dims,
+ int output_num_dims, int[] forwarded_input, TF_Status status);
+
+// Allocates a temporary Tensor of the specified type and shape. The
+// Tensor must not be used after kernel construction is
+// complete.
+//
+// num_dims must equal the size of array dims
+public static native TF_Tensor TF_AllocateTemp(
+ TF_OpKernelContext context, @Cast("TF_DataType") int dtype, @Cast("int64_t*") LongPointer dims, int num_dims,
+ TF_AllocatorAttributes alloc_attrs, TF_Status status);
+public static native TF_Tensor TF_AllocateTemp(
+ TF_OpKernelContext context, @Cast("TF_DataType") int dtype, @Cast("int64_t*") LongBuffer dims, int num_dims,
+ TF_AllocatorAttributes alloc_attrs, TF_Status status);
+public static native TF_Tensor TF_AllocateTemp(
+ TF_OpKernelContext context, @Cast("TF_DataType") int dtype, @Cast("int64_t*") long[] dims, int num_dims,
+ TF_AllocatorAttributes alloc_attrs, TF_Status status);
+
// #ifdef __cplusplus /* end extern "C" */
// #endif
@@ -3269,6 +3608,11 @@ public static native void TF_ShapeInferenceContextSetOutput(TF_ShapeInferenceCon
int i, TF_ShapeHandle handle,
TF_Status status);
+// Returns a newly-allocated scalar shape handle. The returned handle should
+// be freed with TF_DeleteShapeHandle.
+public static native TF_ShapeHandle TF_ShapeInferenceContextScalar(
+ TF_ShapeInferenceContext ctx);
+
// Returns a newly-allocate shape handle representing a vector of the given
// size. The returned handle should be freed with TF_DeleteShapeHandle.
public static native TF_ShapeHandle TF_ShapeInferenceContextVectorFromSize(
@@ -3452,7 +3796,7 @@ public static native void TFE_ContextOptionsSetConfig(
TFE_DEVICE_PLACEMENT_SILENT = 2,
// Placement policy which silently copies int32 tensors but not other dtypes.
TFE_DEVICE_PLACEMENT_SILENT_FOR_INT32 = 3;
-// LINT.ThenChange(//tensorflow/core/common_runtime/eager/context.h)
+// LINT.ThenChange(//tensorflow/c/eager/immediate_execution_context.h)
// Sets the default execution mode (sync/async). Note that this can be
// overridden per thread using TFE_ContextSetExecutorForThread.
@@ -3608,24 +3952,24 @@ public static native TFE_Op TFE_NewOp(TFE_Context ctx,
public static native TFE_Op TFE_NewOp(TFE_Context ctx,
String op_or_function_name,
TF_Status status);
-
public static native void TFE_DeleteOp(TFE_Op op);
+// Returns the op or function name `op` will execute.
+//
+// The returned string remains valid throughout the lifetime of 'op'.
+public static native @Cast("const char*") BytePointer TFE_OpGetName(@Const TFE_Op op,
+ TF_Status status);
+public static native TFE_Context TFE_OpGetContext(@Const TFE_Op op,
+ TF_Status status);
+
public static native void TFE_OpSetDevice(TFE_Op op, @Cast("const char*") BytePointer device_name,
TF_Status status);
public static native void TFE_OpSetDevice(TFE_Op op, String device_name,
TF_Status status);
// The returned string remains valid throughout the lifetime of 'op'.
-public static native @Cast("const char*") BytePointer TFE_OpGetDevice(TFE_Op op,
+public static native @Cast("const char*") BytePointer TFE_OpGetDevice(@Const TFE_Op op,
TF_Status status);
-// When 'enable' is set to 1, and if TensorFlow library is built with XLA
-// support, a subsequent TFE_Execute() call on `op` will run the op via XLA.
-//
-// If the library is not built with XLA support, this call would be a no-op.
-public static native void TFE_OpSetXLACompilation(TFE_Op op,
- @Cast("unsigned char") byte enable);
-
public static native void TFE_OpAddInput(TFE_Op op, TFE_TensorHandle input,
TF_Status status);
@@ -3638,6 +3982,23 @@ public static native void TFE_OpAddInputList(TFE_Op op,
int num_inputs,
TF_Status status);
+// Fetches the current number of inputs attached to `op`.
+//
+// Does not use the operation's definition to determine how many inputs should
+// be attached. It is intended for use with TFE_OpGetFlatInput to inspect an
+// already-finalized operation.
+//
+// Note that TFE_OpGetFlatInputCount and TFE_OpGetFlatInput operate on a flat
+// sequence of inputs, unlike TFE_OpGetInputLength (for getting the length of a
+// particular named input list, which may only be part of the op's inputs).
+public static native int TFE_OpGetFlatInputCount(@Const TFE_Op op,
+ TF_Status status);
+// Returns a borrowed reference to one of `op`'s inputs. Use
+// `TFE_TensorHandleCopySharingTensor` to make a new reference.
+public static native TFE_TensorHandle TFE_OpGetFlatInput(@Const TFE_Op op,
+ int index,
+ TF_Status status);
+
public static native @Cast("TF_AttrType") int TFE_OpGetAttrType(TFE_Op op,
@Cast("const char*") BytePointer attr_name,
@Cast("unsigned char*") BytePointer is_list,
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java
index adaafc5fc90..443ca7dfb98 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/AllReduce.java
@@ -31,7 +31,7 @@
/**
* Mutually reduces multiple tensors of identical type and shape.
*
- * @param data type for {@code output()} output
+ * @param data type for {@code data()} output
*/
public final class AllReduce extends RawOp implements Operand {
@@ -144,23 +144,23 @@ public static Options timeoutSeconds(Float timeoutSeconds) {
/**
*/
- public Output output() {
- return output;
+ public Output data() {
+ return data;
}
@Override
public Output asOutput() {
- return output;
+ return data;
}
/** The name of this op, as known by TensorFlow core engine */
public static final String OP_NAME = "CollectiveReduce";
- private Output output;
+ private Output data;
private AllReduce(Operation operation) {
super(operation);
int outputIdx = 0;
- output = operation.output(outputIdx++);
+ data = operation.output(outputIdx++);
}
}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java
index bce981a1f6f..4ade0cfc0a6 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastRecv.java
@@ -32,7 +32,7 @@
/**
* Receives a tensor value broadcast from another device.
*
- * @param data type for {@code output()} output
+ * @param data type for {@code data()} output
*/
public final class BroadcastRecv extends RawOp implements Operand {
@@ -114,23 +114,23 @@ public static Options timeoutSeconds(Float timeoutSeconds) {
/**
*/
- public Output output() {
- return output;
+ public Output data() {
+ return data;
}
@Override
public Output asOutput() {
- return output;
+ return data;
}
/** The name of this op, as known by TensorFlow core engine */
public static final String OP_NAME = "CollectiveBcastRecv";
- private Output output;
+ private Output data;
private BroadcastRecv(Operation operation) {
super(operation);
int outputIdx = 0;
- output = operation.output(outputIdx++);
+ data = operation.output(outputIdx++);
}
}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java
index 84a99f4f1bb..9a2646dc630 100644
--- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/BroadcastSend.java
@@ -31,7 +31,7 @@
/**
* Broadcasts a tensor value to one or more other devices.
*
- * @param data type for {@code output()} output
+ * @param data type for {@code data()} output
*/
public final class BroadcastSend extends RawOp implements Operand {
@@ -113,23 +113,23 @@ public static Options timeoutSeconds(Float timeoutSeconds) {
/**
*/
- public Output output() {
- return output;
+ public Output data() {
+ return data;
}
@Override
public Output asOutput() {
- return output;
+ return data;
}
/** The name of this op, as known by TensorFlow core engine */
public static final String OP_NAME = "CollectiveBcastSend";
- private Output output;
+ private Output data;
private BroadcastSend(Operation operation) {
super(operation);
int outputIdx = 0;
- output = operation.output(outputIdx++);
+ data = operation.output(outputIdx++);
}
}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/Gather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/Gather.java
new file mode 100644
index 00000000000..be698afc2e7
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/Gather.java
@@ -0,0 +1,135 @@
+/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+=======================================================================*/
+
+// This class has been generated, DO NOT EDIT!
+
+package org.tensorflow.op.collective;
+
+import org.tensorflow.Operand;
+import org.tensorflow.Operation;
+import org.tensorflow.OperationBuilder;
+import org.tensorflow.Output;
+import org.tensorflow.ndarray.Shape;
+import org.tensorflow.op.RawOp;
+import org.tensorflow.op.Scope;
+import org.tensorflow.op.annotation.Endpoint;
+import org.tensorflow.op.annotation.Operator;
+import org.tensorflow.types.family.TNumber;
+
+/**
+ * Mutually accumulates multiple tensors of identical type and shape.
+ *
+ * @param data type for {@code data()} output
+ */
+public final class Gather extends RawOp implements Operand {
+
+ /**
+ * Optional attributes for {@link org.tensorflow.op.collective.Gather}
+ */
+ public static class Options {
+
+ /**
+ * @param communicationHint
+ */
+ public Options communicationHint(String communicationHint) {
+ this.communicationHint = communicationHint;
+ return this;
+ }
+
+ /**
+ * @param timeoutSeconds
+ */
+ public Options timeoutSeconds(Float timeoutSeconds) {
+ this.timeoutSeconds = timeoutSeconds;
+ return this;
+ }
+
+ private String communicationHint;
+ private Float timeoutSeconds;
+
+ private Options() {
+ }
+ }
+
+ /**
+ * Factory method to create a class wrapping a new Gather operation.
+ *
+ * @param scope current scope
+ * @param input
+ * @param groupSize
+ * @param groupKey
+ * @param instanceKey
+ * @param shape
+ * @param options carries optional attributes values
+ * @return a new instance of Gather
+ */
+ @Endpoint(describeByClass = true)
+ public static Gather create(Scope scope, Operand input, Long groupSize, Long groupKey, Long instanceKey, Shape shape, Options... options) {
+ OperationBuilder opBuilder = scope.env().opBuilder("CollectiveGather", scope.makeOpName("Gather"));
+ opBuilder.addInput(input.asOutput());
+ opBuilder = scope.apply(opBuilder);
+ opBuilder.setAttr("group_size", groupSize);
+ opBuilder.setAttr("group_key", groupKey);
+ opBuilder.setAttr("instance_key", instanceKey);
+ opBuilder.setAttr("shape", shape);
+ if (options != null) {
+ for (Options opts : options) {
+ if (opts.communicationHint != null) {
+ opBuilder.setAttr("communication_hint", opts.communicationHint);
+ }
+ if (opts.timeoutSeconds != null) {
+ opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds);
+ }
+ }
+ }
+ return new Gather(opBuilder.build());
+ }
+
+ /**
+ * @param communicationHint
+ */
+ public static Options communicationHint(String communicationHint) {
+ return new Options().communicationHint(communicationHint);
+ }
+
+ /**
+ * @param timeoutSeconds
+ */
+ public static Options timeoutSeconds(Float timeoutSeconds) {
+ return new Options().timeoutSeconds(timeoutSeconds);
+ }
+
+ /**
+ */
+ public Output data() {
+ return data;
+ }
+
+ @Override
+ public Output asOutput() {
+ return data;
+ }
+
+ /** The name of this op, as known by TensorFlow core engine */
+ public static final String OP_NAME = "CollectiveGather";
+
+ private Output data;
+
+ private Gather(Operation operation) {
+ super(operation);
+ int outputIdx = 0;
+ data = operation.output(outputIdx++);
+ }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/GatherV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/GatherV2.java
new file mode 100644
index 00000000000..0b90160e904
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/GatherV2.java
@@ -0,0 +1,133 @@
+/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+=======================================================================*/
+
+// This class has been generated, DO NOT EDIT!
+
+package org.tensorflow.op.collective;
+
+import org.tensorflow.Operand;
+import org.tensorflow.Operation;
+import org.tensorflow.OperationBuilder;
+import org.tensorflow.Output;
+import org.tensorflow.op.RawOp;
+import org.tensorflow.op.Scope;
+import org.tensorflow.op.annotation.Endpoint;
+import org.tensorflow.op.annotation.Operator;
+import org.tensorflow.types.TInt32;
+import org.tensorflow.types.family.TNumber;
+
+/**
+ * Mutually accumulates multiple tensors of identical type and shape.
+ *
+ * @param data type for {@code data()} output
+ */
+public final class GatherV2 extends RawOp implements Operand {
+
+ /**
+ * Optional attributes for {@link org.tensorflow.op.collective.GatherV2}
+ */
+ public static class Options {
+
+ /**
+ * @param communicationHint
+ */
+ public Options communicationHint(String communicationHint) {
+ this.communicationHint = communicationHint;
+ return this;
+ }
+
+ /**
+ * @param timeoutSeconds
+ */
+ public Options timeoutSeconds(Float timeoutSeconds) {
+ this.timeoutSeconds = timeoutSeconds;
+ return this;
+ }
+
+ private String communicationHint;
+ private Float timeoutSeconds;
+
+ private Options() {
+ }
+ }
+
+ /**
+ * Factory method to create a class wrapping a new GatherV2 operation.
+ *
+ * @param scope current scope
+ * @param input
+ * @param groupSize
+ * @param groupKey
+ * @param instanceKey
+ * @param options carries optional attributes values
+ * @return a new instance of GatherV2
+ */
+ @Endpoint(describeByClass = true)
+ public static GatherV2 create(Scope scope, Operand input, Operand groupSize, Operand groupKey, Operand instanceKey, Options... options) {
+ OperationBuilder opBuilder = scope.env().opBuilder("CollectiveGatherV2", scope.makeOpName("GatherV2"));
+ opBuilder.addInput(input.asOutput());
+ opBuilder.addInput(groupSize.asOutput());
+ opBuilder.addInput(groupKey.asOutput());
+ opBuilder.addInput(instanceKey.asOutput());
+ opBuilder = scope.apply(opBuilder);
+ if (options != null) {
+ for (Options opts : options) {
+ if (opts.communicationHint != null) {
+ opBuilder.setAttr("communication_hint", opts.communicationHint);
+ }
+ if (opts.timeoutSeconds != null) {
+ opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds);
+ }
+ }
+ }
+ return new GatherV2(opBuilder.build());
+ }
+
+ /**
+ * @param communicationHint
+ */
+ public static Options communicationHint(String communicationHint) {
+ return new Options().communicationHint(communicationHint);
+ }
+
+ /**
+ * @param timeoutSeconds
+ */
+ public static Options timeoutSeconds(Float timeoutSeconds) {
+ return new Options().timeoutSeconds(timeoutSeconds);
+ }
+
+ /**
+ */
+ public Output data() {
+ return data;
+ }
+
+ @Override
+ public Output asOutput() {
+ return data;
+ }
+
+ /** The name of this op, as known by TensorFlow core engine */
+ public static final String OP_NAME = "CollectiveGatherV2";
+
+ private Output data;
+
+ private GatherV2(Operation operation) {
+ super(operation);
+ int outputIdx = 0;
+ data = operation.output(outputIdx++);
+ }
+}
diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/Reduce.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/Reduce.java
new file mode 100644
index 00000000000..71f4b0804e8
--- /dev/null
+++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/collective/Reduce.java
@@ -0,0 +1,166 @@
+/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+=======================================================================*/
+
+// This class has been generated, DO NOT EDIT!
+
+package org.tensorflow.op.collective;
+
+import java.util.List;
+import org.tensorflow.Operand;
+import org.tensorflow.Operation;
+import org.tensorflow.OperationBuilder;
+import org.tensorflow.Output;
+import org.tensorflow.op.RawOp;
+import org.tensorflow.op.Scope;
+import org.tensorflow.op.annotation.Endpoint;
+import org.tensorflow.op.annotation.Operator;
+import org.tensorflow.types.family.TNumber;
+
+/**
+ * Mutually reduces multiple tensors of identical type and shape.
+ *
+ * @param data type for {@code data()} output
+ */
+public final class Reduce extends RawOp implements Operand {
+
+ /**
+ * Optional attributes for {@link org.tensorflow.op.collective.Reduce}
+ */
+ public static class Options {
+
+ /**
+ * @param waitFor
+ */
+ public Options waitFor(List waitFor) {
+ this.waitFor = waitFor;
+ return this;
+ }
+
+ /**
+ * @param communicationHint
+ */
+ public Options communicationHint(String communicationHint) {
+ this.communicationHint = communicationHint;
+ return this;
+ }
+
+ /**
+ * @param timeoutSeconds
+ */
+ public Options timeoutSeconds(Float timeoutSeconds) {
+ this.timeoutSeconds = timeoutSeconds;
+ return this;
+ }
+
+ private List waitFor;
+ private String communicationHint;
+ private Float timeoutSeconds;
+
+ private Options() {
+ }
+ }
+
+ /**
+ * Factory method to create a class wrapping a new Reduce operation.
+ *
+ * @param scope current scope
+ * @param input
+ * @param groupSize
+ * @param groupKey
+ * @param instanceKey
+ * @param mergeOp
+ * @param finalOp
+ * @param subdivOffsets
+ * @param options carries optional attributes values
+ * @return a new instance of Reduce
+ */
+ @Endpoint(describeByClass = true)
+ public static Reduce create(Scope scope, Operand input, Long groupSize, Long groupKey, Long instanceKey, String mergeOp, String finalOp, List subdivOffsets, Options... options) {
+ OperationBuilder opBuilder = scope.env().opBuilder("CollectiveReduce", scope.makeOpName("Reduce"));
+ opBuilder.addInput(input.asOutput());
+ opBuilder = scope.apply(opBuilder);
+ opBuilder.setAttr("group_size", groupSize);
+ opBuilder.setAttr("group_key", groupKey);
+ opBuilder.setAttr("instance_key", instanceKey);
+ opBuilder.setAttr("merge_op", mergeOp);
+ opBuilder.setAttr("final_op", finalOp);
+ long[] subdivOffsetsArray = new long[subdivOffsets.size()];
+ for (int i = 0; i < subdivOffsetsArray.length; ++i) {
+ subdivOffsetsArray[i] = subdivOffsets.get(i);
+ }
+ opBuilder.setAttr("subdiv_offsets", subdivOffsetsArray);
+ if (options != null) {
+ for (Options opts : options) {
+ if (opts.waitFor != null) {
+ long[] waitForArray = new long[opts.waitFor.size()];
+ for (int i = 0; i < waitForArray.length; ++i) {
+ waitForArray[i] = opts.waitFor.get(i);
+ }
+ opBuilder.setAttr("wait_for", waitForArray);
+ }
+ if (opts.communicationHint != null) {
+ opBuilder.setAttr("communication_hint", opts.communicationHint);
+ }
+ if (opts.timeoutSeconds != null) {
+ opBuilder.setAttr("timeout_seconds", opts.timeoutSeconds);
+ }
+ }
+ }
+ return new Reduce(opBuilder.build());
+ }
+
+ /**
+ * @param waitFor
+ */
+ public static Options waitFor(List waitFor) {
+ return new Options().waitFor(waitFor);
+ }
+
+ /**
+ * @param communicationHint
+ */
+ public static Options communicationHint(String communicationHint) {
+ return new Options().communicationHint(communicationHint);
+ }
+
+ /**
+ * @param timeoutSeconds
+ */
+ public static Options timeoutSeconds(Float timeoutSeconds) {
+ return new Options().timeoutSeconds(timeoutSeconds);
+ }
+
+ /**
+ */
+ public Output