From ad466eefd2bb13f7970ba25aadbaab1a3867e692 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Thu, 31 Dec 2020 19:29:42 -0500 Subject: [PATCH 01/60] Initial checkin --- .../tensorflow/framework/losses/Losses.java | 3 + .../framework/metrics/BinaryCrossentropy.java | 66 ++++ .../metrics/CategoricalCrossentropy.java | 99 ++++++ .../framework/metrics/CategoricalHinge.java | 46 +++ .../framework/metrics/CosineSimilarity.java | 68 ++++ .../tensorflow/framework/metrics/Hinge.java | 46 +++ .../framework/metrics/KLDivergence.java | 46 +++ .../framework/metrics/LogCoshError.java | 49 +++ .../tensorflow/framework/metrics/Mean.java | 40 +++ .../framework/metrics/MeanAbsoluteError.java | 46 +++ .../metrics/MeanAbsolutePercentageError.java | 46 +++ .../framework/metrics/MeanSquaredError.java | 46 +++ .../metrics/MeanSquaredLogarithmicError.java | 46 +++ .../tensorflow/framework/metrics/Metric.java | 320 ++++++++++++++++++ .../framework/metrics/MetricReduction.java | 26 ++ .../tensorflow/framework/metrics/Metrics.java | 192 +++++++++++ .../tensorflow/framework/metrics/Poisson.java | 46 +++ .../SparseCategoricalCrossentropy.java | 54 +++ .../SparseTopKCategoricalAccuracy.java | 65 ++++ .../framework/metrics/SquaredHinge.java | 46 +++ .../metrics/TopKCategoricalAccuracy.java | 63 ++++ .../framework/metrics/impl/LossInterface.java | 36 ++ .../metrics/impl/MeanMetricWrapper.java | 125 +++++++ .../metrics/impl/MetricVariable.java | 122 +++++++ .../framework/metrics/impl/MetricsHelper.java | 154 +++++++++ .../framework/metrics/impl/Reduce.java | 204 +++++++++++ .../metrics/BinaryCrossentropyTest.java | 150 ++++++++ .../metrics/CategoricalCrossentropyTest.java | 151 +++++++++ .../metrics/CategoricalHingeTest.java | 97 ++++++ .../metrics/CosineSimilarityTest.java | 101 ++++++ .../framework/metrics/HingeTest.java | 84 +++++ .../framework/metrics/KLDivergenceTest.java | 83 +++++ .../framework/metrics/LogCoshErrorTest.java | 80 +++++ .../metrics/MeanAbsoluteErrorTest.java | 116 +++++++ .../MeanAbsolutePercentageErrorTest.java | 115 +++++++ .../metrics/MeanSquaredErrorTest.java | 107 ++++++ .../MeanSquaredLogarithmicErrorTest.java | 106 ++++++ .../framework/metrics/PoissonTest.java | 79 +++++ .../SparseCategoricalCrossentropyTest.java | 129 +++++++ .../SparseTopKCategoricalAccuracyTest.java | 96 ++++++ .../framework/metrics/SquaredHingeTest.java | 90 +++++ .../metrics/TopKCategoricalAccuracyTest.java | 103 ++++++ 42 files changed, 3787 insertions(+) create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MetricReduction.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalCrossentropyTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalHingeTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/HingeTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/LogCoshErrorTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsoluteErrorTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageErrorTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredErrorTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicErrorTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/PoissonTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropyTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SquaredHingeTest.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/Losses.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/Losses.java index 81d9e13c8a9..3894bee0d0f 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/Losses.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/losses/Losses.java @@ -36,6 +36,9 @@ public class Losses { /** Default Fuzz factor. */ public static final float EPSILON = 1e-7f; + public static final int CHANNELS_LAST = -1; + public static final int CHANNELS_FIRST = 1; + /** * Calculates the mean absolute error between labels and predictions. * diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java new file mode 100644 index 00000000000..d13d20bfdee --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java @@ -0,0 +1,66 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** + * Computes the binary cross-entropy loss between true labels and predicted labels. + * + * @param the data type for the predictions. + * @param The data type for the metric result + */ +public class BinaryCrossentropy + extends MeanMetricWrapper implements LossInterface { + + private final boolean fromLogits; + private final float labelSmoothing; + + /** + * Creates a BinaryCrossentropy metric + * + *

This is the crossentropy metric class to be used when there are only two label classes (0 + * and 1). + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param labelSmoothing value used to smooth labels, When 0, no smoothing occurs. When > 0, + * compute the loss between the predicted labels and a smoothed version of the true labels, + * where the smoothing squeezes the labels towards 0.5. Larger values of label_smoothing + * correspond to heavier smoothing. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + * @param type the data type for the variables + */ + public BinaryCrossentropy( + Ops tf, String name, boolean fromLogits, float labelSmoothing, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + this.fromLogits = fromLogits; + this.labelSmoothing = labelSmoothing; + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.binaryCrossentropy(getTF(), labels, predictions, fromLogits, labelSmoothing); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java new file mode 100644 index 00000000000..cf9ecd0858a --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java @@ -0,0 +1,99 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** + * Computes the categorical cross-entropy loss between true labels and predicted labels. + * + *

This is the crossentropy metric class to be used when there are multiple label classes (2 or + * more). Here we assume that labels are given as a one_hot representation. eg., When labels values + * are [2, 0, 1], the labels Operand contains = [[0, 0, 1], [1, 0, 0], [0, 1, 0]] + * . + */ +public class CategoricalCrossentropy + extends MeanMetricWrapper implements LossInterface { + + private final boolean fromLogits; + private final float labelSmoothing; + private int axis; + + /** + * Creates a CategoricalCrossentropy metric that Computes the crossentropy metric between the + * labels and predictions. + * + *

Uses a {@link Losses#CHANNELS_LAST} for the channel axis. + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param labelSmoothing value used to smooth labels, When > 0, label values are smoothed, + * meaning the confidence on label values are relaxed. e.g. labelSmoothing=0.2 + * means that we will use a value of 0.1 for label 0 and 0.9 + * for label 1 + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public CategoricalCrossentropy( + Ops tf, String name, boolean fromLogits, float labelSmoothing, long seed, Class type) { + this(tf, name, fromLogits, labelSmoothing, Losses.CHANNELS_LAST, seed, type); + } + + /** + * Creates a CategoricalCrossentropy metric that Computes the crossentropy metric between the + * labels and predictions. + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param labelSmoothing value used to smooth labels, When > 0, label values are smoothed, + * meaning the confidence on label values are relaxed. e.g. labelSmoothing=0.2 + * means that we will use a value of 0.1 for label 0 and 0.9 + * for label 1 + * @param axis Int specifying the channels axis. axis={@link Losses#CHANNELS_LAST} + * corresponds to data format channels_last, and + * axis={@link Losses#CHANNELS_FIRST} corresponds to data format + * channels_first. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public CategoricalCrossentropy( + Ops tf, + String name, + boolean fromLogits, + float labelSmoothing, + int axis, + long seed, + Class type) { + super(tf, name, seed, type); + setLoss(this); + this.fromLogits = fromLogits; + this.labelSmoothing = labelSmoothing; + this.axis = axis; + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.categoricalCrossentropy( + getTF(), labels, predictions, fromLogits, labelSmoothing, axis); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java new file mode 100644 index 00000000000..a9500b79d9e --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the categorical hinge loss metric between labels and predictions. */ +public class CategoricalHinge extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a CategoricalHinge metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public CategoricalHinge(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.categoricalHinge(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java new file mode 100644 index 00000000000..61802572c7b --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java @@ -0,0 +1,68 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the cosine similarity metric between labels and predictions. */ +// TODO: this is weird, the metric is called CosineSimilarity in Keras, +// but it calls Metrics.cosineProximity instead of Losses.cosineSimilarity. +// The metric is calculating the Euclidean distance using L2 norms, while the loss +// is using the dot product proportional to the product of their magnitudes. +// While the 2 concepts are similar, they are different. +// Should we rename this metric to CosineProximity? +public class CosineSimilarity extends MeanMetricWrapper + implements LossInterface { + public static final int[] DEFAULT_AXIS = {-1}; + private final int[] axis; + + /** + * Creates a CosineSimilarity metric with a default axis, {@link #DEFAULT_AXIS} + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public CosineSimilarity(Ops tf, String name, long seed, Class type) { + this(tf, name, DEFAULT_AXIS, seed, type); + } + + /** + * Creates a CosineSimilarity metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param axis The dimension along which the cosine similarity is computed. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public CosineSimilarity(Ops tf, String name, int[] axis, long seed, Class type) { + super(tf, name, seed, type); + this.axis = axis; + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + // NOTE: cosineProximity is a different algorithm than Losses.cosineSimilarity + return Metrics.cosineProximity(getTF(), labels, predictions, axis); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java new file mode 100644 index 00000000000..d655f8d8237 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the hinge loss metric between labels and predictions. */ +public class Hinge extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a Hinge metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public Hinge(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.hinge(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java new file mode 100644 index 00000000000..3f31383381a --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes Computes Kullback-Leibler divergence loss metric between labels and predictions. */ +public class KLDivergence extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a KLDivergence metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public KLDivergence(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.kullbackLeiblerDivergence(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java new file mode 100644 index 00000000000..7d4b8a9fad7 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java @@ -0,0 +1,49 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** + * Computes the logarithm of the hyperbolic cosine of the prediction error metric between labels and + * predictions. + */ +public class LogCoshError extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a LogCoshError metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public LogCoshError(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.logCosh(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java new file mode 100644 index 00000000000..08d1083dd05 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java @@ -0,0 +1,40 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.framework.metrics.impl.Reduce; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** + * Represents a Metric that implements a weighted mean {@link MetricReduction#WEIGHTED_MEAN } + * + * @param The data type for the metric values + * @param The data type for the metric result + */ +public class Mean extends Reduce { + + /** + * Creates a Reducible Metric with a metric reductions of {@link MetricReduction#SUM} + * + * @param tf the TensorFlow Ops + * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + protected Mean(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, MetricReduction.WEIGHTED_MEAN, type); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java new file mode 100644 index 00000000000..6b29c72fe82 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the mean of absolute difference between labels and predictions. */ +public class MeanAbsoluteError extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a Mean Absolute Error metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public MeanAbsoluteError(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.meanAbsoluteError(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java new file mode 100644 index 00000000000..6209245d881 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the mean of absolute difference between labels and predictions. */ +public class MeanAbsolutePercentageError + extends MeanMetricWrapper implements LossInterface { + + /** + * Creates a Mean Absolute Error metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public MeanAbsolutePercentageError(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.meanAbsolutePercentageError(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java new file mode 100644 index 00000000000..ce30e378e8d --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the mean of absolute difference between labels and predictions. */ +public class MeanSquaredError extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a Mean Absolute Error metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public MeanSquaredError(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.meanSquaredError(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java new file mode 100644 index 00000000000..9baeac2f320 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the mean of absolute difference between labels and predictions. */ +public class MeanSquaredLogarithmicError + extends MeanMetricWrapper implements LossInterface { + + /** + * Creates a Mean Absolute Error metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public MeanSquaredLogarithmicError(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.meanSquaredLogarithmicError(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java new file mode 100644 index 00000000000..62ec5439269 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. 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. + */ +package org.tensorflow.framework.metrics; + +/* 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. +=======================================================================*/ + +import org.tensorflow.ExecutionEnvironment; +import org.tensorflow.Operand; +import org.tensorflow.framework.initializers.Initializer; +import org.tensorflow.framework.metrics.impl.MetricVariable; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.family.TNumber; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * Base class for Metrics + * + * @param The data type for the metric values + * @param The data type for the metric result + */ +public abstract class Metric { + + /** variables are stored by ExecutionEnvironment, and then by an identifier name */ + protected static Map>> + variableMap = new WeakHashMap<>(); + /** The TensorFlow Ops */ + private final Ops tf; + /** The random number generator seed value */ + private final long seed; + + // TODO: how to handle variables across new ExecutionEnvironments. + // Metrics may be instantiated multiple times using the same variables, + // These variables become stale when a new ExecutionEnvironment is created + // (most commonly seen in Unit Tests), so the question is how to best handle this. + // Option 1, which is used here is to map the variables against an instance of + // an ExecutionEnvironment in a WeakHashMap, when a new ExecutionEnvironment is presented, the + // new + // variables are mapped to it. A WeakHashMap is used to throw away the old ExecutionEnvironment + // mappings, when the old ExecutionEnvironment is finalized. + // Option 2, keep an instance of the newly presented ExecutionEnvironment and if it changes, + // clear the variable maps. + // My guess is that in a non-unit test environment, only one ExecutionEnvironment will be used, + // I welcome thoughts on this. + /** The name for this metric. Defaults to {@link Class#getSimpleName()}. */ + private final String name; + + private final Class type; + + /** + * Creates a Metric with a name of {@link Class#getSimpleName()} } + * + * @param tf the TensorFlow Ops + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + protected Metric(Ops tf, long seed, Class type) { + this(tf, null, seed, type); + } + + /** + * Creates a Metric + * + * @param tf the TensorFlow Ops + * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + protected Metric(Ops tf, String name, long seed, Class type) { + if (!tf.scope().env().isGraph()) + throw new IllegalArgumentException("Metrics are required to execute in Graph mode."); + this.seed = seed; + this.name = name != null ? name : this.getClass().getSimpleName(); + this.tf = tf.withSubScope(this.name); + this.type = type; + } + + /** + * Creates a List of Operations to update the metric state based on input values. + * + *

This is an empty implementation that should be overridden in a subclass, if needed. + * + * @param values the inputs to be passed to update state, this may not be null + * @param sampleWeights sample weights to be applied to values, may be null. + * @return a List of Operations to update the metric state + */ + @SuppressWarnings({"unchecked", "unused"}) + public List updateStateList(Operand values, Operand sampleWeights) { + return Collections.EMPTY_LIST; + } + + /** + * Creates a List of Operations to update the metric state based on labels and predictions. + * + *

This is an empty implementation that should be overridden in a sub class, if needed. + * + * @param labels the labels + * @param predictions the predictions + * @param sampleWeights sample weights to be applied to values, may be null. + * @param the data type for the sample weights + * @return a List of Operations to update the metric state + */ + @SuppressWarnings({"unchecked","unused"}) + public List updateStateList( + Operand labels, Operand predictions, Operand sampleWeights) { + return Collections.EMPTY_LIST; + } + + /** + * Creates a NoOp Operation with control dependencies to update the metric state + * + * @param values the inputs to be passed to update state, this may not be null + * @param sampleWeights sample weights to be applied to values, may be null. + * @return the Operation to update the metric state + */ + public final Op updateState(Operand values, Operand sampleWeights) { + List controlOps = updateStateList(values, sampleWeights); + return tf.withSubScope("updateState").withControlDependencies(controlOps).noOp(); + } + + /** + * Creates a NoOp Operation with control dependencies to update the metric state + * + * @param labels the labels + * @param predictions the predictions + * @param sampleWeights sample weights to be applied to values, may be null. + * @return the Operation to update the metric state + */ + public final Op updateState( + Operand labels, Operand predictions, Operand sampleWeights) { + List controlOps = updateStateList(labels, predictions, sampleWeights); + return tf.withSubScope("updateState").withControlDependencies(controlOps).noOp(); + } + + /** + * Gets the current result of the metric + * + * @param tf the TensorFlow Ops used to create the result + * @return the result, possibly with control dependencies + */ + public abstract Operand result(Ops tf); + + /** + * Gets the current result of the metric using the metric's {@link #getTF()} + * + * @return the result, possibly with control dependencies + */ + public Operand result() { + return result(this.tf); + } + + /** + * Calls update state once, followed by a call to get the result + * + * @param values the inputs to be passed to update state, this may not be null + * @param sampleWeights sample weights to be applied to values, may be null. + * @return the result, possibly with control dependencies + */ + public final Operand callOnce( + Operand values, Operand sampleWeights) { + List controlOps = updateStateList(values, sampleWeights); + Ops ltf = tf.withSubScope("callOnce").withControlDependencies(controlOps); + return result(ltf); + } + + /** + * Adds a variable to collect metric values + * + * @param variable the variable + * @param initializer the initializer for the variable, if null, then the default for floating + * point types is {@link org.tensorflow.framework.initializers.Glorot} with distribution + * {@link org.tensorflow.framework.initializers.VarianceScaling.Distribution#UNIFORM}, for + * other types the default initializer is {@link org.tensorflow.framework.initializers.Zeros} + */ + protected void addVariable( + String varName, Variable variable, Initializer initializer) { + // TODO option 2 would be to keep track of tf.scope().env() and if it changes, clear to old Map. + Map> variables = + variableMap.computeIfAbsent(tf.scope().env(), k -> new HashMap<>()); + variables.put(varName, new MetricVariable<>(tf, variable, initializer, seed)); + } + + /** + * Gets the list of added variables + * + * @return the list of added variables + */ + public List> getVariables() { + List> result = new ArrayList<>(); + Map> variables = variableMap.get(tf.scope().env()); + if (variables != null) variables.values().forEach(mv -> result.add(mv.getVariable())); + return result; + } + + /** + * Gets a formatted name for a variable, in the form {@link #name} + "_" + varName. + * + * @param varName the base name for the variable + * @return the formatted variable name + */ + protected String getVariableName(String varName) { + return String.format("%s_%s", this.name, varName); + } + + /** + * Gets an Operation that initializes the variables. + * + * @param subScopeName the sub scope name + * @return the Operation used to initialize the variables. + */ + public Op initialize(String subScopeName) { + + List initializeOperations = initializeVarsList(subScopeName); + return tf.withControlDependencies(initializeOperations).noOp(); + } + + /** + * Gets the list of Operations that initializes the variables + * + * @param subScopeName the sub scope name + * @return the list of Operations that initializes the variables + */ + @SuppressWarnings("unchecked") + private List initializeVarsList(String subScopeName) { + Map> variables = variableMap.get(tf.scope().env()); + if (variables != null) + return variables.values().stream() + .map(metricVariable -> variableAssign(subScopeName, metricVariable)) + .collect(Collectors.toList()); + else return Collections.EMPTY_LIST; + } + + /** + * Resets all variables to their initial state + * + * @return An Operation that sets all variables to their initial state + */ + public Op resetStates() { + return initialize("resetStates"); + } + + /** + * Assigns a value to a Variable + * + *

This assumes the variable has already been initialized + * + * @param subScopeName the subscope for creating the variable + * @param mv the metric value used to assign the initializer to the variable. + * @return the variable add operation with necessary control dependencies + */ + private Operand variableAssign( + String subScopeName, MetricVariable mv) { + return tf.withSubScope(subScopeName).assign(mv.getVariable(), mv.initialize()); + } + + /** + * Gets a stored variable by name, Variables are cached first by the TensorFlow Environment, then + * by a variable name. + * + * @param varName the name assigned to the variable + * @return the variable, or null if the variable is not found. + */ + public Variable getVariable(String varName) { + Map> variables = variableMap.get(tf.scope().env()); + if (variables == null) return null; + MetricVariable mv = variables.get(varName); + return mv != null ? mv.getVariable() : null; + } + + /** + * Gets the TensorFlow Ops + * + * @return the TensorFlow Ops + */ + public Ops getTF() { + return tf; + } + + /** + * Gets the name of this metric. + * + * @return the name of this metric + */ + public String getName() { + return name; + } + + public Class getType() { + return type; + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MetricReduction.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MetricReduction.java new file mode 100644 index 00000000000..d837ff626b3 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MetricReduction.java @@ -0,0 +1,26 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +/** Defines the different types of metric reductions */ +public enum MetricReduction { + + /** Scalar sum of weighted values. */ + SUM, + /** Scalar sum of weighted values divided by number of elements. */ + SUM_OVER_BATCH_SIZE, + /** Scalar sum of weighted values divided by sum of weights. */ + WEIGHTED_MEAN +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java new file mode 100644 index 00000000000..f4282bfd0a9 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -0,0 +1,192 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.CastHelper; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.ReduceSum; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; + +/** Built-in metrics functions. */ +public class Metrics { + + public static final float L2_NORM_EPSILON = 1e-12f; + + /** + * Computes how often targets are in the top K predictions. + * + *

Standalone usage: + * + *

+   *     Operand<TInt32> labels = tf.constant(new int[][]
+   *                                    {{0, 0, 1}, {0, 1, 0}});
+   *     Operand<TFloat32> predictions = tf.constant(new float[][]
+   *                                    {{0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f}});
+   *     Operand<TFloat32> m = Metrics.topKCategoricalAccuracy(
+   *                                    labels, predictions, 3)
+   *     //m.asOutput().shape().toString == "[2]"
+   * 
+ * + * @param tf the TensorFlow Ops. + * @param labels the ground truth values. + * @param predictions The prediction values. + * @param k Number of top elements to look at for computing accuracy. + * @param the data type for the predictions and results + * @param the data type ofr the labels. + * @return the Operand for the Top K categorical accuracy value. + */ + public static Operand topKCategoricalAccuracy( + Ops tf, Operand labels, Operand predictions, long k) { + Operand fPredictions = CastHelper.cast(tf, predictions, TFloat32.class); + return CastHelper.cast( + tf, + tf.nn.inTopK(fPredictions, tf.math.argMax(labels, tf.constant(-1)), tf.constant(k)), + predictions.type()); + } + + /** + * Computes how often integer targets are in the top K predictions. + * + *

Standalone usage: + * + *

+   *     Operand<TInt32> labels = tf.constant(new int[]{2, 1});
+   *     Operand<TFloat32> predictions = tf.constant(new float[][]
+   *                            {{0.1f, 0.9f, 0.f8}, {0.05f, 0.95f, 0f}});
+   *     Operand<TFloat32> m = Metrics.topKCategoricalAccuracy(
+   *                                    labels, predictions, 3)
+   *     //m.asOutput().shape().toString == "[2]"
+   * 
+ * + * @param tf the TensorFlow Ops. + * @param labels the ground truth values. + * @param predictions The prediction values. + * @param k Number of top elements to look at for computing accuracy. + * @param the data type for the predictions and results + * @param the data type ofr the labels. + * @return the Operand for the Sparse top K categorical accuracy value. + */ + @SuppressWarnings("unchecked") + public static Operand sparseTopKCategoricalAccuracy( + Ops tf, Operand labels, Operand predictions, int k) { + Operand tLabels; + if (labels.type() != predictions.type()) + tLabels = CastHelper.cast(tf, labels, predictions.type()); + else tLabels = (Operand) labels; + + int predictionsRank = predictions.asOutput().shape().numDimensions(); + int labelsRank = tLabels.asOutput().shape().numDimensions(); + + Operand castPredictions = CastHelper.cast(tf, predictions, TFloat32.class); + if (predictionsRank != Shape.UNKNOWN_SIZE && labelsRank != Shape.UNKNOWN_SIZE) { + if (predictionsRank > 2) { + castPredictions = tf.shape.reduceDims(castPredictions, tf.constant(1)); + } + if (labelsRank > 1) { + tLabels = tf.shape.flatten(tLabels); + } + } + return CastHelper.cast( + tf, + tf.nn.inTopK(castPredictions, CastHelper.cast(tf, tLabels, TInt32.class), tf.constant(k)), + predictions.type()); + } + + /** + * Computes the cosine similarity between labels and predictions. + * + * @param tf the TensorFlow Ops + * @param labels The ground truth values. + * @param predictions The prediction values. + * @param axis The dimension along which the cosine similarity is computed. + * @param the data type for the labels + * @param the data type for the predictions and result + * @return Cosine similarity value. + */ + @SuppressWarnings("unchecked") + public static Operand cosineProximity( + Ops tf, Operand labels, Operand predictions, int[] axis) { + Operand labelsNorm; + if (labels.type() != predictions.type()) + labelsNorm = CastHelper.cast(tf, labels, predictions.type()); + else labelsNorm = (Operand) labels; + labelsNorm = l2Normalize(tf, labelsNorm, axis); + + Operand predictionsNorm = l2Normalize(tf, predictions, axis); + Operand mathMul = tf.math.mul(labelsNorm, predictionsNorm); + return tf.reduceSum(mathMul, tf.constant(axis), ReduceSum.keepDims(Boolean.FALSE)); + } + + /** + * Normalizes along dimension axis using an L2 norm with an epsilon of {@link + * #L2_NORM_EPSILON}. + * + *

For a 1-D tensor with axis = 0, computes + * + *

+   *       output = x / sqrt(max(sum(x**2), epsilon))
+   * 
+ * + *

For x with more dimensions, independently normalizes each 1-D slice along + * dimension axis. + * + * @param tf The TensorFlow ops + * @param x The operand to normalize + * @param axes Dimension(s) along which to normalize. + * @param The data type for x. + * @return the normalized values of x. + */ + // TODO this was tf.math.l2_normalize in TF Python + + public static Operand l2Normalize(Ops tf, Operand x, int[] axes) { + return l2Normalize(tf, x, axes, L2_NORM_EPSILON); + } + + /** + * Normalizes along dimension axis using an L2 norm. + * + *

For a 1-D tensor with axis = 0, computes + * + *

+   *       output = x / sqrt(max(sum(x**2), epsilon))
+   * 
+ * + *

For x with more dimensions, independently normalizes each 1-D slice along + * dimension axis. + * + * @param tf The TensorFlow ops + * @param x The operand to normalize + * @param axes Dimension(s) along which to normalize. + * @param epsilon A lower bound value for the norm. Will use `sqrt(epsilon)` as the divisor if + * `norm < sqrt(epsilon)`. + * @param The data type for the values. + * @return the normalized values of x. + */ + // TODO this was tf.math.l2_normalize in TF Python + public static Operand l2Normalize( + Ops tf, Operand x, int[] axes, float epsilon) { + Operand squareSum = + tf.reduceSum(tf.math.square(x), tf.constant(axes), ReduceSum.keepDims(Boolean.TRUE)); + Operand y = + tf.math.rsqrt( + tf.math.maximum( + squareSum, CastHelper.cast(tf, tf.constant(epsilon), x.type()))); + return tf.math.mul(x, y); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java new file mode 100644 index 00000000000..f5730b07f42 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the poisson loss metric between labels and predictions. */ +public class Poisson extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a Poisson metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public Poisson(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.poisson(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java new file mode 100644 index 00000000000..403e11af8c0 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java @@ -0,0 +1,54 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the sparse categorical cross-entropy loss between true labels and predicted labels. */ +public class SparseCategoricalCrossentropy + extends MeanMetricWrapper implements LossInterface { + + private final boolean fromLogits; + private final int axes; + + /** + * Creates a SparseCategoricalCrossentropy metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param axes The dimension along which the entropy is computed. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public SparseCategoricalCrossentropy( + Ops tf, String name, boolean fromLogits, int axes, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + this.fromLogits = fromLogits; + this.axes = axes; + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.sparseCategoricalCrossentropy(getTF(), labels, predictions, fromLogits, axes); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java new file mode 100644 index 00000000000..1412465bd89 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java @@ -0,0 +1,65 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the poisson loss metric between labels and predictions. */ +public class SparseTopKCategoricalAccuracy + extends MeanMetricWrapper implements LossInterface { + public static final int DEFAULT_K = 5; + /** Number of top elements to look at for computing accuracy. */ + private final int k; + + /** + * Creates a TopKCategoricalAccuracy metric using {@link #DEFAULT_K} for k, Number of + * top elements to look at for computing accuracy. + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + * @param type the date type for the result + */ + public SparseTopKCategoricalAccuracy(Ops tf, String name, long seed, Class type) { + this(tf, name, DEFAULT_K, seed, type); + } + + /** + * Creates a TopKCategoricalAccuracy metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param k Number of top elements to look at for computing accuracy. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + * @param type the date type for the result + */ + public SparseTopKCategoricalAccuracy(Ops tf, String name, int k, long seed, Class type) { + super(tf, name, seed, type); + this.k = k; + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Metrics.sparseTopKCategoricalAccuracy(getTF(), labels, predictions, k); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java new file mode 100644 index 00000000000..7ce8091f2a0 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java @@ -0,0 +1,46 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.losses.Losses; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the squared hinge loss metric between labels and predictions. */ +public class SquaredHinge extends MeanMetricWrapper + implements LossInterface { + + /** + * Creates a SquaredHinge metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public SquaredHinge(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Losses.squaredHinge(getTF(), labels, predictions); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java new file mode 100644 index 00000000000..3198ab0ee04 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java @@ -0,0 +1,63 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.tensorflow.Operand; +import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +/** Computes the poisson loss metric between labels and predictions. */ +public class TopKCategoricalAccuracy + extends MeanMetricWrapper implements LossInterface { + public static final int DEFAULT_K = 5; + /** Number of top elements to look at for computing accuracy. */ + private final int k; + + /** + * Creates a TopKCategoricalAccuracy metric using {@link #DEFAULT_K} for k, Number of + * top elements to look at for computing accuracy. + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public TopKCategoricalAccuracy(Ops tf, String name, long seed, Class type) { + this(tf, name, DEFAULT_K, seed, type); + } + + /** + * Creates a TopKCategoricalAccuracy metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param k Number of top elements to look at for computing accuracy. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public TopKCategoricalAccuracy(Ops tf, String name, int k, long seed, Class type) { + super(tf, name, seed, type); + this.k = k; + setLoss(this); + } + + /** {@inheritDoc} */ + @Override + public Operand call(Operand labels, Operand predictions) { + return Metrics.topKCategoricalAccuracy(getTF(), labels, predictions, k); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java new file mode 100644 index 00000000000..aadc211c3c4 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java @@ -0,0 +1,36 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.tensorflow.Operand; +import org.tensorflow.types.family.TNumber; + +/** + * Interface for Metrics that wrap Loss functions. + * + * @param The data type of the predictions. + */ +public interface LossInterface { + + /** + * Calculates the weighted loss between labels and predictions + * + * @param labels the truth values or labels + * @param predictions the predictions + * @param The data type of the labels. + * @return the loss + */ + Operand call(Operand labels, Operand predictions); +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java new file mode 100644 index 00000000000..5e0023c4dbe --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -0,0 +1,125 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.tensorflow.Operand; +import org.tensorflow.framework.metrics.Mean; +import org.tensorflow.framework.metrics.MetricReduction; +import org.tensorflow.framework.utils.CastHelper; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.types.family.TNumber; + +import java.util.List; + +/** + * Bridges a stateless loss function with the {@link Mean} metric using a reduction of {@link + * MetricReduction#WEIGHTED_MEAN}. + * + *

The loss function calculates the loss between the labels and predictions + * then passes this loss to the {@link Mean} metric to calculate the weighted mean of the + * loss over many iterations or epochs + * + * @param the data type for the loss. + */ +public class MeanMetricWrapper extends Mean { + + /** The loss function interface */ + protected LossInterface loss; + + /** + * Creates a Reducible Metric with a metric reductions of {@link MetricReduction#WEIGHTED_MEAN} + * + * @param tf the TensorFlow Ops + * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + protected MeanMetricWrapper(Ops tf, String name, long seed, Class type) { + super(tf, name, seed, type); + } + + /** + * Gets the loss function. + * + * @return the loss function. + */ + public LossInterface getLoss() { + return loss; + } + + /** + * Sets the Loss function for this wrapper. + * + * @param loss the loss function. + */ + public void setLoss(LossInterface loss) { + this.loss = loss; + } + + /** + * Creates Operations that update the state of the mean metric, by calling the loss function and + * passing the loss to the Mean metric to calculate the weighted mean of the loss over many + * iterations. + * + * @param labels the truth values or labels + * @param predictions the predictions + * @param sampleWeights Optional sampleWeights acts as a coefficient for the loss. If a scalar is + * provided, then the loss is simply scaled by the given value. If sampleWeights is a tensor + * of size [batch_size], then the total loss for each sample of the batch is rescaled by the + * corresponding element in the sampleWeights vector. If the shape of sampleWeights is + * [batch_size, d0, .. dN-1] (or can be broadcasted to this shape), then each loss element of + * predictions is scaled by the corresponding value of sampleWeights. (Note on dN-1: all loss + * functions reduce by 1 dimension, usually axis=-1.) + * @param the datatype of the predictions + * @return a List of control operations that updates the Mean state variables. + */ + public List updateLossStateList( + Operand labels, Operand predictions, Operand sampleWeights) { + if (labels == null || predictions == null) + throw new IllegalArgumentException("missing required inputs for labels and predictions"); + + Class type = predictions.type(); + Operand tPredicitons = CastHelper.cast(getTF(), predictions, getType()); + + Operand losses = loss.call(labels, tPredicitons); + Operand uLossess = CastHelper.cast(getTF(), losses, type); + + return super.updateStateList(uLossess, sampleWeights); + } + + /** + * Creates a Control Operation that updates the state of the mean metric by calculating the loss + * between the labels and predictions and then applying a weighted mean + * metric across the multiple iterations. + * + * @param labels the truth values or labels + * @param predictions the predictions + * @param sampleWeights Optional sampleWeights acts as a coefficient for the loss. If a scalar is + * provided, then the loss is simply scaled by the given value. If sampleWeights is a tensor + * of size [batch_size], then the total loss for each sample of the batch is rescaled by the + * corresponding element in the sampleWeights vector. If the shape of sampleWeights is + * [batch_size, d0, .. dN-1] (or can be broadcasted to this shape), then each loss element of + * predictions is scaled by the corresponding value of sampleWeights. (Note on dN-1: all loss + * functions reduce by 1 dimension, usually axis=-1.) + * @param the datatype of the labels + * @return a NoOp with control dependencies that update the state of the mean metric. + */ + public final Op updateLossState( + Operand labels, Operand predictions, Operand sampleWeights) { + List controlOps = updateLossStateList(labels, predictions, sampleWeights); + return getTF().withSubScope("updateState").withControlDependencies(controlOps).noOp(); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java new file mode 100644 index 00000000000..78d7459697c --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java @@ -0,0 +1,122 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.tensorflow.Operand; +import org.tensorflow.framework.initializers.Glorot; +import org.tensorflow.framework.initializers.Initializer; +import org.tensorflow.framework.initializers.VarianceScaling; +import org.tensorflow.framework.initializers.Zeros; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.family.TFloating; +import org.tensorflow.types.family.TIntegral; +import org.tensorflow.types.family.TNumber; + +/** + * Helper class that holds a metric variable + * + * @param the data type of the variable + */ +// TODO handle distributed variables with VariableAggregation and VariableSynchronization +public class MetricVariable { + private final Variable variable; + private final Initializer initializer; + private final Ops tf; + private boolean initialized; + + /** + * Creates a Metric Variable + * + * @param tf the TensorFlow Ops + * @param variable the variable + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public MetricVariable(Ops tf, Variable variable, long seed) { + this(tf, variable, null, seed); + } + /** + * Creates a Metric Variable + * + * @param tf the TensorFlow Ops + * @param variable the variable + * @param initializer the initializer for the variable, if null, then the default for floating + * point types is {@link org.tensorflow.framework.initializers.Glorot} with distribution + * {@link org.tensorflow.framework.initializers.VarianceScaling.Distribution#UNIFORM}, for + * other types the default initializer is {@link org.tensorflow.framework.initializers.Zeros} + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + @SuppressWarnings("unchecked") + public MetricVariable(Ops tf, Variable variable, Initializer initializer, long seed) { + this.tf = tf; + this.variable = variable; + + Class type = variable.type(); + if (initializer == null) { + if (TFloating.class.isAssignableFrom(type)) { + this.initializer = + (Initializer) new Glorot<>(tf, VarianceScaling.Distribution.UNIFORM, seed); + } else if (TIntegral.class.isAssignableFrom(type)) { + this.initializer = new Zeros<>(tf); + } else { + throw new IllegalArgumentException( + String.format( + "An initializer for variable %s of type %s is required", + variable.toString(), type)); + } + } else { + this.initializer = initializer; + } + } + + /** + * Initializers the variable based on the initializer + * + * @return the initialized variable + */ + public Operand initialize() { + initialized = true; + return initializer.call(tf.constant(variable.asOutput().shape()), variable.type()); + } + + /** + * Gets the variable + * + * @return the variable + */ + public Variable getVariable() { + return variable; + } + + /** + * Gets the initializer + * + * @return the initializer + */ + public Initializer getInitializer() { + return initializer; + } + + /** + * Gets the value of initialized + * + * @return the value of initialized + */ + public boolean isInitialized() { + return initialized; + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java new file mode 100644 index 00000000000..5395cccf4a7 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -0,0 +1,154 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.CastHelper; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.types.TBool; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TNumber; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * These are helper methods for Metrics and will be module private when Java modularity is applied + * to TensorFlow Java. These methods should not be used outside of the metrics packages. + */ +public class MetricsHelper { + private static final String ASSERT_BROADCASTABLE_ERROR_PREFIX = + "weights can not be broadcast to values."; + + /** + * Asserts that the sampleWeight can be broadcast to values + * + * @param tf the TensorFlow Ops + * @param sampleWeights the sample weights. + * @param values the values to which weights are applied. + * @return Operation raising InvalidArgumentError if sampleWeight + * has incorrect shape. no_op if static checks determine + * sampleWeight has correct shape. + * @param the type of Operand + * @throws IllegalArgumentException If static checks determine `weights` has incorrect shape. + */ + @SuppressWarnings("unchecked") + public static Op broadcastWeights( + Ops tf, Operand sampleWeights, Operand values) { + + Operand weightsShape = tf.shape(sampleWeights); + Operand weightsRank = tf.rank(sampleWeights); + Shape weightsShapeStatic = sampleWeights.asOutput().shape(); + int weightsRankStatic = weightsShapeStatic.numDimensions(); + + Operand valuesShape = tf.shape(values); + Operand valuesRank = tf.rank(values); + Shape valuesShapeStatic = values.asOutput().shape(); + int valuesRankStatic = valuesShapeStatic.numDimensions(); + + if (weightsRankStatic != -1 && valuesRankStatic != -1) { + if (weightsRankStatic == 0) { + return tf.withSubScope("static_scalar_check_success") + .withControlDependencies(Collections.EMPTY_LIST) + .noOp(); + } + if (weightsRankStatic != valuesRankStatic) { + throw new IllegalArgumentException( + String.format( + "%s values.rank=%d. weights.rank=%d. values.shape=%s. weights.shape=%s.", + ASSERT_BROADCASTABLE_ERROR_PREFIX, + valuesRankStatic, + weightsRankStatic, + valuesShapeStatic.toString(), + weightsShapeStatic.toString())); + } + + for (int i = 0; i < valuesRankStatic; i++) { + if (valuesShapeStatic.size(i) != weightsShapeStatic.size(i)) { + throw new IllegalArgumentException( + String.format( + "%s Mismatch at dim %d. values.shape=%s weights.shape=%s.", + ASSERT_BROADCASTABLE_ERROR_PREFIX, + i, + valuesShapeStatic.toString(), + weightsShapeStatic.toString())); + } + } + return tf.withSubScope("static_dims_check_success") + .withControlDependencies(Collections.EMPTY_LIST) + .noOp(); + } + // Dynamic checks. + Operand is_scalar = tf.math.equal(weightsRank, tf.constant(0)); + List> data = + Arrays.asList( + tf.constant(ASSERT_BROADCASTABLE_ERROR_PREFIX), + tf.constant("weights.shape="), + weightsShape, + tf.constant("values.shape="), + valuesShape, + tf.constant("is_scalar="), + is_scalar); + + Operand isValidShape = + tf.select( + is_scalar, + is_scalar, + hasValidNonscalarShape(tf, weightsRank, weightsShape, valuesRank, valuesShape)); + + return tf.assertThat(isValidShape, data); + } + + /** + * Gets an operand that tests if the shapes have the same rank and valid dimensions. + * + * @param tf the TensorFlow Ops + * @param weightsRank the operand for the rank of the sample weights + * @param weightsShape the operand for the shape of the sample weights + * @param valuesRank the operand for the rank of the sample weights + * @param valuesShape the operand for the shape of the sample weights + * @param the data type for the operands + * @return a boolean operand to determine if the Shape is scalar or not. + */ + private static Operand hasValidNonscalarShape( + Ops tf, + Operand weightsRank, + Operand weightsShape, + Operand valuesRank, + Operand valuesShape) { + tf = tf.withSubScope("has_valid_nonscalar_shape"); + Operand isSameRank = tf.math.equal(valuesRank, weightsRank); + return tf.select(isSameRank, hasValidDims(tf, weightsShape, valuesShape), isSameRank); + } + + /** + * Gets an operand that tests if the shapes have valid dimensions or not. + * + * @param tf the TensorFlow Ops + * @param weightsShape the operand for the shape of the sample weights + * @param valuesShape the operand for the shape of the sample weights + * @param the data type for the operands + * @return a boolean operand to determine if the shapes have valid dimensions or not. + */ + private static Operand hasValidDims( + Ops tf, Operand weightsShape, Operand valuesShape) { + tf = tf.withSubScope("has_invalid_dims"); + Operand diff = tf.reduceSum(tf.math.sub(weightsShape, valuesShape), tf.constant(0)); + return tf.math.equal(CastHelper.cast(tf, tf.constant(0), diff.type()), diff); + } +} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java new file mode 100644 index 00000000000..d2c8b2dec93 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -0,0 +1,204 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.tensorflow.Operand; +import org.tensorflow.framework.initializers.Zeros; +import org.tensorflow.framework.losses.impl.LossTuple; +import org.tensorflow.framework.losses.impl.LossesHelper; +import org.tensorflow.framework.metrics.Metric; +import org.tensorflow.framework.metrics.MetricReduction; +import org.tensorflow.framework.utils.CastHelper; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.family.TNumber; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Encapsulates metrics that perform a reduce operation on the metric values. + * + * @param The data type for the metric values + */ +public abstract class Reduce extends Metric { + public static final String TOTAL = "total"; + public static final String COUNT = "count"; + protected final MetricReduction reduction; + private final String totalName; + private final String countName; + /** the variable that holds the total of the metric values */ + protected Variable total; + /** the variable that holds the count of the metric values */ + protected Variable count; + + protected boolean initialized; + + /** + * Creates a Reducible Metric with a metric reductions of {@link MetricReduction#SUM} + * + * @param tf the TensorFlow Ops + * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + protected Reduce(Ops tf, String name, long seed, Class type) { + this(tf, name, seed, MetricReduction.SUM, type); + } + + /** + * @param tf The TensorFlow Ops + * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + * @param reduction The type of metric reduction to apply + */ + protected Reduce(Ops tf, String name, long seed, MetricReduction reduction, Class type) { + super(tf, name, seed, type); + this.reduction = reduction; + this.totalName = this.getVariableName(TOTAL); + this.countName = this.getVariableName(COUNT); + setupVars(); + } + /** initialize the Variables */ + @SuppressWarnings("unchecked") + private void setupVars() { + Zeros fZeros = new Zeros<>(getTF()); + total = (Variable) getVariable(totalName); + if (total == null) { + total = getTF().withSubScope(totalName).variable(Shape.scalar(), getType()); + addVariable(totalName, total, fZeros); + } + if (reduction == MetricReduction.SUM_OVER_BATCH_SIZE + || reduction == MetricReduction.WEIGHTED_MEAN) { + count = (Variable) getVariable(countName); + if (count == null) { + count = getTF().withSubScope(countName).variable(Shape.scalar(), getType()); + addVariable(countName, count, fZeros); + } + } + } + + /** + * Updates the metric variables based on the inputs. At least one input arg required for + * values, an optional additional input for the sampleWeights + * + * @param values the inputs to be passed to update state, this may not be null + * @param sampleWeights sample weights to be applied to values, may be null. + * @return the result with a control dependency on update state Operands + * @throws IllegalArgumentException if values is null + */ + @Override + public List updateStateList(Operand values, Operand sampleWeights) { + + if (values == null) throw new IllegalArgumentException("values is required."); + List updateOperations = new ArrayList<>(); + // cast everything to match the variables + + Operand tValues = CastHelper.cast(getTF(), values, getType()); + Operand tSampleWeights = sampleWeights; + if (sampleWeights != null) { + LossTuple tuple = + LossesHelper.squeezeOrExpandDimensions(getTF(), null, tValues, sampleWeights); + tValues = tuple.getTarget(); + tSampleWeights = tuple.getSampleWeights(); + Op broadcastWeightsCheck = MetricsHelper.broadcastWeights(getTF(), tSampleWeights, tValues); + tValues = + getTF() + .withSubScope("broadcastWeightsCheck") + .withControlDependencies(Collections.singletonList(broadcastWeightsCheck)) + .math + .mul(tValues, tSampleWeights); + } + + Operand valueSum = getTF().reduceSum(tValues, LossesHelper.allAxes(getTF(), tValues)); + Operand totalUpdate = + getTF().assignAdd(total, CastHelper.cast(getTF(), valueSum, total.type())); + updateOperations.add(totalUpdate); + Operand numValues; + if (reduction != MetricReduction.SUM) { + switch (reduction) { + case SUM_OVER_BATCH_SIZE: + numValues = + CastHelper.cast( + getTF(), getTF().constant(tValues.asOutput().shape().size()), getType()); + break; + case WEIGHTED_MEAN: + if (tSampleWeights == null) { + numValues = + CastHelper.cast( + getTF(), getTF().constant(tValues.asOutput().shape().size()), getType()); + } else { + numValues = + CastHelper.cast( + getTF(), + getTF() + .reduceSum(tSampleWeights, LossesHelper.allAxes(getTF(), tSampleWeights)), + getType()); + } + break; + default: + throw new UnsupportedOperationException( + String.format("reduction [%s] not implemented", reduction)); + } + Operand totalCount = getTF().assignAdd(this.count, numValues); + + updateOperations.add(totalCount); + } + + return updateOperations; + } + + /** {@inheritDoc} */ + @Override + public Operand result(Ops rtf) { + Operand fResult; + + switch (this.reduction) { + case SUM: + fResult = rtf.identity(total); + break; + case WEIGHTED_MEAN: + case SUM_OVER_BATCH_SIZE: + fResult = rtf.math.divNoNan(total, CastHelper.cast(rtf, count, getType())); + break; + default: + throw new UnsupportedOperationException( + String.format("reduction [%s] not implemented", reduction)); + } + return fResult; + } + + /** + * Gets the total variable + * + * @return the total variable + */ + public Variable getTotal() { + return total; + } + + /** + * Gets the count variable + * + * @return the count variable + */ + public Variable getCount() { + return count; + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java new file mode 100644 index 00000000000..1f07b9567cb --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java @@ -0,0 +1,150 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; + +class BinaryCrossentropyTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + BinaryCrossentropy instance = + new BinaryCrossentropy<>(tf, "BCE_testUnweighted", false, 0, 1001L, TFloat64.class); + session.run(instance.resetStates()); + float[] trueArray = {1, 0, 1, 0}; + float[] predictionArray = {1, 1, 1, 0}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 2))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(2, 2))); + Op op = instance.updateState(labels, yPrediction, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(7.666619F, total); + session.evaluate(2, count); + session.evaluate(3.833309F, result); + } + } + + @Test + public void testUnweightedLogits() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + BinaryCrossentropy instance = + new BinaryCrossentropy<>(tf, "BCE_testUnweightedLogits", true, 0, 1001L, TFloat64.class); + session.run(instance.resetStates()); + double[] trueArray = {1, 0, 1, 0, 1, 1}; + double[] logitsArray = {100.0, -100.0, 100.0, 100.0, 100.0, -100.0}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand logits = tf.reshape(tf.constant(logitsArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, logits, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(66.66667, total); + session.evaluate(2, count); + session.evaluate(33.333332, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + BinaryCrossentropy instance = + new BinaryCrossentropy<>(tf, "BCE_testWeighted", false, 0, 1001L, TFloat32.class); + session.run(instance.resetStates()); + float[] trueArray = {1, 0, 1, 0}; + float[] predictionArray = {1, 1, 1, 0}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 2))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(2, 2))); + Operand sampleWeight = tf.constant(new float[] {1.5f, 2.f}); + Op op = instance.updateState(labels, yPrediction, sampleWeight); + session.run(op); + + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(11.499929f, total); + session.evaluate(3.5f, count); + session.evaluate(3.285694f, result); + } + } + + @Test + public void testWeightedLogits() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + BinaryCrossentropy instance = + new BinaryCrossentropy<>(tf, "BCE_testWeightedLogits", true, 0, 1001L, TFloat64.class); + session.run(instance.resetStates()); + double[] trueArray = {1, 0, 1, 0, 1, 1}; + double[] logitsArray = {100.0, -100.0, 100.0, 100.0, 100.0, -100.0}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand logits = tf.reshape(tf.constant(logitsArray), tf.constant(Shape.of(2, 3))); + Operand sampleWeight = tf.constant(new double[] {2, 2.5}); + + Op op = instance.updateState(labels, logits, sampleWeight); + session.run(op); + + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(166.66666, total); + session.evaluate(4.5, count); + session.evaluate(37.037033, result); + } + } + + @Test + public void testLabelSmoothing() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + float labelSmoothing = 0.1F; + BinaryCrossentropy instance = + new BinaryCrossentropy<>( + tf, "BCE_testWeightedLabS", true, labelSmoothing, 1001L, TFloat64.class); + session.run(instance.resetStates()); + double[] trueArray = {1, 0, 1}; + double[] logitsArray = {100., -100., -100.}; + Operand labels = tf.constant(trueArray); + Operand logits = tf.constant(logitsArray); + + Op op = instance.updateState(labels, logits, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + + session.evaluate(35, total); + session.evaluate(1, count); + session.evaluate(35, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalCrossentropyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalCrossentropyTest.java new file mode 100644 index 00000000000..2b4a1d75467 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalCrossentropyTest.java @@ -0,0 +1,151 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class CategoricalCrossentropyTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CategoricalCrossentropy instance = + new CategoricalCrossentropy<>( + tf, "CCE_testUnweighted", false, 0, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {0, 1, 0, 0, 0, 1}; + double[] predArray = {0.05, 0.95, 0, 0.1, 0.8, 0.1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(2.3538785, total); + session.evaluate(2, count); + session.evaluate(1.1769392, result); + } + } + + @Test + public void testUnweightedLogits() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CategoricalCrossentropy instance = + new CategoricalCrossentropy<>( + tf, "CCE_testUnweightedLogits", true, 0, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {0, 1, 0, 0, 0, 1}; + double[] predArray = {1, 9, 0, 1, 8, 1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(7.0022807, total); + session.evaluate(2, count); + session.evaluate(3.5011404, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CategoricalCrossentropy instance = + new CategoricalCrossentropy<>( + tf, "CCE_testWeighted", false, 0, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {0, 1, 0, 0, 0, 1}; + double[] predArray = {0.05f, 0.95f, 0f, 0.1f, 0.8f, 0.1f}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Operand sampleWeight = tf.constant(new double[] {1.5f, 2.}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(4.6821095, total); + session.evaluate(3.5, count); + session.evaluate(1.3377455, result); + } + } + + @Test + public void testWeightedLogits() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CategoricalCrossentropy instance = + new CategoricalCrossentropy<>(tf, "CCE_testWeighted", true, 0, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {0, 1, 0, 0, 0, 1}; + double[] predArray = {1, 9, 0, 1, 8, 1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Operand sampleWeight = tf.constant(new double[] {1.5, 2.f}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(14.004333, total); + session.evaluate(3.5, count); + session.evaluate(4.0012328, result); + } + } + + @Test + public void testLabelSmoothing() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + float labelSmoothing = 0.1F; + CategoricalCrossentropy instance = + new CategoricalCrossentropy<>( + tf, "CCE_testWeighted", true, labelSmoothing, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {0, 1, 0, 0, 0, 1}; + double[] predArray = {1, 9, 0, 1, 8, 1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(7.3356137, total); + session.evaluate(2, count); + session.evaluate(3.6678069, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalHingeTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalHingeTest.java new file mode 100644 index 00000000000..87248d95e48 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CategoricalHingeTest.java @@ -0,0 +1,97 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class CategoricalHingeTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CategoricalHinge instance = + new CategoricalHinge<>(tf, "CH_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + double[] predArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(4, 5))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(2., total); + session.evaluate(4, count); + session.evaluate(0.5, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CategoricalHinge instance = + new CategoricalHinge<>(tf, "CH_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + double[] predArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(4, 5))); + + Operand sampleWeight = tf.constant(new double[] {1., 1.5, 2., 2.5}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(3.5F, total); + session.evaluate(7, count); + session.evaluate(0.5, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java new file mode 100644 index 00000000000..848e2051af3 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java @@ -0,0 +1,101 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TInt32; + +class CosineSimilarityTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CosineSimilarity instance = + new CosineSimilarity<>(tf, "CS_testUnweighted", 1001L, TFloat32.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 9, 2, -5, -2, 6}; + float[] predArray = {4, 8, 12, 8, 1, 3}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(0.3744381F, total); + session.evaluate(2, count); + session.evaluate(0.18721905F, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + CosineSimilarity instance = + new CosineSimilarity<>(tf, "CS_testWeighted", 1001L, TFloat32.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 9, 2, -5, -2, 6}; + float[] predArray = {4, 8, 12, 8, 1, 3}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + + Operand sampleWeight = tf.constant(new float[] {1.2f, 3.4f}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(-0.3119840621948241F, total); + session.evaluate(4.6, count); + session.evaluate(-0.06782262221626612F, result); + } + } + + @Test + public void test_axis() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + int[] axis = new int[] {1}; + CosineSimilarity instance = + new CosineSimilarity<>(tf, "CS_testWeighted", axis, 1001L, TFloat32.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 9, 2, -5, -2, 6}; + float[] predArray = {4, 8, 12, 8, 1, 3}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(0.3744381F, total); + session.evaluate(2, count); + session.evaluate(0.18721905F, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/HingeTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/HingeTest.java new file mode 100644 index 00000000000..6af5fed4889 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/HingeTest.java @@ -0,0 +1,84 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class HingeTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Hinge instance = + new Hinge<>(tf, "Hinge_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {0, 1, 0, 1, 0, 0, 1, 1}; + double[] predArray = {-0.3, 0.2, -0.1, 1.6, -0.25, -1., 0.5, 0.6}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 4))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 4))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(1.0125, total); + session.evaluate(2, count); + session.evaluate(.5062500, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Hinge instance = + new Hinge<>(tf, "Hinge_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = { + -1, 1, -1, 1, + -1, -1, 1, 1 + }; + float[] predArray = { + -0.3f, 0.2f, -0.1f, 1.6f, + -0.25f, -1.f, 0.5f, 0.6f + }; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 4))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 4))); + + Operand sampleWeight = tf.constant(new double[] {1.5, 2.}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(1.7250f, total); + session.evaluate(3.5, count); + session.evaluate(.49285714f, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java new file mode 100644 index 00000000000..bf98ec4eba4 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java @@ -0,0 +1,83 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; + +class KLDivergenceTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + KLDivergence instance = + new KLDivergence<>(tf, "KLD_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + float[][] trueArray = {{.5f, .8f, .12f}, {.7f, .43f, .8f}}; + float[][] predArray = {{.4f, .9f, .12f}, {.36f, .3f, .4f}}; + Operand labels = tf.constant(trueArray); + Operand predictions = tf.constant(predArray); + + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(1.1921477, total); + session.evaluate(2, count); + session.evaluate(0.5960738, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + KLDivergence instance = + new KLDivergence<>(tf, "KLD_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + float[] trueArray = { + .5f, .8f, .12f, + .7f, .43f, .8f + }; + float[] predArray = { + .4f, .9f, .12f, + .36f, .3f, .4f + }; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + + Operand sampleWeight = tf.constant(new double[] {1.2, 3.4}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(4.015142, total); + session.evaluate(4.6, count); + session.evaluate(0.872857, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/LogCoshErrorTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/LogCoshErrorTest.java new file mode 100644 index 00000000000..31c043e0473 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/LogCoshErrorTest.java @@ -0,0 +1,80 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class LogCoshErrorTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + LogCoshError instance = + new LogCoshError<>(tf, "LogCosh_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + float[] trueArray = {1, 9, 2, -5, -2, 6}; + float[] predArray = {4, 8, 12, 8, 1, 3}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(4.829245, result); + session.evaluate(9.65849, total); + session.evaluate(2, count); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + LogCoshError instance = + new LogCoshError<>(tf, "LogCosh_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 9, 2, -5, -2, 6}; + float[] predArray = {4, 8, 12, 8, 1, 3}; + double[][] sampleArray = {{1.2}, {3.4}}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Operand sampleWeight = tf.constant(sampleArray); + + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(5.2178759, result); + session.evaluate(24.002228, total); + session.evaluate(4.6, count); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsoluteErrorTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsoluteErrorTest.java new file mode 100644 index 00000000000..73241ecbe9f --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsoluteErrorTest.java @@ -0,0 +1,116 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class MeanAbsoluteErrorTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + MeanAbsoluteError instance = + new MeanAbsoluteError<>(tf, "MAE_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + session.evaluate(0.0f, instance.getTotal()); + session.evaluate(0f, instance.getCount()); + session.evaluate(0.f, instance.getCount()); + + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + float[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + Op op = instance.updateState(yTrue, yPrediction, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(2.0, total); + session.evaluate(4, count); + session.evaluate(0.5, result); + + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0., instance.getCount()); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + MeanAbsoluteError instance = + new MeanAbsoluteError<>(tf, "MAE_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0., instance.getCount()); + + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + double[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + + Operand sampleWeight = tf.constant(new double[] {1., 1.5, 2., 2.5}); + Op op = instance.updateState(yTrue, yPrediction, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(3.8, total); + session.evaluate(7, count); + session.evaluate(0.54285, result); + + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0., instance.getCount()); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageErrorTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageErrorTest.java new file mode 100644 index 00000000000..4c92844b217 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageErrorTest.java @@ -0,0 +1,115 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; + +class MeanAbsolutePercentageErrorTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + session.setEpsilon(1E-6f); + Ops tf = session.getTF(); + MeanAbsolutePercentageError instance = + new MeanAbsolutePercentageError<>(tf, "MAPE_testUnweighted", 1001L, TFloat32.class); + session.run(instance.resetStates()); + session.evaluate(0.0f, instance.getTotal()); + session.evaluate(0f, instance.getCount()); + session.evaluate(0.f, instance.getCount()); + + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + float[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + + Op op = instance.updateState(yTrue, yPrediction, null); + + session.run(op); + + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(1.4E9f, total); + session.evaluate(4f, count); + session.evaluate(35e7f, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + session.setEpsilon(1E-6f); + Ops tf = session.getTF(); + MeanAbsolutePercentageError instance = + new MeanAbsolutePercentageError<>(tf, "MAPE_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0, instance.getCount()); + + long[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + double[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + + Operand sampleWeight = tf.constant(new double[] {1.f, 1.5f, 2.f, 2.5f}); + Op op = instance.updateState(yTrue, yPrediction, sampleWeight); + + session.run(op); + + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(2.800000067278928E9, total); + session.evaluate(7, count); + session.evaluate(4.000000096112754E8, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredErrorTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredErrorTest.java new file mode 100644 index 00000000000..0b760213015 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredErrorTest.java @@ -0,0 +1,107 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; + +class MeanSquaredErrorTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + MeanSquaredError instance = + new MeanSquaredError<>(tf, "MSE_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0., instance.getCount()); + + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + float[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + Op op = instance.updateState(yTrue, yPrediction, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(2.0, total); + session.evaluate(4, count); + session.evaluate(0.5, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + MeanSquaredError instance = + new MeanSquaredError<>(tf, "MSE_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0., instance.getCount()); + + long[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + float[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + + Operand sampleWeight = tf.constant(new double[] {1., 1.5, 2., 2.5}); + Op op = instance.updateState(yTrue, yPrediction, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(3.8, total); + session.evaluate(7, count); + session.evaluate(0.542857, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicErrorTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicErrorTest.java new file mode 100644 index 00000000000..098a5cb9725 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicErrorTest.java @@ -0,0 +1,106 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class MeanSquaredLogarithmicErrorTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + MeanSquaredLogarithmicError instance = + new MeanSquaredLogarithmicError<>(tf, "MSLE_testUnweighted", 1001L, TFloat32.class); + session.run(instance.resetStates()); + session.evaluate(0.0f, instance.getTotal()); + session.evaluate(0f, instance.getCount()); + session.evaluate(0.f, instance.getCount()); + + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + float[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + Op op = instance.updateState(yTrue, yPrediction, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(0.96090573f, total); + session.evaluate(4f, count); + session.evaluate(0.24022f, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + MeanSquaredLogarithmicError instance = + new MeanSquaredLogarithmicError<>(tf, "MSLE_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + session.evaluate(0.0, instance.getTotal()); + session.evaluate(0, instance.getCount()); + session.evaluate(0., instance.getCount()); + + int[] trueArray = { + 0, 1, 0, 1, 0, + 0, 0, 1, 1, 1, + 1, 1, 1, 1, 0, + 0, 0, 0, 0, 1 + }; + double[] predictionArray = { + 0, 0, 1, 1, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1 + }; + Operand yTrue = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(4, 5))); + Operand yPrediction = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(4, 5))); + + Operand sampleWeight = tf.constant(new double[] {1., 1.5, 2., 2.5}); + Op op = instance.updateState(yTrue, yPrediction, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(1.8257208, total); + session.evaluate(7, count); + session.evaluate(0.26082, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/PoissonTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/PoissonTest.java new file mode 100644 index 00000000000..cf3c3e44719 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/PoissonTest.java @@ -0,0 +1,79 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class PoissonTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Poisson instance = + new Poisson<>(tf, "Poisson_testUnweighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {4, 8, 12, 8, 1, 3}; + float[] predArray = {1, 9, 2, 5, 2, 6}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(-6.6131644, total); + session.evaluate(2, count); + session.evaluate(-3.3065822, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Poisson instance = + new Poisson<>(tf, "Poisson_testWeighted", 1001L, TFloat32.class); + session.run(instance.resetStates()); + int[] trueArray = {4, 8, 12, 8, 1, 3}; + float[] predArray = {1, 9, 2, 5, 2, 6}; + + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); + + Operand sampleWeight = tf.constant(new float[] {1.2f, 3.4f}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(-12.29468f, total); + session.evaluate(4.6f, count); + session.evaluate(-2.6727562f, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropyTest.java new file mode 100644 index 00000000000..87af1bd8448 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropyTest.java @@ -0,0 +1,129 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class SparseCategoricalCrossentropyTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SparseCategoricalCrossentropy instance = + new SparseCategoricalCrossentropy<>( + tf, "SCE_testUnweighted", false, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 2}; + double[] predictionArray = {0.05, 0.95, 0, 0.1, 0.8, 0.1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2))); + Operand predictions = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(2.3538785, total); + session.evaluate(2, count); + session.evaluate(1.1769392, result); + } + } + + @Test + public void testUnweightedLogits() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SparseCategoricalCrossentropy instance = + new SparseCategoricalCrossentropy<>( + tf, "SCE_testWeighted", true, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 2}; + double[] logitsArray = {1, 9, 0, 1, 8, 1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2))); + Operand logits = tf.reshape(tf.constant(logitsArray), tf.constant(Shape.of(2, 3))); + Op op = instance.updateState(labels, logits, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(7.002277, total); + session.evaluate(2, count); + session.evaluate(3.501135, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SparseCategoricalCrossentropy instance = + new SparseCategoricalCrossentropy<>( + tf, "SCE_testWeighted", false, -1, 1001L, TFloat32.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 2}; + double[] predictionArray = {0.05, 0.95, 0, 0.1, 0.8, 0.1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2))); + Operand predictions = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(2, 3))); + + Operand sampleWeight = tf.constant(new float[] {1.5F, 2.F}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(4.6821103f, total); + session.evaluate(3.5f, count); + session.evaluate(1.3377458f, result); + } + } + + @Test + public void testWeightedLogits() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SparseCategoricalCrossentropy instance = + new SparseCategoricalCrossentropy<>( + tf, "SCE_testWeighted", true, -1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = {1, 2}; + double[] predictionArray = {1, 9, 0, 1, 8, 1}; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2))); + Operand predictions = + tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(2, 3))); + + Operand sampleWeight = tf.constant(new double[] {1.5, 2}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(14.004333, total); + session.evaluate(3.5, count); + session.evaluate(4.001232, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java new file mode 100644 index 00000000000..4a0cdefe492 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java @@ -0,0 +1,96 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class SparseTopKCategoricalAccuracyTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testCorrectness() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SparseTopKCategoricalAccuracy instance = + new SparseTopKCategoricalAccuracy<>( + tf, "SparseTopK_testCorrectness", 5, 1001L, TFloat64.class); + session.run(instance.resetStates()); + + Operand labels = tf.constant(new double[] {2, 1}); + Operand predictions = + tf.constant(new double[][] {{0.1, 0.9, 0.8}, {0.05, 0.95, 0}}); + + Op update = instance.updateState(labels, predictions, null); + session.run(update); + session.evaluate(1., instance.result()); + + // With `k` < 5. + instance = + new SparseTopKCategoricalAccuracy<>( + tf, "SparseTopK_testCorrectness", 1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + update = instance.updateState(labels, predictions, null); + session.run(update); + session.evaluate(0.5, instance.result()); + + // With `k` > 5. + predictions = + tf.constant( + new double[][] { + {0.5, 0.9, 0.1, 0.7, 0.6, 0.5, 0.4}, + {0.05, 0.95, 0, 0, 0, 0, 0} + }); + instance = + new SparseTopKCategoricalAccuracy<>( + tf, "SparseTopK_testCorrectness", 6, 1001L, TFloat64.class); + session.run(instance.resetStates()); + update = instance.updateState(labels, predictions, null); + session.run(update); + session.evaluate(0.5, instance.result()); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SparseTopKCategoricalAccuracy instance = + new SparseTopKCategoricalAccuracy<>( + tf, "SparseTopK_testWeighted", 5, 1001L, TFloat64.class); + session.run(instance.resetStates()); + + Operand labels = tf.constant(new int[] {1, 0, 2}); + Operand predictions = + tf.constant( + new double[][] { + {0, 0.9, 0.1}, + {0, 0.9, 0.1}, + {0, 0.9, 0.1} + }); + + Operand sampleWeight = tf.constant(new double[] {1, 0, 1}); + + Op update = instance.updateState(labels, predictions, sampleWeight); + session.run(update); + session.evaluate(1., instance.result()); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SquaredHingeTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SquaredHingeTest.java new file mode 100644 index 00000000000..e3376c224f3 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SquaredHingeTest.java @@ -0,0 +1,90 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.op.core.Variable; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; + +class SquaredHingeTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testUnweighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SquaredHinge instance = + new SquaredHinge<>(tf, "SCE_testUnweighted", 1001L, TFloat32.class); + session.run(instance.resetStates()); + int[] trueArray = { + 0, 1, 0, 1, + 0, 0, 1, 1 + }; + float[] predArray = { + -0.3f, 0.2f, -0.1f, 1.6f, + -0.25f, -1.f, 0.5f, 0.6f + }; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 4))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 4))); + Op op = instance.updateState(labels, predictions, null); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(0.72812f, total); + session.evaluate(2f, count); + session.evaluate(0.3640625f, result); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + SquaredHinge instance = + new SquaredHinge<>(tf, "SCE_testWeighted", 1001L, TFloat64.class); + session.run(instance.resetStates()); + int[] trueArray = { + 0, 1, 0, 1, + 0, 0, 1, 1 + }; + double[] predArray = { + -0.3, 0.2, -0.1, 1.6, + -0.25, -1., 0.5, 0.6 + }; + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 4))); + Operand predictions = + tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 4))); + + Operand sampleWeight = tf.constant(new double[] {1.5f, 2.f}); + Op op = instance.updateState(labels, predictions, sampleWeight); + session.run(op); + Variable total = instance.getTotal(); + Variable count = instance.getCount(); + Operand result = instance.result(); + session.evaluate(1.2137499, total); + session.evaluate(3.5, count); + session.evaluate(0.3467857, result); + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java new file mode 100644 index 00000000000..52ccde29196 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java @@ -0,0 +1,103 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; + +class TopKCategoricalAccuracyTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + @Test + public void testCorrectness() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + TopKCategoricalAccuracy instance = + new TopKCategoricalAccuracy<>(tf, "TopK_testUnweighted", 5, 1001L, TFloat64.class); + session.run(instance.resetStates()); + Operand labels = tf.constant(new float[][] {{0, 0, 1}, {0, 1, 0}}); + Operand predictions = + tf.constant(new double[][] {{0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f}}); + + Op update = instance.updateState(labels, predictions, null); + session.run(update); + session.evaluate(1., instance.result()); + + // With `k` < 5. + instance = + new TopKCategoricalAccuracy<>(tf, "TopK_testUnweighted1", 1, 1001L, TFloat64.class); + session.run(instance.resetStates()); + update = instance.updateState(labels, predictions, null); + session.run(update); + session.evaluate(0.5, instance.result()); + + // With `k` > 5. + labels = + tf.constant( + new float[][] { + {0, 0, 1, 0, 0, 0, 0}, + {0, 1, 0, 0, 0, 0, 0} + }); + predictions = + tf.constant( + new double[][] { + {0.5f, 0.9f, 0.1f, 0.7f, 0.6f, 0.5f, 0.4f}, + {0.05f, 0.95f, 0f, 0f, 0f, 0f, 0f} + }); + instance = + new TopKCategoricalAccuracy<>(tf, "TopK_testUnweighted6", 6, 1001L, TFloat64.class); + session.run(instance.resetStates()); + update = instance.updateState(labels, predictions, null); + session.run(update); + session.evaluate(0.5, instance.result()); + } + } + + @Test + public void testWeighted() { + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + TopKCategoricalAccuracy instance = + new TopKCategoricalAccuracy<>(tf, "TopK_testWeighted", 5, 1001L, TFloat64.class); + session.run(instance.resetStates()); + + Operand labels = + tf.constant( + new double[][] { + {1, 0, 2}, + {1, 0, 0}, + {0, 0, 1} + }); + Operand predictions = + tf.constant( + new double[][] { + {0f, 0.9f, 0.1f}, + {0f, 0.9f, 0.1f}, + {0f, 0.9f, 0.1f} + }); + + Operand sampleWeight = tf.constant(new double[] {1, 0, 1}); + + Op update = instance.updateState(labels, predictions, sampleWeight); + session.run(update); + session.evaluate(1., instance.result()); + } + } +} From 092b47dca5345f738e60f41d21779ea5a605339b Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Thu, 31 Dec 2020 20:03:32 -0500 Subject: [PATCH 02/60] Initial checkin and sync with master --- .../framework/metrics/BinaryCrossentropy.java | 2 +- .../metrics/CategoricalCrossentropy.java | 2 +- .../framework/metrics/CosineSimilarity.java | 16 ++- .../tensorflow/framework/metrics/Mean.java | 3 +- .../tensorflow/framework/metrics/Metric.java | 42 ++----- .../tensorflow/framework/metrics/Metrics.java | 19 ++-- .../SparseTopKCategoricalAccuracy.java | 65 ----------- .../metrics/TopKCategoricalAccuracy.java | 63 ----------- .../metrics/impl/MeanMetricWrapper.java | 36 ++---- .../metrics/impl/MetricVariable.java | 13 ++- .../framework/metrics/impl/MetricsHelper.java | 100 +++++++++++++++-- .../framework/metrics/impl/Reduce.java | 88 +++++++++------ .../metrics/BinaryCrossentropyTest.java | 17 +-- .../metrics/CosineSimilarityTest.java | 2 +- .../framework/metrics/KLDivergenceTest.java | 2 +- .../SparseTopKCategoricalAccuracyTest.java | 96 ---------------- .../metrics/TopKCategoricalAccuracyTest.java | 103 ------------------ 17 files changed, 211 insertions(+), 458 deletions(-) delete mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java delete mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java delete mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java delete mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java index d13d20bfdee..41a5533b5d1 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java @@ -28,7 +28,7 @@ * @param The data type for the metric result */ public class BinaryCrossentropy - extends MeanMetricWrapper implements LossInterface { + extends MeanMetricWrapper implements LossInterface { private final boolean fromLogits; private final float labelSmoothing; diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java index cf9ecd0858a..79481f608a1 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java @@ -34,7 +34,7 @@ public class CategoricalCrossentropy private final boolean fromLogits; private final float labelSmoothing; - private int axis; + private final int axis; /** * Creates a CategoricalCrossentropy metric that Computes the crossentropy metric between the diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java index 61802572c7b..4a5214aea8d 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java @@ -27,9 +27,9 @@ // is using the dot product proportional to the product of their magnitudes. // While the 2 concepts are similar, they are different. // Should we rename this metric to CosineProximity? -public class CosineSimilarity extends MeanMetricWrapper +public class CosineSimilarity extends MeanMetricWrapper implements LossInterface { - public static final int[] DEFAULT_AXIS = {-1}; + public static final int DEFAULT_AXIS = -1; private final int[] axis; /** @@ -44,6 +44,18 @@ public CosineSimilarity(Ops tf, String name, long seed, Class type) { this(tf, name, DEFAULT_AXIS, seed, type); } + /** + * Creates a CosineSimilarity metric + * + * @param tf the TensorFlow Ops + * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. + * @param axis The dimension along which the cosine similarity is computed. + * @param seed the seed for random number generation. An initializer created with a given seed + * will always produce the same random tensor for a given shape and data type. + */ + public CosineSimilarity(Ops tf, String name, int axis, long seed, Class type) { + this(tf, name, new int[] {axis}, seed, type); + } /** * Creates a CosineSimilarity metric * diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java index 08d1083dd05..c68a70902a7 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java @@ -33,8 +33,9 @@ public class Mean extends Reduce { * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the result. */ protected Mean(Ops tf, String name, long seed, Class type) { - super(tf, name, seed, MetricReduction.WEIGHTED_MEAN, type); + super(tf, name, MetricReduction.WEIGHTED_MEAN, seed, type); } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 62ec5439269..28a2ae0fa94 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -1,20 +1,3 @@ -/* - * Copyright (c) 2020, Oracle and/or its affiliates. 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. - */ -package org.tensorflow.framework.metrics; - /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +12,7 @@ See the License for the specific language governing permissions and limitations under the License. =======================================================================*/ +package org.tensorflow.framework.metrics; import org.tensorflow.ExecutionEnvironment; import org.tensorflow.Operand; @@ -74,17 +58,15 @@ public abstract class Metric { /** The name for this metric. Defaults to {@link Class#getSimpleName()}. */ private final String name; - private final Class type; - /** - * Creates a Metric with a name of {@link Class#getSimpleName()} } + * Creates a Metric with a name of {@link Class#getSimpleName()} * * @param tf the TensorFlow Ops * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. */ - protected Metric(Ops tf, long seed, Class type) { - this(tf, null, seed, type); + protected Metric(Ops tf, long seed) { + this(tf, null, seed); } /** @@ -95,13 +77,12 @@ protected Metric(Ops tf, long seed, Class type) { * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. */ - protected Metric(Ops tf, String name, long seed, Class type) { + protected Metric(Ops tf, String name, long seed) { if (!tf.scope().env().isGraph()) throw new IllegalArgumentException("Metrics are required to execute in Graph mode."); this.seed = seed; this.name = name != null ? name : this.getClass().getSimpleName(); this.tf = tf.withSubScope(this.name); - this.type = type; } /** @@ -113,8 +94,8 @@ protected Metric(Ops tf, String name, long seed, Class type) { * @param sampleWeights sample weights to be applied to values, may be null. * @return a List of Operations to update the metric state */ - @SuppressWarnings({"unchecked", "unused"}) - public List updateStateList(Operand values, Operand sampleWeights) { + @SuppressWarnings({"unchecked","unused"}) + public List updateStateList(Operand values, Operand sampleWeights) { return Collections.EMPTY_LIST; } @@ -142,7 +123,7 @@ public List updateStateList( * @param sampleWeights sample weights to be applied to values, may be null. * @return the Operation to update the metric state */ - public final Op updateState(Operand values, Operand sampleWeights) { + public final Op updateState(Operand values, Operand sampleWeights) { List controlOps = updateStateList(values, sampleWeights); return tf.withSubScope("updateState").withControlDependencies(controlOps).noOp(); } @@ -153,6 +134,7 @@ public final Op updateState(Operand values, Operand sa * @param labels the labels * @param predictions the predictions * @param sampleWeights sample weights to be applied to values, may be null. + * @param the data type for the sample weights * @return the Operation to update the metric state */ public final Op updateState( @@ -206,7 +188,7 @@ protected void addVariable( // TODO option 2 would be to keep track of tf.scope().env() and if it changes, clear to old Map. Map> variables = variableMap.computeIfAbsent(tf.scope().env(), k -> new HashMap<>()); - variables.put(varName, new MetricVariable<>(tf, variable, initializer, seed)); + variables.put(varName, new MetricVariable<>(tf, variable, initializer, seed, variable.type())); } /** @@ -313,8 +295,4 @@ public Ops getTF() { public String getName() { return name; } - - public Class getType() { - return type; - } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java index f4282bfd0a9..c3c44ef6134 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -40,7 +40,7 @@ public class Metrics { * {{0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f}}); * Operand<TFloat32> m = Metrics.topKCategoricalAccuracy( * labels, predictions, 3) - * //m.asOutput().shape().toString == "[2]" + * //m.shape().toString == "[2]" * * * @param tf the TensorFlow Ops. @@ -71,7 +71,7 @@ public static Operand topKCategoricalA * {{0.1f, 0.9f, 0.f8}, {0.05f, 0.95f, 0f}}); * Operand<TFloat32> m = Metrics.topKCategoricalAccuracy( * labels, predictions, 3) - * //m.asOutput().shape().toString == "[2]" + * //m.shape().toString == "[2]" * * * @param tf the TensorFlow Ops. @@ -90,8 +90,8 @@ public static Operand sparseTopKCatego tLabels = CastHelper.cast(tf, labels, predictions.type()); else tLabels = (Operand) labels; - int predictionsRank = predictions.asOutput().shape().numDimensions(); - int labelsRank = tLabels.asOutput().shape().numDimensions(); + int predictionsRank = predictions.shape().numDimensions(); + int labelsRank = tLabels.shape().numDimensions(); Operand castPredictions = CastHelper.cast(tf, predictions, TFloat32.class); if (predictionsRank != Shape.UNKNOWN_SIZE && labelsRank != Shape.UNKNOWN_SIZE) { @@ -152,9 +152,10 @@ public static Operand cosineProximity( * @param The data type for x. * @return the normalized values of x. */ - // TODO this was tf.math.l2_normalize in TF Python + // TODO this was tf.math.l2_normalize in TF Python, does it belong here? - public static Operand l2Normalize(Ops tf, Operand x, int[] axes) { + public static Operand l2Normalize( + Ops tf, Operand x, int[] axes) { return l2Normalize(tf, x, axes, L2_NORM_EPSILON); } @@ -178,15 +179,15 @@ public static Operand l2Normalize(Ops tf, Operand x, i * @param The data type for the values. * @return the normalized values of x. */ - // TODO this was tf.math.l2_normalize in TF Python + // TODO this was tf.math.l2_normalize in TF Python, does it belong here? public static Operand l2Normalize( Ops tf, Operand x, int[] axes, float epsilon) { Operand squareSum = tf.reduceSum(tf.math.square(x), tf.constant(axes), ReduceSum.keepDims(Boolean.TRUE)); Operand y = tf.math.rsqrt( - tf.math.maximum( - squareSum, CastHelper.cast(tf, tf.constant(epsilon), x.type()))); + tf.math.maximum(squareSum, CastHelper.cast(tf, tf.constant(epsilon), x.type()))); return tf.math.mul(x, y); } + } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java deleted file mode 100644 index 1412465bd89..00000000000 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracy.java +++ /dev/null @@ -1,65 +0,0 @@ -/* 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. -=======================================================================*/ -package org.tensorflow.framework.metrics; - -import org.tensorflow.Operand; -import org.tensorflow.framework.metrics.impl.LossInterface; -import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; -import org.tensorflow.op.Ops; -import org.tensorflow.types.family.TNumber; - -/** Computes the poisson loss metric between labels and predictions. */ -public class SparseTopKCategoricalAccuracy - extends MeanMetricWrapper implements LossInterface { - public static final int DEFAULT_K = 5; - /** Number of top elements to look at for computing accuracy. */ - private final int k; - - /** - * Creates a TopKCategoricalAccuracy metric using {@link #DEFAULT_K} for k, Number of - * top elements to look at for computing accuracy. - * - * @param tf the TensorFlow Ops - * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param seed the seed for random number generation. An initializer created with a given seed - * will always produce the same random tensor for a given shape and data type. - * @param type the date type for the result - */ - public SparseTopKCategoricalAccuracy(Ops tf, String name, long seed, Class type) { - this(tf, name, DEFAULT_K, seed, type); - } - - /** - * Creates a TopKCategoricalAccuracy metric - * - * @param tf the TensorFlow Ops - * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param k Number of top elements to look at for computing accuracy. - * @param seed the seed for random number generation. An initializer created with a given seed - * will always produce the same random tensor for a given shape and data type. - * @param type the date type for the result - */ - public SparseTopKCategoricalAccuracy(Ops tf, String name, int k, long seed, Class type) { - super(tf, name, seed, type); - this.k = k; - setLoss(this); - } - - /** {@inheritDoc} */ - @Override - public Operand call(Operand labels, Operand predictions) { - return Metrics.sparseTopKCategoricalAccuracy(getTF(), labels, predictions, k); - } -} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java deleted file mode 100644 index 3198ab0ee04..00000000000 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracy.java +++ /dev/null @@ -1,63 +0,0 @@ -/* 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. -=======================================================================*/ -package org.tensorflow.framework.metrics; - -import org.tensorflow.Operand; -import org.tensorflow.framework.metrics.impl.LossInterface; -import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; -import org.tensorflow.op.Ops; -import org.tensorflow.types.family.TNumber; - -/** Computes the poisson loss metric between labels and predictions. */ -public class TopKCategoricalAccuracy - extends MeanMetricWrapper implements LossInterface { - public static final int DEFAULT_K = 5; - /** Number of top elements to look at for computing accuracy. */ - private final int k; - - /** - * Creates a TopKCategoricalAccuracy metric using {@link #DEFAULT_K} for k, Number of - * top elements to look at for computing accuracy. - * - * @param tf the TensorFlow Ops - * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param seed the seed for random number generation. An initializer created with a given seed - * will always produce the same random tensor for a given shape and data type. - */ - public TopKCategoricalAccuracy(Ops tf, String name, long seed, Class type) { - this(tf, name, DEFAULT_K, seed, type); - } - - /** - * Creates a TopKCategoricalAccuracy metric - * - * @param tf the TensorFlow Ops - * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param k Number of top elements to look at for computing accuracy. - * @param seed the seed for random number generation. An initializer created with a given seed - * will always produce the same random tensor for a given shape and data type. - */ - public TopKCategoricalAccuracy(Ops tf, String name, int k, long seed, Class type) { - super(tf, name, seed, type); - this.k = k; - setLoss(this); - } - - /** {@inheritDoc} */ - @Override - public Operand call(Operand labels, Operand predictions) { - return Metrics.topKCategoricalAccuracy(getTF(), labels, predictions, k); - } -} diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index 5e0023c4dbe..77566e5c400 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -32,7 +32,8 @@ * then passes this loss to the {@link Mean} metric to calculate the weighted mean of the * loss over many iterations or epochs * - * @param the data type for the loss. + * @param the data type for the predictions. + * @param The data type for the metric result */ public class MeanMetricWrapper extends Mean { @@ -86,40 +87,17 @@ public void setLoss(LossInterface loss) { * @param the datatype of the predictions * @return a List of control operations that updates the Mean state variables. */ - public List updateLossStateList( + public List updateStateList( Operand labels, Operand predictions, Operand sampleWeights) { if (labels == null || predictions == null) throw new IllegalArgumentException("missing required inputs for labels and predictions"); - Class type = predictions.type(); - Operand tPredicitons = CastHelper.cast(getTF(), predictions, getType()); + Operand tLabels = CastHelper.cast(getTF(), labels, getType()); + Operand tPredictions = CastHelper.cast(getTF(), predictions, getType()); - Operand losses = loss.call(labels, tPredicitons); - Operand uLossess = CastHelper.cast(getTF(), losses, type); - return super.updateStateList(uLossess, sampleWeights); - } + Operand losses = loss.call(tLabels, tPredictions); - /** - * Creates a Control Operation that updates the state of the mean metric by calculating the loss - * between the labels and predictions and then applying a weighted mean - * metric across the multiple iterations. - * - * @param labels the truth values or labels - * @param predictions the predictions - * @param sampleWeights Optional sampleWeights acts as a coefficient for the loss. If a scalar is - * provided, then the loss is simply scaled by the given value. If sampleWeights is a tensor - * of size [batch_size], then the total loss for each sample of the batch is rescaled by the - * corresponding element in the sampleWeights vector. If the shape of sampleWeights is - * [batch_size, d0, .. dN-1] (or can be broadcasted to this shape), then each loss element of - * predictions is scaled by the corresponding value of sampleWeights. (Note on dN-1: all loss - * functions reduce by 1 dimension, usually axis=-1.) - * @param the datatype of the labels - * @return a NoOp with control dependencies that update the state of the mean metric. - */ - public final Op updateLossState( - Operand labels, Operand predictions, Operand sampleWeights) { - List controlOps = updateLossStateList(labels, predictions, sampleWeights); - return getTF().withSubScope("updateState").withControlDependencies(controlOps).noOp(); + return super.updateStateList(CastHelper.cast(getTF(), losses, predictions.type()), sampleWeights); } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java index 78d7459697c..cb5e987b4cf 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java @@ -45,8 +45,8 @@ public class MetricVariable { * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. */ - public MetricVariable(Ops tf, Variable variable, long seed) { - this(tf, variable, null, seed); + public MetricVariable(Ops tf, Variable variable, long seed, Class type) { + this(tf, variable, null, seed, type); } /** * Creates a Metric Variable @@ -61,13 +61,14 @@ public MetricVariable(Ops tf, Variable variable, long seed) { * will always produce the same random tensor for a given shape and data type. */ @SuppressWarnings("unchecked") - public MetricVariable(Ops tf, Variable variable, Initializer initializer, long seed) { + public MetricVariable( + Ops tf, Variable variable, Initializer initializer, long seed, Class type) { this.tf = tf; this.variable = variable; - Class type = variable.type(); if (initializer == null) { if (TFloating.class.isAssignableFrom(type)) { + //noinspection RedundantCast this.initializer = (Initializer) new Glorot<>(tf, VarianceScaling.Distribution.UNIFORM, seed); } else if (TIntegral.class.isAssignableFrom(type)) { @@ -76,7 +77,7 @@ public MetricVariable(Ops tf, Variable variable, Initializer initializer, throw new IllegalArgumentException( String.format( "An initializer for variable %s of type %s is required", - variable.toString(), type)); + variable.toString(), type.getSimpleName())); } } else { this.initializer = initializer; @@ -90,7 +91,7 @@ public MetricVariable(Ops tf, Variable variable, Initializer initializer, */ public Operand initialize() { initialized = true; - return initializer.call(tf.constant(variable.asOutput().shape()), variable.type()); + return initializer.call(tf.constant(variable.shape()), variable.type()); } /** diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index 5395cccf4a7..042badbb615 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -15,24 +15,30 @@ package org.tensorflow.framework.metrics.impl; import org.tensorflow.Operand; -import org.tensorflow.framework.utils.CastHelper; import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Op; import org.tensorflow.op.Ops; +import org.tensorflow.op.math.Mean; import org.tensorflow.types.TBool; +import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; +import org.tensorflow.types.family.TType; import java.util.Arrays; import java.util.Collections; import java.util.List; +import static org.tensorflow.framework.losses.impl.LossesHelper.allAxes; +import static org.tensorflow.framework.utils.CastHelper.cast; + /** * These are helper methods for Metrics and will be module private when Java modularity is applied * to TensorFlow Java. These methods should not be used outside of the metrics packages. */ public class MetricsHelper { - private static final String ASSERT_BROADCASTABLE_ERROR_PREFIX = + public static final float NEG_INF = -1e10f; + private static final String ASSERT_BROADCAST_ERROR_PREFIX = "weights can not be broadcast to values."; /** @@ -53,12 +59,12 @@ public static Op broadcastWeights( Operand weightsShape = tf.shape(sampleWeights); Operand weightsRank = tf.rank(sampleWeights); - Shape weightsShapeStatic = sampleWeights.asOutput().shape(); + Shape weightsShapeStatic = sampleWeights.shape(); int weightsRankStatic = weightsShapeStatic.numDimensions(); Operand valuesShape = tf.shape(values); Operand valuesRank = tf.rank(values); - Shape valuesShapeStatic = values.asOutput().shape(); + Shape valuesShapeStatic = values.shape(); int valuesRankStatic = valuesShapeStatic.numDimensions(); if (weightsRankStatic != -1 && valuesRankStatic != -1) { @@ -71,7 +77,7 @@ public static Op broadcastWeights( throw new IllegalArgumentException( String.format( "%s values.rank=%d. weights.rank=%d. values.shape=%s. weights.shape=%s.", - ASSERT_BROADCASTABLE_ERROR_PREFIX, + ASSERT_BROADCAST_ERROR_PREFIX, valuesRankStatic, weightsRankStatic, valuesShapeStatic.toString(), @@ -83,7 +89,7 @@ public static Op broadcastWeights( throw new IllegalArgumentException( String.format( "%s Mismatch at dim %d. values.shape=%s weights.shape=%s.", - ASSERT_BROADCASTABLE_ERROR_PREFIX, + ASSERT_BROADCAST_ERROR_PREFIX, i, valuesShapeStatic.toString(), weightsShapeStatic.toString())); @@ -97,7 +103,7 @@ public static Op broadcastWeights( Operand is_scalar = tf.math.equal(weightsRank, tf.constant(0)); List> data = Arrays.asList( - tf.constant(ASSERT_BROADCASTABLE_ERROR_PREFIX), + tf.constant(ASSERT_BROADCAST_ERROR_PREFIX), tf.constant("weights.shape="), weightsShape, tf.constant("values.shape="), @@ -111,7 +117,7 @@ public static Op broadcastWeights( is_scalar, hasValidNonscalarShape(tf, weightsRank, weightsShape, valuesRank, valuesShape)); - return tf.assertThat(isValidShape, data); + return tf.withSubScope("broadcastWeights-dynamic").assertThat(isValidShape, data); } /** @@ -149,6 +155,82 @@ private static Operand hasValidDims( Ops tf, Operand weightsShape, Operand valuesShape) { tf = tf.withSubScope("has_invalid_dims"); Operand diff = tf.reduceSum(tf.math.sub(weightsShape, valuesShape), tf.constant(0)); - return tf.math.equal(CastHelper.cast(tf, tf.constant(0), diff.type()), diff); + return tf.math.equal(cast(tf, tf.constant(0), diff.asOutput().type()), diff); + } + + // alias for mean + + /** + * Calculate the mean of the operand, along all axes and keepDims is false + * + * + * @param tf the TensorFlow Ops + * @param x the Operand used to calculate the mean + * @param the type of the Operand. + * @return the mean of the operand + */ + public static Operand mean(Ops tf, Operand x) { + return mean(tf, x, null, false); + } + + /** + * Calculate the mean of the operand, alongside the specified axis with keepDims is + * false + * + * @param tf the TensorFlow Ops + * @param x the Operand used to calculate the mean + * @param axis Axes to compute the mean. + * @param the type of the Operand. + * @param the type of the axis. + * @return the mean of the operand, alongside the specified axis. + */ + public static Operand mean( + Ops tf, Operand x, Operand axis) { + return mean(tf, x, axis, false); + } + + /** + * Calculate the mean of the operand, along all axis. + * + * @param tf the TensorFlow Ops + * @param x the Operand used to calculate the mean + * @param keepDims Indicates whether to keep the dimensions or not. If keepdims is + * false, the rank of the tensor is reduced by 1 for each entry in axis + * . If keepdims is true, the reduced dimensions are retained + * with length 1. + * @param the type of the operand + * @return the mean of elements of x. + */ + public static Operand mean(Ops tf, Operand x, boolean keepDims) { + return mean(tf, x, null, keepDims); + } + + /** + * Calculate the mean of the operand, alongside the specified axis. + * + * @param tf the TensorFlow Ops + * @param x the Operand used to calculate the mean + * @param axis Axes to compute the mean. + * @param keepDims Indicates whether to keep the dimensions or not. If `keepdims` is `false`, the + * * rank of the tensor is reduced by 1 for each entry in `axis`. If `keepdims` is `true`, the + * * reduced dimensions are retained with length 1. + * @param the data type of the Operand + * @param the data type of the axis + * @return the mean of elements of `x`. + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + public static Operand mean( + Ops tf, Operand x, Operand axis, boolean keepDims) { + // Cannot use generics here because xf may change from TBool to TFloat32 + Operand xf; + if (x.asOutput().type() == TBool.class) { + xf = tf.dtypes.cast(x, TFloat32.class); + } else { + xf = x; + } + if (axis == null) { + axis = allAxes(tf, xf); + } + return tf.math.mean(xf, axis, Mean.keepDims(keepDims)); } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index d2c8b2dec93..d3b7caa54cc 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -35,6 +35,7 @@ * Encapsulates metrics that perform a reduce operation on the metric values. * * @param The data type for the metric values + * @param The data type for the metric result */ public abstract class Reduce extends Metric { public static final String TOTAL = "total"; @@ -42,6 +43,8 @@ public abstract class Reduce extends Metri protected final MetricReduction reduction; private final String totalName; private final String countName; + + private final Class type; /** the variable that holds the total of the metric values */ protected Variable total; /** the variable that holds the count of the metric values */ @@ -56,23 +59,26 @@ public abstract class Reduce extends Metri * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ protected Reduce(Ops tf, String name, long seed, Class type) { - this(tf, name, seed, MetricReduction.SUM, type); + this(tf, name, MetricReduction.SUM, seed, type); } /** * @param tf The TensorFlow Ops * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. + * @param reduction The type of metric reduction to apply * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. - * @param reduction The type of metric reduction to apply + * @param type the type for the variables and result */ - protected Reduce(Ops tf, String name, long seed, MetricReduction reduction, Class type) { - super(tf, name, seed, type); + protected Reduce(Ops tf, String name, MetricReduction reduction, long seed, Class type) { + super(tf, name, seed); this.reduction = reduction; this.totalName = this.getVariableName(TOTAL); this.countName = this.getVariableName(COUNT); + this.type = type; setupVars(); } /** initialize the Variables */ @@ -81,14 +87,14 @@ private void setupVars() { Zeros fZeros = new Zeros<>(getTF()); total = (Variable) getVariable(totalName); if (total == null) { - total = getTF().withSubScope(totalName).variable(Shape.scalar(), getType()); + total = getTF().withSubScope(totalName).variable(Shape.scalar(), type); addVariable(totalName, total, fZeros); } if (reduction == MetricReduction.SUM_OVER_BATCH_SIZE || reduction == MetricReduction.WEIGHTED_MEAN) { count = (Variable) getVariable(countName); if (count == null) { - count = getTF().withSubScope(countName).variable(Shape.scalar(), getType()); + count = getTF().withSubScope(countName).variable(Shape.scalar(), type); addVariable(countName, count, fZeros); } } @@ -104,29 +110,48 @@ private void setupVars() { * @throws IllegalArgumentException if values is null */ @Override - public List updateStateList(Operand values, Operand sampleWeights) { + public List updateStateList(Operand values, Operand sampleWeights) { if (values == null) throw new IllegalArgumentException("values is required."); List updateOperations = new ArrayList<>(); // cast everything to match the variables + Operand lSampleWeights = null; + Operand lValues = values; - Operand tValues = CastHelper.cast(getTF(), values, getType()); - Operand tSampleWeights = sampleWeights; if (sampleWeights != null) { - LossTuple tuple = - LossesHelper.squeezeOrExpandDimensions(getTF(), null, tValues, sampleWeights); - tValues = tuple.getTarget(); - tSampleWeights = tuple.getSampleWeights(); - Op broadcastWeightsCheck = MetricsHelper.broadcastWeights(getTF(), tSampleWeights, tValues); - tValues = - getTF() - .withSubScope("broadcastWeightsCheck") - .withControlDependencies(Collections.singletonList(broadcastWeightsCheck)) - .math - .mul(tValues, tSampleWeights); + lSampleWeights = CastHelper.cast(getTF(), sampleWeights, lValues.type()); + LossTuple tuple = + LossesHelper.squeezeOrExpandDimensions(getTF(), null, lValues, lSampleWeights); + lValues = tuple.getTarget(); + lSampleWeights = tuple.getSampleWeights(); + // lSampleWeights = WeightsBroadcastOps.broadcastWeights(getTF(), lSampleWeights, lValues); + try { + + Op broadcastWeightsCheck = MetricsHelper.broadcastWeights(getTF(), lSampleWeights, lValues); + lValues = + getTF() + .withSubScope("broadcastWeightsCheck") + .withControlDependencies(Collections.singletonList(broadcastWeightsCheck)) + .math + .mul(lValues, lSampleWeights); + } catch (IllegalArgumentException ex) { + System.out.println("Reduce: Fall back from broadcast"); + // reduce the values down to the rank of the samples + int nDim = lValues.shape().numDimensions(); + int wDim = lSampleWeights.shape().numDimensions(); + int numAxes = nDim - wDim; + int[] axes = new int[numAxes]; + for (int i = 0; i < numAxes; i++) axes[i] = i + wDim; + if (reduction == MetricReduction.SUM) { + lValues = getTF().reduceSum(lValues, getTF().constant(axes)); + } else { + lValues = getTF().math.mean(lValues, getTF().constant(axes)); + } + lValues = getTF().math.mul(lValues, lSampleWeights); + } } - Operand valueSum = getTF().reduceSum(tValues, LossesHelper.allAxes(getTF(), tValues)); + Operand valueSum = getTF().reduceSum(lValues, LossesHelper.allAxes(getTF(), lValues)); Operand totalUpdate = getTF().assignAdd(total, CastHelper.cast(getTF(), valueSum, total.type())); updateOperations.add(totalUpdate); @@ -134,22 +159,18 @@ public List updateStateList(Operand values, Operand< if (reduction != MetricReduction.SUM) { switch (reduction) { case SUM_OVER_BATCH_SIZE: - numValues = - CastHelper.cast( - getTF(), getTF().constant(tValues.asOutput().shape().size()), getType()); + numValues = CastHelper.cast(getTF(), getTF().constant(lValues.shape().size()), type); break; case WEIGHTED_MEAN: - if (tSampleWeights == null) { - numValues = - CastHelper.cast( - getTF(), getTF().constant(tValues.asOutput().shape().size()), getType()); + if (lSampleWeights == null) { + numValues = CastHelper.cast(getTF(), getTF().constant(lValues.shape().size()), type); } else { numValues = CastHelper.cast( getTF(), getTF() - .reduceSum(tSampleWeights, LossesHelper.allAxes(getTF(), tSampleWeights)), - getType()); + .reduceSum(lSampleWeights, LossesHelper.allAxes(getTF(), lSampleWeights)), + type); } break; default: @@ -175,7 +196,7 @@ public Operand result(Ops rtf) { break; case WEIGHTED_MEAN: case SUM_OVER_BATCH_SIZE: - fResult = rtf.math.divNoNan(total, CastHelper.cast(rtf, count, getType())); + fResult = rtf.math.divNoNan(total, CastHelper.cast(rtf, count, type)); break; default: throw new UnsupportedOperationException( @@ -201,4 +222,9 @@ public Variable getTotal() { public Variable getCount() { return count; } + + /** Gets the type for the variables */ + public Class getType() { + return type; + } } diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java index 1f07b9567cb..0529026ce8f 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java @@ -23,6 +23,7 @@ import org.tensorflow.op.core.Variable; import org.tensorflow.types.TFloat32; import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; class BinaryCrossentropyTest { private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; @@ -57,9 +58,9 @@ public void testUnweightedLogits() { BinaryCrossentropy instance = new BinaryCrossentropy<>(tf, "BCE_testUnweightedLogits", true, 0, 1001L, TFloat64.class); session.run(instance.resetStates()); - double[] trueArray = {1, 0, 1, 0, 1, 1}; + float[] trueArray = {1, 0, 1, 0, 1, 1}; double[] logitsArray = {100.0, -100.0, 100.0, 100.0, 100.0, -100.0}; - Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); Operand logits = tf.reshape(tf.constant(logitsArray), tf.constant(Shape.of(2, 3))); Op op = instance.updateState(labels, logits, null); session.run(op); @@ -79,9 +80,9 @@ public void testWeighted() { BinaryCrossentropy instance = new BinaryCrossentropy<>(tf, "BCE_testWeighted", false, 0, 1001L, TFloat32.class); session.run(instance.resetStates()); - float[] trueArray = {1, 0, 1, 0}; + int[] trueArray = {1, 0, 1, 0}; float[] predictionArray = {1, 1, 1, 0}; - Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 2))); + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 2))); Operand yPrediction = tf.reshape(tf.constant(predictionArray), tf.constant(Shape.of(2, 2))); Operand sampleWeight = tf.constant(new float[] {1.5f, 2.f}); @@ -104,9 +105,9 @@ public void testWeightedLogits() { BinaryCrossentropy instance = new BinaryCrossentropy<>(tf, "BCE_testWeightedLogits", true, 0, 1001L, TFloat64.class); session.run(instance.resetStates()); - double[] trueArray = {1, 0, 1, 0, 1, 1}; + float[] trueArray = {1, 0, 1, 0, 1, 1}; double[] logitsArray = {100.0, -100.0, 100.0, 100.0, 100.0, -100.0}; - Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); + Operand labels = tf.reshape(tf.constant(trueArray), tf.constant(Shape.of(2, 3))); Operand logits = tf.reshape(tf.constant(logitsArray), tf.constant(Shape.of(2, 3))); Operand sampleWeight = tf.constant(new double[] {2, 2.5}); @@ -131,9 +132,9 @@ public void testLabelSmoothing() { new BinaryCrossentropy<>( tf, "BCE_testWeightedLabS", true, labelSmoothing, 1001L, TFloat64.class); session.run(instance.resetStates()); - double[] trueArray = {1, 0, 1}; + float[] trueArray = {1, 0, 1}; double[] logitsArray = {100., -100., -100.}; - Operand labels = tf.constant(trueArray); + Operand labels = tf.constant(trueArray); Operand logits = tf.constant(logitsArray); Op op = instance.updateState(labels, logits, null); diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java index 848e2051af3..a9721ef2f8f 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/CosineSimilarityTest.java @@ -79,7 +79,7 @@ public void testWeighted() { public void test_axis() { try (TestSession session = TestSession.createTestSession(tfMode)) { Ops tf = session.getTF(); - int[] axis = new int[] {1}; + int axis = 1; CosineSimilarity instance = new CosineSimilarity<>(tf, "CS_testWeighted", axis, 1001L, TFloat32.class); session.run(instance.resetStates()); diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java index bf98ec4eba4..28020c0fa1c 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/KLDivergenceTest.java @@ -69,7 +69,7 @@ public void testWeighted() { Operand predictions = tf.reshape(tf.constant(predArray), tf.constant(Shape.of(2, 3))); - Operand sampleWeight = tf.constant(new double[] {1.2, 3.4}); + Operand sampleWeight = tf.constant(new double[][] {{1.2}, {3.4}}); Op op = instance.updateState(labels, predictions, sampleWeight); session.run(op); Variable total = instance.getTotal(); diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java deleted file mode 100644 index 4a0cdefe492..00000000000 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/SparseTopKCategoricalAccuracyTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* 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. -=======================================================================*/ -package org.tensorflow.framework.metrics; - -import org.junit.jupiter.api.Test; -import org.tensorflow.Operand; -import org.tensorflow.framework.utils.TestSession; -import org.tensorflow.op.Op; -import org.tensorflow.op.Ops; -import org.tensorflow.types.TFloat64; -import org.tensorflow.types.TInt32; - -class SparseTopKCategoricalAccuracyTest { - private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; - - @Test - public void testCorrectness() { - try (TestSession session = TestSession.createTestSession(tfMode)) { - Ops tf = session.getTF(); - SparseTopKCategoricalAccuracy instance = - new SparseTopKCategoricalAccuracy<>( - tf, "SparseTopK_testCorrectness", 5, 1001L, TFloat64.class); - session.run(instance.resetStates()); - - Operand labels = tf.constant(new double[] {2, 1}); - Operand predictions = - tf.constant(new double[][] {{0.1, 0.9, 0.8}, {0.05, 0.95, 0}}); - - Op update = instance.updateState(labels, predictions, null); - session.run(update); - session.evaluate(1., instance.result()); - - // With `k` < 5. - instance = - new SparseTopKCategoricalAccuracy<>( - tf, "SparseTopK_testCorrectness", 1, 1001L, TFloat64.class); - session.run(instance.resetStates()); - update = instance.updateState(labels, predictions, null); - session.run(update); - session.evaluate(0.5, instance.result()); - - // With `k` > 5. - predictions = - tf.constant( - new double[][] { - {0.5, 0.9, 0.1, 0.7, 0.6, 0.5, 0.4}, - {0.05, 0.95, 0, 0, 0, 0, 0} - }); - instance = - new SparseTopKCategoricalAccuracy<>( - tf, "SparseTopK_testCorrectness", 6, 1001L, TFloat64.class); - session.run(instance.resetStates()); - update = instance.updateState(labels, predictions, null); - session.run(update); - session.evaluate(0.5, instance.result()); - } - } - - @Test - public void testWeighted() { - try (TestSession session = TestSession.createTestSession(tfMode)) { - Ops tf = session.getTF(); - SparseTopKCategoricalAccuracy instance = - new SparseTopKCategoricalAccuracy<>( - tf, "SparseTopK_testWeighted", 5, 1001L, TFloat64.class); - session.run(instance.resetStates()); - - Operand labels = tf.constant(new int[] {1, 0, 2}); - Operand predictions = - tf.constant( - new double[][] { - {0, 0.9, 0.1}, - {0, 0.9, 0.1}, - {0, 0.9, 0.1} - }); - - Operand sampleWeight = tf.constant(new double[] {1, 0, 1}); - - Op update = instance.updateState(labels, predictions, sampleWeight); - session.run(update); - session.evaluate(1., instance.result()); - } - } -} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java deleted file mode 100644 index 52ccde29196..00000000000 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/TopKCategoricalAccuracyTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* 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. -=======================================================================*/ -package org.tensorflow.framework.metrics; - -import org.junit.jupiter.api.Test; -import org.tensorflow.Operand; -import org.tensorflow.framework.utils.TestSession; -import org.tensorflow.op.Op; -import org.tensorflow.op.Ops; -import org.tensorflow.types.TFloat32; -import org.tensorflow.types.TFloat64; - -class TopKCategoricalAccuracyTest { - private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; - - @Test - public void testCorrectness() { - try (TestSession session = TestSession.createTestSession(tfMode)) { - Ops tf = session.getTF(); - TopKCategoricalAccuracy instance = - new TopKCategoricalAccuracy<>(tf, "TopK_testUnweighted", 5, 1001L, TFloat64.class); - session.run(instance.resetStates()); - Operand labels = tf.constant(new float[][] {{0, 0, 1}, {0, 1, 0}}); - Operand predictions = - tf.constant(new double[][] {{0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f}}); - - Op update = instance.updateState(labels, predictions, null); - session.run(update); - session.evaluate(1., instance.result()); - - // With `k` < 5. - instance = - new TopKCategoricalAccuracy<>(tf, "TopK_testUnweighted1", 1, 1001L, TFloat64.class); - session.run(instance.resetStates()); - update = instance.updateState(labels, predictions, null); - session.run(update); - session.evaluate(0.5, instance.result()); - - // With `k` > 5. - labels = - tf.constant( - new float[][] { - {0, 0, 1, 0, 0, 0, 0}, - {0, 1, 0, 0, 0, 0, 0} - }); - predictions = - tf.constant( - new double[][] { - {0.5f, 0.9f, 0.1f, 0.7f, 0.6f, 0.5f, 0.4f}, - {0.05f, 0.95f, 0f, 0f, 0f, 0f, 0f} - }); - instance = - new TopKCategoricalAccuracy<>(tf, "TopK_testUnweighted6", 6, 1001L, TFloat64.class); - session.run(instance.resetStates()); - update = instance.updateState(labels, predictions, null); - session.run(update); - session.evaluate(0.5, instance.result()); - } - } - - @Test - public void testWeighted() { - try (TestSession session = TestSession.createTestSession(tfMode)) { - Ops tf = session.getTF(); - TopKCategoricalAccuracy instance = - new TopKCategoricalAccuracy<>(tf, "TopK_testWeighted", 5, 1001L, TFloat64.class); - session.run(instance.resetStates()); - - Operand labels = - tf.constant( - new double[][] { - {1, 0, 2}, - {1, 0, 0}, - {0, 0, 1} - }); - Operand predictions = - tf.constant( - new double[][] { - {0f, 0.9f, 0.1f}, - {0f, 0.9f, 0.1f}, - {0f, 0.9f, 0.1f} - }); - - Operand sampleWeight = tf.constant(new double[] {1, 0, 1}); - - Op update = instance.updateState(labels, predictions, sampleWeight); - session.run(update); - session.evaluate(1., instance.result()); - } - } -} From 4887b5b9a24398cc891efbd4a2e1da64e839f1b0 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Fri, 1 Jan 2021 09:04:32 -0500 Subject: [PATCH 03/60] Initial checkin and sync with master --- .../tensorflow/framework/metrics/BinaryCrossentropyTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java index 0529026ce8f..7ceedded018 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/BinaryCrossentropyTest.java @@ -45,9 +45,9 @@ public void testUnweighted() { Variable total = instance.getTotal(); Variable count = instance.getCount(); Operand result = instance.result(); - session.evaluate(7.666619F, total); + session.evaluate(7.71247434F, total); session.evaluate(2, count); - session.evaluate(3.833309F, result); + session.evaluate(3.85623717F, result); } } From 04eeea653da21de62722db2d1b3828a05bb18cf3 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Fri, 1 Jan 2021 09:46:18 -0500 Subject: [PATCH 04/60] JavaDoc cleanup --- .../framework/metrics/BinaryCrossentropy.java | 4 +- .../metrics/CategoricalCrossentropy.java | 11 +++- .../framework/metrics/CategoricalHinge.java | 8 ++- .../framework/metrics/CosineSimilarity.java | 19 +++--- .../tensorflow/framework/metrics/Hinge.java | 8 ++- .../framework/metrics/KLDivergence.java | 9 ++- .../framework/metrics/LogCoshError.java | 8 ++- .../tensorflow/framework/metrics/Mean.java | 4 +- .../framework/metrics/MeanAbsoluteError.java | 8 ++- .../metrics/MeanAbsolutePercentageError.java | 8 ++- .../framework/metrics/MeanSquaredError.java | 8 ++- .../metrics/MeanSquaredLogarithmicError.java | 8 ++- .../tensorflow/framework/metrics/Metric.java | 14 ----- .../tensorflow/framework/metrics/Metrics.java | 59 +------------------ .../tensorflow/framework/metrics/Poisson.java | 8 ++- .../SparseCategoricalCrossentropy.java | 9 ++- .../framework/metrics/SquaredHinge.java | 8 ++- .../metrics/impl/MeanMetricWrapper.java | 9 +-- .../metrics/impl/MetricVariable.java | 4 +- 19 files changed, 110 insertions(+), 104 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java index 41a5533b5d1..2372293d0d3 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java @@ -22,7 +22,7 @@ import org.tensorflow.types.family.TNumber; /** - * Computes the binary cross-entropy loss between true labels and predicted labels. + * A Metric that computes the binary cross-entropy loss between true labels and predicted labels. * * @param the data type for the predictions. * @param The data type for the metric result @@ -48,7 +48,7 @@ public class BinaryCrossentropy * correspond to heavier smoothing. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. - * @param type the data type for the variables + * @param type the type for the variables and result */ public BinaryCrossentropy( Ops tf, String name, boolean fromLogits, float labelSmoothing, long seed, Class type) { diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java index 79481f608a1..6bfd471401b 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java @@ -22,12 +22,16 @@ import org.tensorflow.types.family.TNumber; /** - * Computes the categorical cross-entropy loss between true labels and predicted labels. + * A Metric that computes the categorical cross-entropy loss between true labels and predicted + * labels. * *

This is the crossentropy metric class to be used when there are multiple label classes (2 or - * more). Here we assume that labels are given as a one_hot representation. eg., When labels values - * are [2, 0, 1], the labels Operand contains = [[0, 0, 1], [1, 0, 0], [0, 1, 0]] + * more). The labels should be given as a one_hot representation. eg., When labels values are + * [2, 0, 1], the labels Operand contains = [[0, 0, 1], [1, 0, 0], [0, 1, 0]] * . + * + * @param the data type for the predictions. + * @param The data type for the metric result */ public class CategoricalCrossentropy extends MeanMetricWrapper implements LossInterface { @@ -51,6 +55,7 @@ public class CategoricalCrossentropy * for label 1 * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public CategoricalCrossentropy( Ops tf, String name, boolean fromLogits, float labelSmoothing, long seed, Class type) { diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java index a9500b79d9e..21f19d88ade 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the categorical hinge loss metric between labels and predictions. */ +/** + * A Metric that computes the categorical hinge loss metric between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result + */ public class CategoricalHinge extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class CategoricalHinge extends Mean * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public CategoricalHinge(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java index 4a5214aea8d..9ceccf7fc13 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java @@ -20,32 +20,33 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the cosine similarity metric between labels and predictions. */ -// TODO: this is weird, the metric is called CosineSimilarity in Keras, -// but it calls Metrics.cosineProximity instead of Losses.cosineSimilarity. -// The metric is calculating the Euclidean distance using L2 norms, while the loss -// is using the dot product proportional to the product of their magnitudes. -// While the 2 concepts are similar, they are different. -// Should we rename this metric to CosineProximity? +/** + * A metric that computes the cosine similarity metric between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class CosineSimilarity extends MeanMetricWrapper implements LossInterface { public static final int DEFAULT_AXIS = -1; private final int[] axis; /** - * Creates a CosineSimilarity metric with a default axis, {@link #DEFAULT_AXIS} + * Creates a metric that computes the cosine similarity metric between labels and predictions with + * a default axis, {@link #DEFAULT_AXIS} * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public CosineSimilarity(Ops tf, String name, long seed, Class type) { this(tf, name, DEFAULT_AXIS, seed, type); } /** - * Creates a CosineSimilarity metric + * Creates a metric that computes the cosine similarity metric between labels and predictions. * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java index d655f8d8237..b276f0b9426 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the hinge loss metric between labels and predictions. */ +/** + * A metric that computes the hinge loss metric between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class Hinge extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class Hinge extends MeanMetricWrapp * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public Hinge(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java index 3f31383381a..a3cbc6f16e6 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java @@ -21,7 +21,13 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes Computes Kullback-Leibler divergence loss metric between labels and predictions. */ +/** + * A metric that computes the Kullback-Leibler divergence loss metric between labels and + * predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class KLDivergence extends MeanMetricWrapper implements LossInterface { @@ -32,6 +38,7 @@ public class KLDivergence extends MeanMetr * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public KLDivergence(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java index 7d4b8a9fad7..d6fe903f5a1 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java @@ -22,8 +22,11 @@ import org.tensorflow.types.family.TNumber; /** - * Computes the logarithm of the hyperbolic cosine of the prediction error metric between labels and - * predictions. + * A metric that computes the logarithm of the hyperbolic cosine of the prediction error metric + * between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. */ public class LogCoshError extends MeanMetricWrapper implements LossInterface { @@ -35,6 +38,7 @@ public class LogCoshError extends MeanMetr * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public LogCoshError(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java index c68a70902a7..de1f5a5629e 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Mean.java @@ -19,7 +19,7 @@ import org.tensorflow.types.family.TNumber; /** - * Represents a Metric that implements a weighted mean {@link MetricReduction#WEIGHTED_MEAN } + * A metric that that implements a weighted mean {@link MetricReduction#WEIGHTED_MEAN } * * @param The data type for the metric values * @param The data type for the metric result @@ -33,7 +33,7 @@ public class Mean extends Reduce { * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. - * @param type the type for the result. + * @param type the type for the variables and result */ protected Mean(Ops tf, String name, long seed, Class type) { super(tf, name, MetricReduction.WEIGHTED_MEAN, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java index 6b29c72fe82..79da80ef191 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the mean of absolute difference between labels and predictions. */ +/** + * A metric that computes the mean of absolute difference between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class MeanAbsoluteError extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class MeanAbsoluteError extends Mea * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public MeanAbsoluteError(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java index 6209245d881..558c194074f 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the mean of absolute difference between labels and predictions. */ +/** + * A metric that computes the mean of absolute difference between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class MeanAbsolutePercentageError extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class MeanAbsolutePercentageError * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public MeanAbsolutePercentageError(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java index ce30e378e8d..10704d14bd4 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the mean of absolute difference between labels and predictions. */ +/** + * A metric that computes the mean of absolute difference between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class MeanSquaredError extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class MeanSquaredError extends Mean * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public MeanSquaredError(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java index 9baeac2f320..585fc312e5a 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the mean of absolute difference between labels and predictions. */ +/** + * A metric that computes the mean of absolute difference between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class MeanSquaredLogarithmicError extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class MeanSquaredLogarithmicError * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public MeanSquaredLogarithmicError(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 28a2ae0fa94..89e5436ed0a 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -42,19 +42,6 @@ public abstract class Metric { /** The random number generator seed value */ private final long seed; - // TODO: how to handle variables across new ExecutionEnvironments. - // Metrics may be instantiated multiple times using the same variables, - // These variables become stale when a new ExecutionEnvironment is created - // (most commonly seen in Unit Tests), so the question is how to best handle this. - // Option 1, which is used here is to map the variables against an instance of - // an ExecutionEnvironment in a WeakHashMap, when a new ExecutionEnvironment is presented, the - // new - // variables are mapped to it. A WeakHashMap is used to throw away the old ExecutionEnvironment - // mappings, when the old ExecutionEnvironment is finalized. - // Option 2, keep an instance of the newly presented ExecutionEnvironment and if it changes, - // clear the variable maps. - // My guess is that in a non-unit test environment, only one ExecutionEnvironment will be used, - // I welcome thoughts on this. /** The name for this metric. Defaults to {@link Class#getSimpleName()}. */ private final String name; @@ -185,7 +172,6 @@ public final Operand callOnce( */ protected void addVariable( String varName, Variable variable, Initializer initializer) { - // TODO option 2 would be to keep track of tf.scope().env() and if it changes, clear to old Map. Map> variables = variableMap.computeIfAbsent(tf.scope().env(), k -> new HashMap<>()); variables.put(varName, new MetricVariable<>(tf, variable, initializer, seed, variable.type())); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java index c3c44ef6134..8a8ddf3694c 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -16,14 +16,12 @@ import org.tensorflow.Operand; import org.tensorflow.framework.utils.CastHelper; -import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Ops; import org.tensorflow.op.core.ReduceSum; import org.tensorflow.types.TFloat32; -import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TNumber; -/** Built-in metrics functions. */ +/** Helper class with built-in metrics functions. */ public class Metrics { public static final float L2_NORM_EPSILON = 1e-12f; @@ -60,54 +58,6 @@ public static Operand topKCategoricalA predictions.type()); } - /** - * Computes how often integer targets are in the top K predictions. - * - *

Standalone usage: - * - *

-   *     Operand<TInt32> labels = tf.constant(new int[]{2, 1});
-   *     Operand<TFloat32> predictions = tf.constant(new float[][]
-   *                            {{0.1f, 0.9f, 0.f8}, {0.05f, 0.95f, 0f}});
-   *     Operand<TFloat32> m = Metrics.topKCategoricalAccuracy(
-   *                                    labels, predictions, 3)
-   *     //m.shape().toString == "[2]"
-   * 
- * - * @param tf the TensorFlow Ops. - * @param labels the ground truth values. - * @param predictions The prediction values. - * @param k Number of top elements to look at for computing accuracy. - * @param the data type for the predictions and results - * @param the data type ofr the labels. - * @return the Operand for the Sparse top K categorical accuracy value. - */ - @SuppressWarnings("unchecked") - public static Operand sparseTopKCategoricalAccuracy( - Ops tf, Operand labels, Operand predictions, int k) { - Operand tLabels; - if (labels.type() != predictions.type()) - tLabels = CastHelper.cast(tf, labels, predictions.type()); - else tLabels = (Operand) labels; - - int predictionsRank = predictions.shape().numDimensions(); - int labelsRank = tLabels.shape().numDimensions(); - - Operand castPredictions = CastHelper.cast(tf, predictions, TFloat32.class); - if (predictionsRank != Shape.UNKNOWN_SIZE && labelsRank != Shape.UNKNOWN_SIZE) { - if (predictionsRank > 2) { - castPredictions = tf.shape.reduceDims(castPredictions, tf.constant(1)); - } - if (labelsRank > 1) { - tLabels = tf.shape.flatten(tLabels); - } - } - return CastHelper.cast( - tf, - tf.nn.inTopK(castPredictions, CastHelper.cast(tf, tLabels, TInt32.class), tf.constant(k)), - predictions.type()); - } - /** * Computes the cosine similarity between labels and predictions. * @@ -152,10 +102,7 @@ public static Operand cosineProximity( * @param The data type for x. * @return the normalized values of x. */ - // TODO this was tf.math.l2_normalize in TF Python, does it belong here? - - public static Operand l2Normalize( - Ops tf, Operand x, int[] axes) { + public static Operand l2Normalize(Ops tf, Operand x, int[] axes) { return l2Normalize(tf, x, axes, L2_NORM_EPSILON); } @@ -179,7 +126,6 @@ public static Operand l2Normalize( * @param The data type for the values. * @return the normalized values of x. */ - // TODO this was tf.math.l2_normalize in TF Python, does it belong here? public static Operand l2Normalize( Ops tf, Operand x, int[] axes, float epsilon) { Operand squareSum = @@ -189,5 +135,4 @@ public static Operand l2Normalize( tf.math.maximum(squareSum, CastHelper.cast(tf, tf.constant(epsilon), x.type()))); return tf.math.mul(x, y); } - } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java index f5730b07f42..07ab129eb08 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the poisson loss metric between labels and predictions. */ +/** + * A metric that computes the poisson loss metric between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class Poisson extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class Poisson extends MeanMetricWra * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public Poisson(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java index 403e11af8c0..c2f916217e4 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java @@ -21,7 +21,13 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the sparse categorical cross-entropy loss between true labels and predicted labels. */ +/** + * A metric that computes the sparse categorical cross-entropy loss between true labels and + * predicted labels. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class SparseCategoricalCrossentropy extends MeanMetricWrapper implements LossInterface { @@ -37,6 +43,7 @@ public class SparseCategoricalCrossentropy * @param axes The dimension along which the entropy is computed. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public SparseCategoricalCrossentropy( Ops tf, String name, boolean fromLogits, int axes, long seed, Class type) { diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java index 7ce8091f2a0..d8c7aa097fe 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java @@ -21,7 +21,12 @@ import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; -/** Computes the squared hinge loss metric between labels and predictions. */ +/** + * A metric that computes the squared hinge loss metric between labels and predictions. + * + * @param the data type for the predictions. + * @param The data type for the metric result. + */ public class SquaredHinge extends MeanMetricWrapper implements LossInterface { @@ -32,6 +37,7 @@ public class SquaredHinge extends MeanMetr * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public SquaredHinge(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index 77566e5c400..5894b24c4cd 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -25,8 +25,8 @@ import java.util.List; /** - * Bridges a stateless loss function with the {@link Mean} metric using a reduction of {@link - * MetricReduction#WEIGHTED_MEAN}. + * A class that bridges a stateless loss function with the {@link Mean} metric using a reduction of + * {@link MetricReduction#WEIGHTED_MEAN}. * *

The loss function calculates the loss between the labels and predictions * then passes this loss to the {@link Mean} metric to calculate the weighted mean of the @@ -47,6 +47,7 @@ public class MeanMetricWrapper extends Mea * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ protected MeanMetricWrapper(Ops tf, String name, long seed, Class type) { super(tf, name, seed, type); @@ -95,9 +96,9 @@ public List updateStateList( Operand tLabels = CastHelper.cast(getTF(), labels, getType()); Operand tPredictions = CastHelper.cast(getTF(), predictions, getType()); - Operand losses = loss.call(tLabels, tPredictions); - return super.updateStateList(CastHelper.cast(getTF(), losses, predictions.type()), sampleWeights); + return super.updateStateList( + CastHelper.cast(getTF(), losses, predictions.type()), sampleWeights); } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java index cb5e987b4cf..786d5db1261 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java @@ -30,7 +30,6 @@ * * @param the data type of the variable */ -// TODO handle distributed variables with VariableAggregation and VariableSynchronization public class MetricVariable { private final Variable variable; private final Initializer initializer; @@ -44,10 +43,12 @@ public class MetricVariable { * @param variable the variable * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variable */ public MetricVariable(Ops tf, Variable variable, long seed, Class type) { this(tf, variable, null, seed, type); } + /** * Creates a Metric Variable * @@ -59,6 +60,7 @@ public MetricVariable(Ops tf, Variable variable, long seed, Class type) { * other types the default initializer is {@link org.tensorflow.framework.initializers.Zeros} * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variable */ @SuppressWarnings("unchecked") public MetricVariable( From dcb24147321c0f1af0fa34aeb8da4a13dac7e7cb Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Sun, 3 Jan 2021 12:07:45 -0500 Subject: [PATCH 05/60] Javadoc fixes --- .../tensorflow/framework/metrics/CategoricalCrossentropy.java | 1 + .../org/tensorflow/framework/metrics/CosineSimilarity.java | 2 ++ .../main/java/org/tensorflow/framework/metrics/Metric.java | 2 ++ .../main/java/org/tensorflow/framework/metrics/Metrics.java | 4 ++-- .../java/org/tensorflow/framework/metrics/impl/Reduce.java | 4 +++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java index 6bfd471401b..72e15f1b22b 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java @@ -79,6 +79,7 @@ public CategoricalCrossentropy( * channels_first. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public CategoricalCrossentropy( Ops tf, diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java index 9ceccf7fc13..5bd0c53b416 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java @@ -53,6 +53,7 @@ public CosineSimilarity(Ops tf, String name, long seed, Class type) { * @param axis The dimension along which the cosine similarity is computed. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public CosineSimilarity(Ops tf, String name, int axis, long seed, Class type) { this(tf, name, new int[] {axis}, seed, type); @@ -65,6 +66,7 @@ public CosineSimilarity(Ops tf, String name, int axis, long seed, Class type) * @param axis The dimension along which the cosine similarity is computed. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. + * @param type the type for the variables and result */ public CosineSimilarity(Ops tf, String name, int[] axis, long seed, Class type) { super(tf, name, seed, type); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 89e5436ed0a..378d026e69c 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -164,11 +164,13 @@ public final Operand callOnce( /** * Adds a variable to collect metric values * + * @param varName the name for the variable * @param variable the variable * @param initializer the initializer for the variable, if null, then the default for floating * point types is {@link org.tensorflow.framework.initializers.Glorot} with distribution * {@link org.tensorflow.framework.initializers.VarianceScaling.Distribution#UNIFORM}, for * other types the default initializer is {@link org.tensorflow.framework.initializers.Zeros} + * @param the date type for the variable */ protected void addVariable( String varName, Variable variable, Initializer initializer) { diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java index 8a8ddf3694c..e31cb54a4d1 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -121,8 +121,8 @@ public static Operand l2Normalize(Ops tf, Operand x, i * @param tf The TensorFlow ops * @param x The operand to normalize * @param axes Dimension(s) along which to normalize. - * @param epsilon A lower bound value for the norm. Will use `sqrt(epsilon)` as the divisor if - * `norm < sqrt(epsilon)`. + * @param epsilon A lower bound value for the norm. Will use sqrt(epsilon) as the divisor if + * norm < sqrt(epsilon). * @param The data type for the values. * @return the normalized values of x. */ diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index d3b7caa54cc..c8499bc1599 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -223,7 +223,9 @@ public Variable getCount() { return count; } - /** Gets the type for the variables */ + /** Gets the type for the variables + * @return the type for the variables + */ public Class getType() { return type; } From 82f18bf1a83e95b63e7fb306527e9d28c1479833 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Tue, 5 Jan 2021 12:32:34 -0500 Subject: [PATCH 06/60] Change LossInterface to LossMetric. Fix JavaDoc, modify one line code block to include braces. --- .../framework/metrics/BinaryCrossentropy.java | 10 +++++----- .../framework/metrics/CategoricalCrossentropy.java | 8 ++++---- .../tensorflow/framework/metrics/CategoricalHinge.java | 4 ++-- .../tensorflow/framework/metrics/CosineSimilarity.java | 4 ++-- .../java/org/tensorflow/framework/metrics/Hinge.java | 4 ++-- .../org/tensorflow/framework/metrics/KLDivergence.java | 4 ++-- .../org/tensorflow/framework/metrics/LogCoshError.java | 4 ++-- .../framework/metrics/MeanAbsoluteError.java | 4 ++-- .../framework/metrics/MeanAbsolutePercentageError.java | 4 ++-- .../tensorflow/framework/metrics/MeanSquaredError.java | 4 ++-- .../framework/metrics/MeanSquaredLogarithmicError.java | 4 ++-- .../java/org/tensorflow/framework/metrics/Metric.java | 10 +++++----- .../java/org/tensorflow/framework/metrics/Metrics.java | 6 +----- .../java/org/tensorflow/framework/metrics/Poisson.java | 4 ++-- .../metrics/SparseCategoricalCrossentropy.java | 4 ++-- .../org/tensorflow/framework/metrics/SquaredHinge.java | 4 ++-- .../impl/{LossInterface.java => LossMetric.java} | 2 +- .../framework/metrics/impl/MeanMetricWrapper.java | 9 +++++---- .../framework/metrics/impl/MetricVariable.java | 5 +++-- .../framework/metrics/impl/MetricsHelper.java | 10 +++++----- .../org/tensorflow/framework/metrics/impl/Reduce.java | 5 +++-- 21 files changed, 56 insertions(+), 57 deletions(-) rename tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/{LossInterface.java => LossMetric.java} (95%) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java index 2372293d0d3..c339b977007 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -24,11 +24,14 @@ /** * A Metric that computes the binary cross-entropy loss between true labels and predicted labels. * + *

This is the crossentropy metric class to be used when there are only two label classes (0 and + * 1). + * * @param the data type for the predictions. * @param The data type for the metric result */ public class BinaryCrossentropy - extends MeanMetricWrapper implements LossInterface { + extends MeanMetricWrapper implements LossMetric { private final boolean fromLogits; private final float labelSmoothing; @@ -36,9 +39,6 @@ public class BinaryCrossentropy /** * Creates a BinaryCrossentropy metric * - *

This is the crossentropy metric class to be used when there are only two label classes (0 - * and 1). - * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java index 72e15f1b22b..7b8cf0054a4 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -34,14 +34,14 @@ * @param The data type for the metric result */ public class CategoricalCrossentropy - extends MeanMetricWrapper implements LossInterface { + extends MeanMetricWrapper implements LossMetric { private final boolean fromLogits; private final float labelSmoothing; private final int axis; /** - * Creates a CategoricalCrossentropy metric that Computes the crossentropy metric between the + * Creates a CategoricalCrossentropy metric that computes the crossentropy metric between the * labels and predictions. * *

Uses a {@link Losses#CHANNELS_LAST} for the channel axis. @@ -63,7 +63,7 @@ public CategoricalCrossentropy( } /** - * Creates a CategoricalCrossentropy metric that Computes the crossentropy metric between the + * Creates a CategoricalCrossentropy metric that computes the crossentropy metric between the * labels and predictions. * * @param tf the TensorFlow Ops diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java index 21f19d88ade..2741a36edb6 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalHinge.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result */ public class CategoricalHinge extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a CategoricalHinge metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java index 5bd0c53b416..458de092bec 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CosineSimilarity.java @@ -15,7 +15,7 @@ package org.tensorflow.framework.metrics; import org.tensorflow.Operand; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -27,7 +27,7 @@ * @param The data type for the metric result. */ public class CosineSimilarity extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { public static final int DEFAULT_AXIS = -1; private final int[] axis; diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java index b276f0b9426..baf9ad8ab7d 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Hinge.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class Hinge extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a Hinge metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java index a3cbc6f16e6..efcbbcbb7f0 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/KLDivergence.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -29,7 +29,7 @@ * @param The data type for the metric result. */ public class KLDivergence extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a KLDivergence metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java index d6fe903f5a1..3df8505d54b 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/LogCoshError.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -29,7 +29,7 @@ * @param The data type for the metric result. */ public class LogCoshError extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a LogCoshError metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java index 79da80ef191..e27676932ff 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsoluteError.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class MeanAbsoluteError extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a Mean Absolute Error metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java index 558c194074f..84fa9b627b2 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanAbsolutePercentageError.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class MeanAbsolutePercentageError - extends MeanMetricWrapper implements LossInterface { + extends MeanMetricWrapper implements LossMetric { /** * Creates a Mean Absolute Error metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java index 10704d14bd4..c7edd6ebe93 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredError.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class MeanSquaredError extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a Mean Absolute Error metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java index 585fc312e5a..199b6e0e114 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanSquaredLogarithmicError.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class MeanSquaredLogarithmicError - extends MeanMetricWrapper implements LossInterface { + extends MeanMetricWrapper implements LossMetric { /** * Creates a Mean Absolute Error metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 378d026e69c..c816b1a98d0 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -65,8 +65,9 @@ protected Metric(Ops tf, long seed) { * will always produce the same random tensor for a given shape and data type. */ protected Metric(Ops tf, String name, long seed) { - if (!tf.scope().env().isGraph()) + if (!tf.scope().env().isGraph()) { throw new IllegalArgumentException("Metrics are required to execute in Graph mode."); + } this.seed = seed; this.name = name != null ? name : this.getClass().getSimpleName(); this.tf = tf.withSubScope(this.name); @@ -81,7 +82,7 @@ protected Metric(Ops tf, String name, long seed) { * @param sampleWeights sample weights to be applied to values, may be null. * @return a List of Operations to update the metric state */ - @SuppressWarnings({"unchecked","unused"}) + @SuppressWarnings({"unchecked", "unused"}) public List updateStateList(Operand values, Operand sampleWeights) { return Collections.EMPTY_LIST; } @@ -97,7 +98,7 @@ public List updateStateList(Operand values, Operand sampleWeights) { * @param the data type for the sample weights * @return a List of Operations to update the metric state */ - @SuppressWarnings({"unchecked","unused"}) + @SuppressWarnings({"unchecked", "unused"}) public List updateStateList( Operand labels, Operand predictions, Operand sampleWeights) { return Collections.EMPTY_LIST; @@ -154,8 +155,7 @@ public Operand result() { * @param sampleWeights sample weights to be applied to values, may be null. * @return the result, possibly with control dependencies */ - public final Operand callOnce( - Operand values, Operand sampleWeights) { + public final Operand callOnce(Operand values, Operand sampleWeights) { List controlOps = updateStateList(values, sampleWeights); Ops ltf = tf.withSubScope("callOnce").withControlDependencies(controlOps); return result(ltf); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java index e31cb54a4d1..b8e79efa450 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -69,13 +69,9 @@ public static Operand topKCategoricalA * @param the data type for the predictions and result * @return Cosine similarity value. */ - @SuppressWarnings("unchecked") public static Operand cosineProximity( Ops tf, Operand labels, Operand predictions, int[] axis) { - Operand labelsNorm; - if (labels.type() != predictions.type()) - labelsNorm = CastHelper.cast(tf, labels, predictions.type()); - else labelsNorm = (Operand) labels; + Operand labelsNorm = CastHelper.cast(tf, labels, predictions.type()); labelsNorm = l2Normalize(tf, labelsNorm, axis); Operand predictionsNorm = l2Normalize(tf, predictions, axis); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java index 07ab129eb08..75a2031fbb5 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Poisson.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class Poisson extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a Poisson metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java index c2f916217e4..3fde8b2ecf6 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -29,7 +29,7 @@ * @param The data type for the metric result. */ public class SparseCategoricalCrossentropy - extends MeanMetricWrapper implements LossInterface { + extends MeanMetricWrapper implements LossMetric { private final boolean fromLogits; private final int axes; diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java index d8c7aa097fe..430dbbcc229 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SquaredHinge.java @@ -16,7 +16,7 @@ import org.tensorflow.Operand; import org.tensorflow.framework.losses.Losses; -import org.tensorflow.framework.metrics.impl.LossInterface; +import org.tensorflow.framework.metrics.impl.LossMetric; import org.tensorflow.framework.metrics.impl.MeanMetricWrapper; import org.tensorflow.op.Ops; import org.tensorflow.types.family.TNumber; @@ -28,7 +28,7 @@ * @param The data type for the metric result. */ public class SquaredHinge extends MeanMetricWrapper - implements LossInterface { + implements LossMetric { /** * Creates a SquaredHinge metric diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossMetric.java similarity index 95% rename from tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java rename to tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossMetric.java index aadc211c3c4..b7b87d313aa 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossInterface.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/LossMetric.java @@ -22,7 +22,7 @@ * * @param The data type of the predictions. */ -public interface LossInterface { +public interface LossMetric { /** * Calculates the weighted loss between labels and predictions diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index 5894b24c4cd..cd17e2a9de4 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -38,7 +38,7 @@ public class MeanMetricWrapper extends Mean { /** The loss function interface */ - protected LossInterface loss; + protected LossMetric loss; /** * Creates a Reducible Metric with a metric reductions of {@link MetricReduction#WEIGHTED_MEAN} @@ -58,7 +58,7 @@ protected MeanMetricWrapper(Ops tf, String name, long seed, Class type) { * * @return the loss function. */ - public LossInterface getLoss() { + public LossMetric getLoss() { return loss; } @@ -67,7 +67,7 @@ public LossInterface getLoss() { * * @param loss the loss function. */ - public void setLoss(LossInterface loss) { + protected void setLoss(LossMetric loss) { this.loss = loss; } @@ -90,8 +90,9 @@ public void setLoss(LossInterface loss) { */ public List updateStateList( Operand labels, Operand predictions, Operand sampleWeights) { - if (labels == null || predictions == null) + if (labels == null || predictions == null) { throw new IllegalArgumentException("missing required inputs for labels and predictions"); + } Operand tLabels = CastHelper.cast(getTF(), labels, getType()); Operand tPredictions = CastHelper.cast(getTF(), predictions, getType()); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java index 786d5db1261..c5c5dbb2ab2 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java @@ -61,6 +61,7 @@ public MetricVariable(Ops tf, Variable variable, long seed, Class type) { * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. * @param type the type for the variable + * @throws IllegalArgumentException if the type does not inherit from TNumber and the initializer is null */ @SuppressWarnings("unchecked") public MetricVariable( @@ -78,8 +79,8 @@ public MetricVariable( } else { throw new IllegalArgumentException( String.format( - "An initializer for variable %s of type %s is required", - variable.toString(), type.getSimpleName())); + "Type %s is not a supported for metric variables", + type.getSimpleName())); } } else { this.initializer = initializer; diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index 042badbb615..9699ccd323c 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -42,16 +42,16 @@ public class MetricsHelper { "weights can not be broadcast to values."; /** - * Asserts that the sampleWeight can be broadcast to values + * Asserts that the sampleWeights can be broadcast to values * * @param tf the TensorFlow Ops * @param sampleWeights the sample weights. * @param values the values to which weights are applied. - * @return Operation raising InvalidArgumentError if sampleWeight - * has incorrect shape. no_op if static checks determine - * sampleWeight has correct shape. + * @return Operation with control dependencies to ensure sampleWeight + * can be broadcast to values * @param the type of Operand - * @throws IllegalArgumentException If static checks determine `weights` has incorrect shape. + * @throws IllegalArgumentException If static checks determine sampleWeights has an + * incorrect shape that prohibit broadcasting to to values */ @SuppressWarnings("unchecked") public static Op broadcastWeights( diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index c8499bc1599..3ec6540779c 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -112,7 +112,9 @@ private void setupVars() { @Override public List updateStateList(Operand values, Operand sampleWeights) { - if (values == null) throw new IllegalArgumentException("values is required."); + if (values == null) { + throw new IllegalArgumentException("values is required."); + } List updateOperations = new ArrayList<>(); // cast everything to match the variables Operand lSampleWeights = null; @@ -124,7 +126,6 @@ public List updateStateList(Operand values, Operand sampleWeights) { LossesHelper.squeezeOrExpandDimensions(getTF(), null, lValues, lSampleWeights); lValues = tuple.getTarget(); lSampleWeights = tuple.getSampleWeights(); - // lSampleWeights = WeightsBroadcastOps.broadcastWeights(getTF(), lSampleWeights, lValues); try { Op broadcastWeightsCheck = MetricsHelper.broadcastWeights(getTF(), lSampleWeights, lValues); From 9aa1511838114ba2a17ec20e16433828bfab3400 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Thu, 7 Jan 2021 17:15:30 -0500 Subject: [PATCH 07/60] Removed hashmap for variables, they are not needed as the variables only live within a single instance of a Metric. --- .../tensorflow/framework/metrics/Metric.java | 121 +++--------------- .../framework/metrics/impl/Reduce.java | 37 +++--- 2 files changed, 37 insertions(+), 121 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index c816b1a98d0..a6f2cf0f26d 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -14,17 +14,13 @@ =======================================================================*/ package org.tensorflow.framework.metrics; -import org.tensorflow.ExecutionEnvironment; import org.tensorflow.Operand; -import org.tensorflow.framework.initializers.Initializer; -import org.tensorflow.framework.metrics.impl.MetricVariable; import org.tensorflow.op.Op; import org.tensorflow.op.Ops; -import org.tensorflow.op.core.Variable; import org.tensorflow.types.family.TNumber; -import java.util.*; -import java.util.stream.Collectors; +import java.util.Collections; +import java.util.List; /** * Base class for Metrics @@ -34,12 +30,8 @@ */ public abstract class Metric { - /** variables are stored by ExecutionEnvironment, and then by an identifier name */ - protected static Map>> - variableMap = new WeakHashMap<>(); /** The TensorFlow Ops */ private final Ops tf; - /** The random number generator seed value */ private final long seed; /** The name for this metric. Defaults to {@link Class#getSimpleName()}. */ @@ -70,7 +62,7 @@ protected Metric(Ops tf, String name, long seed) { } this.seed = seed; this.name = name != null ? name : this.getClass().getSimpleName(); - this.tf = tf.withSubScope(this.name); + this.tf = tf.withName(this.getClass().getSimpleName()); } /** @@ -139,6 +131,13 @@ public final Op updateState( */ public abstract Operand result(Ops tf); + /** + * Resets any state variables to their initial values + * + * @return the control operation for doing the reset + */ + public abstract Op resetStates(); + /** * Gets the current result of the metric using the metric's {@link #getTF()} * @@ -161,36 +160,6 @@ public final Operand callOnce(Operand values, Operand sampleWeights) { return result(ltf); } - /** - * Adds a variable to collect metric values - * - * @param varName the name for the variable - * @param variable the variable - * @param initializer the initializer for the variable, if null, then the default for floating - * point types is {@link org.tensorflow.framework.initializers.Glorot} with distribution - * {@link org.tensorflow.framework.initializers.VarianceScaling.Distribution#UNIFORM}, for - * other types the default initializer is {@link org.tensorflow.framework.initializers.Zeros} - * @param the date type for the variable - */ - protected void addVariable( - String varName, Variable variable, Initializer initializer) { - Map> variables = - variableMap.computeIfAbsent(tf.scope().env(), k -> new HashMap<>()); - variables.put(varName, new MetricVariable<>(tf, variable, initializer, seed, variable.type())); - } - - /** - * Gets the list of added variables - * - * @return the list of added variables - */ - public List> getVariables() { - List> result = new ArrayList<>(); - Map> variables = variableMap.get(tf.scope().env()); - if (variables != null) variables.values().forEach(mv -> result.add(mv.getVariable())); - return result; - } - /** * Gets a formatted name for a variable, in the form {@link #name} + "_" + varName. * @@ -201,71 +170,6 @@ protected String getVariableName(String varName) { return String.format("%s_%s", this.name, varName); } - /** - * Gets an Operation that initializes the variables. - * - * @param subScopeName the sub scope name - * @return the Operation used to initialize the variables. - */ - public Op initialize(String subScopeName) { - - List initializeOperations = initializeVarsList(subScopeName); - return tf.withControlDependencies(initializeOperations).noOp(); - } - - /** - * Gets the list of Operations that initializes the variables - * - * @param subScopeName the sub scope name - * @return the list of Operations that initializes the variables - */ - @SuppressWarnings("unchecked") - private List initializeVarsList(String subScopeName) { - Map> variables = variableMap.get(tf.scope().env()); - if (variables != null) - return variables.values().stream() - .map(metricVariable -> variableAssign(subScopeName, metricVariable)) - .collect(Collectors.toList()); - else return Collections.EMPTY_LIST; - } - - /** - * Resets all variables to their initial state - * - * @return An Operation that sets all variables to their initial state - */ - public Op resetStates() { - return initialize("resetStates"); - } - - /** - * Assigns a value to a Variable - * - *

This assumes the variable has already been initialized - * - * @param subScopeName the subscope for creating the variable - * @param mv the metric value used to assign the initializer to the variable. - * @return the variable add operation with necessary control dependencies - */ - private Operand variableAssign( - String subScopeName, MetricVariable mv) { - return tf.withSubScope(subScopeName).assign(mv.getVariable(), mv.initialize()); - } - - /** - * Gets a stored variable by name, Variables are cached first by the TensorFlow Environment, then - * by a variable name. - * - * @param varName the name assigned to the variable - * @return the variable, or null if the variable is not found. - */ - public Variable getVariable(String varName) { - Map> variables = variableMap.get(tf.scope().env()); - if (variables == null) return null; - MetricVariable mv = variables.get(varName); - return mv != null ? mv.getVariable() : null; - } - /** * Gets the TensorFlow Ops * @@ -283,4 +187,9 @@ public Ops getTF() { public String getName() { return name; } + + /** The random number generator seed value */ + public long getSeed() { + return seed; + } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index 3ec6540779c..2c387cc152e 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -15,7 +15,6 @@ package org.tensorflow.framework.metrics.impl; import org.tensorflow.Operand; -import org.tensorflow.framework.initializers.Zeros; import org.tensorflow.framework.losses.impl.LossTuple; import org.tensorflow.framework.losses.impl.LossesHelper; import org.tensorflow.framework.metrics.Metric; @@ -50,7 +49,6 @@ public abstract class Reduce extends Metri /** the variable that holds the count of the metric values */ protected Variable count; - protected boolean initialized; /** * Creates a Reducible Metric with a metric reductions of {@link MetricReduction#SUM} @@ -81,25 +79,33 @@ protected Reduce(Ops tf, String name, MetricReduction reduction, long seed, Clas this.type = type; setupVars(); } - /** initialize the Variables */ - @SuppressWarnings("unchecked") + /** Initializes the Variables */ private void setupVars() { - Zeros fZeros = new Zeros<>(getTF()); - total = (Variable) getVariable(totalName); if (total == null) { - total = getTF().withSubScope(totalName).variable(Shape.scalar(), type); - addVariable(totalName, total, fZeros); + total = getTF().withName(totalName).variable(Shape.scalar(), type); } if (reduction == MetricReduction.SUM_OVER_BATCH_SIZE || reduction == MetricReduction.WEIGHTED_MEAN) { - count = (Variable) getVariable(countName); if (count == null) { - count = getTF().withSubScope(countName).variable(Shape.scalar(), type); - addVariable(countName, count, fZeros); + count = getTF().withName(countName).variable(Shape.scalar(), type); } } } + /** {@inheritDoc} */ + public Op resetStates() { + List controls = new ArrayList<>(); + if (total != null) { + controls.add( + getTF().assign(total, CastHelper.cast(getTF(), getTF().constant(0), total.type()))); + } + if (count != null) { + controls.add( + getTF().assign(count, CastHelper.cast(getTF(), getTF().constant(0), count.type()))); + } + return getTF().withControlDependencies(controls).noOp(); + } + /** * Updates the metric variables based on the inputs. At least one input arg required for * values, an optional additional input for the sampleWeights @@ -110,7 +116,7 @@ private void setupVars() { * @throws IllegalArgumentException if values is null */ @Override - public List updateStateList(Operand values, Operand sampleWeights) { + public List updateStateList(Operand values, Operand sampleWeights) { if (values == null) { throw new IllegalArgumentException("values is required."); @@ -136,7 +142,6 @@ public List updateStateList(Operand values, Operand sampleWeights) { .math .mul(lValues, lSampleWeights); } catch (IllegalArgumentException ex) { - System.out.println("Reduce: Fall back from broadcast"); // reduce the values down to the rank of the samples int nDim = lValues.shape().numDimensions(); int wDim = lSampleWeights.shape().numDimensions(); @@ -224,8 +229,10 @@ public Variable getCount() { return count; } - /** Gets the type for the variables - * @return the type for the variables + /** + * Gets the type for the variables + * + * @return the type for the variables */ public Class getType() { return type; From 10977223cba413db3014e84124fda839046a2631 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Thu, 7 Jan 2021 17:16:31 -0500 Subject: [PATCH 08/60] reformat code --- .../src/main/java/org/tensorflow/framework/metrics/Metric.java | 1 + .../main/java/org/tensorflow/framework/metrics/impl/Reduce.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index a6f2cf0f26d..9efb3dde20a 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -32,6 +32,7 @@ public abstract class Metric { /** The TensorFlow Ops */ private final Ops tf; + private final long seed; /** The name for this metric. Defaults to {@link Class#getSimpleName()}. */ diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index 2c387cc152e..f304ad04cb4 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -49,7 +49,6 @@ public abstract class Reduce extends Metri /** the variable that holds the count of the metric values */ protected Variable count; - /** * Creates a Reducible Metric with a metric reductions of {@link MetricReduction#SUM} * From bc0f4687663e7c71e8853de17c6aa2cdf6235e88 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 11 Jan 2021 18:02:27 -0500 Subject: [PATCH 09/60] Add tests for assertBroadcastable --- .../framework/metrics/impl/MetricsHelper.java | 49 ++- .../metrics/impl/WeightBroadcastTest.java | 335 ++++++++++++++++++ 2 files changed, 365 insertions(+), 19 deletions(-) create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index 9699ccd323c..5ecc06a388f 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -18,6 +18,7 @@ import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Op; import org.tensorflow.op.Ops; +import org.tensorflow.op.core.SetDiff1d; import org.tensorflow.op.math.Mean; import org.tensorflow.types.TBool; import org.tensorflow.types.TFloat32; @@ -30,7 +31,6 @@ import java.util.List; import static org.tensorflow.framework.losses.impl.LossesHelper.allAxes; -import static org.tensorflow.framework.utils.CastHelper.cast; /** * These are helper methods for Metrics and will be module private when Java modularity is applied @@ -42,7 +42,12 @@ public class MetricsHelper { "weights can not be broadcast to values."; /** - * Asserts that the sampleWeights can be broadcast to values + * Asserts that the sampleWeights can be broadcast to the same shape as values + * + * + *

In losses and metrics, limited weight broadcasting is supported. Weights be either scalar, + * or the same rank as the target values, with each dimension either 1, or the same as the + * corresponding values dimension. * * @param tf the TensorFlow Ops * @param sampleWeights the sample weights. @@ -54,9 +59,10 @@ public class MetricsHelper { * incorrect shape that prohibit broadcasting to to values */ @SuppressWarnings("unchecked") - public static Op broadcastWeights( + public static Op assertBroadcastable( Ops tf, Operand sampleWeights, Operand values) { + // try static check for exact match Operand weightsShape = tf.shape(sampleWeights); Operand weightsRank = tf.rank(sampleWeights); Shape weightsShapeStatic = sampleWeights.shape(); @@ -67,9 +73,9 @@ public static Op broadcastWeights( Shape valuesShapeStatic = values.shape(); int valuesRankStatic = valuesShapeStatic.numDimensions(); - if (weightsRankStatic != -1 && valuesRankStatic != -1) { + if (weightsRankStatic != Shape.UNKNOWN_SIZE && valuesRankStatic != Shape.UNKNOWN_SIZE) { if (weightsRankStatic == 0) { - return tf.withSubScope("static_scalar_check_success") + return tf.withSubScope("staticScalarCheckSuccess") .withControlDependencies(Collections.EMPTY_LIST) .noOp(); } @@ -85,7 +91,7 @@ public static Op broadcastWeights( } for (int i = 0; i < valuesRankStatic; i++) { - if (valuesShapeStatic.size(i) != weightsShapeStatic.size(i)) { + if (valuesShapeStatic.size(i) != weightsShapeStatic.size(i) && weightsShapeStatic.size(i) != 1) { throw new IllegalArgumentException( String.format( "%s Mismatch at dim %d. values.shape=%s weights.shape=%s.", @@ -95,12 +101,12 @@ public static Op broadcastWeights( weightsShapeStatic.toString())); } } - return tf.withSubScope("static_dims_check_success") + return tf.withSubScope("staticDimsCheckSuccess") .withControlDependencies(Collections.EMPTY_LIST) .noOp(); } // Dynamic checks. - Operand is_scalar = tf.math.equal(weightsRank, tf.constant(0)); + Operand isScalar = tf.math.equal(weightsRank, tf.constant(0)); List> data = Arrays.asList( tf.constant(ASSERT_BROADCAST_ERROR_PREFIX), @@ -108,14 +114,13 @@ public static Op broadcastWeights( weightsShape, tf.constant("values.shape="), valuesShape, - tf.constant("is_scalar="), - is_scalar); + tf.constant("isScalar="), + isScalar); + + Operand validNonsclar = + hasValidNonscalarShape(tf, weightsRank, weightsShape, valuesRank, valuesShape); - Operand isValidShape = - tf.select( - is_scalar, - is_scalar, - hasValidNonscalarShape(tf, weightsRank, weightsShape, valuesRank, valuesShape)); + Operand isValidShape = tf.select(isScalar, isScalar, validNonsclar); return tf.withSubScope("broadcastWeights-dynamic").assertThat(isValidShape, data); } @@ -137,7 +142,7 @@ private static Operand hasValidNonscalarShape( Operand weightsShape, Operand valuesRank, Operand valuesShape) { - tf = tf.withSubScope("has_valid_nonscalar_shape"); + tf = tf.withSubScope("hasValidNonscalarShape"); Operand isSameRank = tf.math.equal(valuesRank, weightsRank); return tf.select(isSameRank, hasValidDims(tf, weightsShape, valuesShape), isSameRank); } @@ -153,9 +158,15 @@ private static Operand hasValidNonscalarShape( */ private static Operand hasValidDims( Ops tf, Operand weightsShape, Operand valuesShape) { - tf = tf.withSubScope("has_invalid_dims"); - Operand diff = tf.reduceSum(tf.math.sub(weightsShape, valuesShape), tf.constant(0)); - return tf.math.equal(cast(tf, tf.constant(0), diff.asOutput().type()), diff); + tf = tf.withSubScope("hasValidDims"); + Operand valuesShape2d = tf.expandDims(valuesShape, tf.constant(-1)); + Operand validDims = + tf.concat(Arrays.asList(valuesShape2d, tf.onesLike(valuesShape2d)), tf.constant(1)); + SetDiff1d invalidDimsDiff = + tf.setDiff1d(tf.shape.flatten(valuesShape2d), tf.shape.flatten(validDims)); + Operand invalidDims = invalidDimsDiff.out(); + Operand numInvalidDims = tf.size(invalidDims); + return tf.math.equal(tf.constant(0), numInvalidDims); } // alias for mean diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java new file mode 100644 index 00000000000..c89cff93dc2 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java @@ -0,0 +1,335 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.Tensor; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.op.Op; +import org.tensorflow.op.Ops; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TNumber; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class WeightBroadcastTest { + + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + private void testValid( + TestSession testSession, Ops tf, Operand weights, Operand values, Class type) { + + Op staticOp = MetricsHelper.assertBroadcastable(tf, weights, values); + testSession.run(staticOp); + + // dynamic test + Operand weightsPlaceholder = tf.placeholder(type); + Operand valuesPlaceholder = tf.placeholder(type); + + List tensors = + testSession.getGraphSession().runner().fetch(weights).fetch(values).run(); + try (Tensor weightsTensor = tensors.get(0); + Tensor valuesTensor = tensors.get(1)) { + + Op dynamicOp = MetricsHelper.assertBroadcastable(tf, weightsPlaceholder, valuesPlaceholder); + + testSession + .getGraphSession() + .runner() + .feed(weightsPlaceholder, weightsTensor) + .feed(valuesPlaceholder, valuesTensor) + .addTarget(dynamicOp) + .run(); + } + } + + @Test + public void testValidScalar() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new float[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(5f); + testValid(testSession, tf, weights, values, TFloat32.class); + } + } + + @Test + public void test1x1x1() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new double[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new double[][][] {{{5}}}); + testValid(testSession, tf, weights, values, TFloat64.class); + } + } + + @Test + public void test1x1xN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new long[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new long[][][] {{{5, 7, 11, 3}}}); + testValid(testSession, tf, weights, values, TInt64.class); + } + } + + @Test + public void test1xNx1() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][][] {{{5}, {11}}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + } + + @Test + public void test1xNxN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][][] {{{5, 7, 11, 3}, {2, 13, 7, 5}}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + } + + @Test + public void testNx1x1() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][][] {{{5}}, {{7}}, {{11}}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + } + + @Test + public void testNx1xN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = + tf.constant(new int[][][] {{{5, 7, 11, 3}}, {{2, 12, 7, 5}}, {{2, 17, 11, 3}}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + } + + @Test + public void testNxNxN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = + tf.constant( + new int[][][] { + {{5, 7, 11, 3}, {2, 12, 7, 5}}, + {{2, 17, 11, 3}, {2, 17, 11, 3}}, + {{5, 7, 11, 3}, {2, 12, 7, 5}} + }); + testValid(testSession, tf, weights, values, TInt32.class); + } + } + + @Test + public void testInvalid1x1() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][] {{5}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); + } + + @Test + public void testInvalidPrefixMatch() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][] {{5, 7}, {11, 3}, {2, 12}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); + } + + @Test + public void testInvalidSuffixMatch() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][] {{5, 7, 11, 3}, {2, 12, 7, 5}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); + } + + @Test + public void testInvalidOnesExtraDim() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][][][] {{{{5}}}} ); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); + } + + @Test + public void testInvalidPrefixMatchExtraDim() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + + Operand weights = tf.constant(new int[][][][] { + {{ { 5},{ 7}, {11}, { 3}}, {{ 2}, {12}, { 7}, { 5}} }, + {{ { 2}, {17}, {11}, { 3}}, {{ 2}, {17}, {11}, { 3}} }, + {{ { 5}, { 7}, {11}, { 3}}, {{ 2}, {12}, { 7}, { 5}} } + }); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); + } + + @Test + public void testInvalidSuffixMatchExtraDim() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][][][] {{ + { { 5, 7, 11, 3}, { 2, 12, 7, 5} }, + { { 2, 17, 11, 3}, { 2, 17, 11, 3} }, + { { 5, 7, 11, 3}, { 2, 12, 7, 5} } + }}); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); + } +} From 41876d54eaf7424ee5ba0ec1155d011ac75341f8 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 11 Jan 2021 18:41:00 -0500 Subject: [PATCH 10/60] Change type to resultType --- .../tensorflow/framework/metrics/impl/MeanMetricWrapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index cd17e2a9de4..173167c5370 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -94,8 +94,8 @@ public List updateStateList( throw new IllegalArgumentException("missing required inputs for labels and predictions"); } - Operand tLabels = CastHelper.cast(getTF(), labels, getType()); - Operand tPredictions = CastHelper.cast(getTF(), predictions, getType()); + Operand tLabels = CastHelper.cast(getTF(), labels, getResultType()); + Operand tPredictions = CastHelper.cast(getTF(), predictions, getResultType()); Operand losses = loss.call(tLabels, tPredictions); From 61af528dc39c36aa60e4e5c29d5d0df630c0569b Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 11 Jan 2021 18:42:18 -0500 Subject: [PATCH 11/60] Added V data type for sampleWeights so that it is not forced to be the same type as the return or internal variables, --- .../tensorflow/framework/metrics/Metric.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 9efb3dde20a..123abae61d7 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -76,7 +76,7 @@ protected Metric(Ops tf, String name, long seed) { * @return a List of Operations to update the metric state */ @SuppressWarnings({"unchecked", "unused"}) - public List updateStateList(Operand values, Operand sampleWeights) { + public List updateStateList(Operand values, Operand sampleWeights) { return Collections.EMPTY_LIST; } @@ -88,7 +88,7 @@ public List updateStateList(Operand values, Operand sampleWeights) { * @param labels the labels * @param predictions the predictions * @param sampleWeights sample weights to be applied to values, may be null. - * @param the data type for the sample weights + * @param the data type for the labels * @return a List of Operations to update the metric state */ @SuppressWarnings({"unchecked", "unused"}) @@ -104,7 +104,7 @@ public List updateStateList( * @param sampleWeights sample weights to be applied to values, may be null. * @return the Operation to update the metric state */ - public final Op updateState(Operand values, Operand sampleWeights) { + public final Op updateState(Operand values, Operand sampleWeights) { List controlOps = updateStateList(values, sampleWeights); return tf.withSubScope("updateState").withControlDependencies(controlOps).noOp(); } @@ -115,7 +115,7 @@ public final Op updateState(Operand values, Operand sampleWeights) { * @param labels the labels * @param predictions the predictions * @param sampleWeights sample weights to be applied to values, may be null. - * @param the data type for the sample weights + * @param the data type for the labels * @return the Operation to update the metric state */ public final Op updateState( @@ -127,10 +127,9 @@ public final Op updateState( /** * Gets the current result of the metric * - * @param tf the TensorFlow Ops used to create the result * @return the result, possibly with control dependencies */ - public abstract Operand result(Ops tf); + public abstract Operand result(); /** * Resets any state variables to their initial values @@ -139,14 +138,6 @@ public final Op updateState( */ public abstract Op resetStates(); - /** - * Gets the current result of the metric using the metric's {@link #getTF()} - * - * @return the result, possibly with control dependencies - */ - public Operand result() { - return result(this.tf); - } /** * Calls update state once, followed by a call to get the result @@ -158,7 +149,7 @@ public Operand result() { public final Operand callOnce(Operand values, Operand sampleWeights) { List controlOps = updateStateList(values, sampleWeights); Ops ltf = tf.withSubScope("callOnce").withControlDependencies(controlOps); - return result(ltf); + return ltf.identity(result()); } /** From c121c075b613294f48ebff9f334c60d19e23ee69 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 11 Jan 2021 18:42:49 -0500 Subject: [PATCH 12/60] change 'type' to 'resultType' --- .../framework/metrics/impl/Reduce.java | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index f304ad04cb4..fb8e39f3f1f 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -43,7 +43,7 @@ public abstract class Reduce extends Metri private final String totalName; private final String countName; - private final Class type; + private final Class resultType; /** the variable that holds the total of the metric values */ protected Variable total; /** the variable that holds the count of the metric values */ @@ -56,10 +56,10 @@ public abstract class Reduce extends Metri * @param name the name for this metric. If null, name defaults to {@link Class#getSimpleName()}. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. - * @param type the type for the variables and result + * @param resultType the type for the variables and result */ - protected Reduce(Ops tf, String name, long seed, Class type) { - this(tf, name, MetricReduction.SUM, seed, type); + protected Reduce(Ops tf, String name, long seed, Class resultType) { + this(tf, name, MetricReduction.SUM, seed, resultType); } /** @@ -68,25 +68,25 @@ protected Reduce(Ops tf, String name, long seed, Class type) { * @param reduction The type of metric reduction to apply * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. - * @param type the type for the variables and result + * @param resultType the type for the variables and result */ - protected Reduce(Ops tf, String name, MetricReduction reduction, long seed, Class type) { + protected Reduce(Ops tf, String name, MetricReduction reduction, long seed, Class resultType) { super(tf, name, seed); this.reduction = reduction; this.totalName = this.getVariableName(TOTAL); this.countName = this.getVariableName(COUNT); - this.type = type; + this.resultType = resultType; setupVars(); } /** Initializes the Variables */ private void setupVars() { if (total == null) { - total = getTF().withName(totalName).variable(Shape.scalar(), type); + total = getTF().withName(totalName).variable(Shape.scalar(), resultType); } if (reduction == MetricReduction.SUM_OVER_BATCH_SIZE || reduction == MetricReduction.WEIGHTED_MEAN) { if (count == null) { - count = getTF().withName(countName).variable(Shape.scalar(), type); + count = getTF().withName(countName).variable(Shape.scalar(), resultType); } } } @@ -115,7 +115,7 @@ public Op resetStates() { * @throws IllegalArgumentException if values is null */ @Override - public List updateStateList(Operand values, Operand sampleWeights) { + public List updateStateList(Operand values, Operand sampleWeights) { if (values == null) { throw new IllegalArgumentException("values is required."); @@ -133,7 +133,7 @@ public List updateStateList(Operand values, Operand sampleWeights) { lSampleWeights = tuple.getSampleWeights(); try { - Op broadcastWeightsCheck = MetricsHelper.broadcastWeights(getTF(), lSampleWeights, lValues); + Op broadcastWeightsCheck = MetricsHelper.assertBroadcastable(getTF(), lSampleWeights, lValues); lValues = getTF() .withSubScope("broadcastWeightsCheck") @@ -141,16 +141,20 @@ public List updateStateList(Operand values, Operand sampleWeights) { .math .mul(lValues, lSampleWeights); } catch (IllegalArgumentException ex) { - // reduce the values down to the rank of the samples - int nDim = lValues.shape().numDimensions(); - int wDim = lSampleWeights.shape().numDimensions(); - int numAxes = nDim - wDim; - int[] axes = new int[numAxes]; - for (int i = 0; i < numAxes; i++) axes[i] = i + wDim; - if (reduction == MetricReduction.SUM) { - lValues = getTF().reduceSum(lValues, getTF().constant(axes)); - } else { - lValues = getTF().math.mean(lValues, getTF().constant(axes)); + // if we get here we have static shapes with either + // different ranks or different dimension sizes. + // first, reduce the values down to the rank of the samples + int valuesDim = lValues.shape().numDimensions(); + int weightsDim = lSampleWeights.shape().numDimensions(); + int numAxes = Math.min(0, valuesDim - weightsDim); + if (numAxes > 0) { // values rank is greater than weights rank, reduce values to weights rank. + int[] axes = new int[numAxes]; + for (int i = 0; i < numAxes; i++) axes[i] = i + weightsDim; + if (reduction == MetricReduction.SUM) { + lValues = getTF().reduceSum(lValues, getTF().constant(axes)); + } else { + lValues = getTF().math.mean(lValues, getTF().constant(axes)); + } } lValues = getTF().math.mul(lValues, lSampleWeights); } @@ -164,18 +168,18 @@ public List updateStateList(Operand values, Operand sampleWeights) { if (reduction != MetricReduction.SUM) { switch (reduction) { case SUM_OVER_BATCH_SIZE: - numValues = CastHelper.cast(getTF(), getTF().constant(lValues.shape().size()), type); + numValues = CastHelper.cast(getTF(), getTF().constant(lValues.shape().size()), resultType); break; case WEIGHTED_MEAN: if (lSampleWeights == null) { - numValues = CastHelper.cast(getTF(), getTF().constant(lValues.shape().size()), type); + numValues = CastHelper.cast(getTF(), getTF().constant(lValues.shape().size()), resultType); } else { numValues = CastHelper.cast( getTF(), getTF() .reduceSum(lSampleWeights, LossesHelper.allAxes(getTF(), lSampleWeights)), - type); + resultType); } break; default: @@ -192,16 +196,16 @@ public List updateStateList(Operand values, Operand sampleWeights) { /** {@inheritDoc} */ @Override - public Operand result(Ops rtf) { + public Operand result() { Operand fResult; switch (this.reduction) { case SUM: - fResult = rtf.identity(total); + fResult = getTF().identity(total); break; case WEIGHTED_MEAN: case SUM_OVER_BATCH_SIZE: - fResult = rtf.math.divNoNan(total, CastHelper.cast(rtf, count, type)); + fResult = getTF().math.divNoNan(total, CastHelper.cast(getTF(), count, resultType)); break; default: throw new UnsupportedOperationException( @@ -233,7 +237,7 @@ public Variable getCount() { * * @return the type for the variables */ - public Class getType() { - return type; + public Class getResultType() { + return resultType; } } From e9ee98f5abdb9ced1dc46d6248c4bfb84586c643 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 11 Jan 2021 18:43:43 -0500 Subject: [PATCH 13/60] clean up mean and fix assert assertBroadcastable --- .../framework/metrics/impl/MetricsHelper.java | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index 5ecc06a388f..eb7c1fbd221 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -23,6 +23,7 @@ import org.tensorflow.types.TBool; import org.tensorflow.types.TFloat32; import org.tensorflow.types.TInt32; +import org.tensorflow.types.family.TIntegral; import org.tensorflow.types.family.TNumber; import org.tensorflow.types.family.TType; @@ -91,7 +92,8 @@ public static Op assertBroadcastable( } for (int i = 0; i < valuesRankStatic; i++) { - if (valuesShapeStatic.size(i) != weightsShapeStatic.size(i) && weightsShapeStatic.size(i) != 1) { + if (valuesShapeStatic.size(i) != weightsShapeStatic.size(i) + && weightsShapeStatic.size(i) != 1) { throw new IllegalArgumentException( String.format( "%s Mismatch at dim %d. values.shape=%s weights.shape=%s.", @@ -152,7 +154,7 @@ private static Operand hasValidNonscalarShape( * * @param tf the TensorFlow Ops * @param weightsShape the operand for the shape of the sample weights - * @param valuesShape the operand for the shape of the sample weights + * @param valuesShape the operand for the shape of the values * @param the data type for the operands * @return a boolean operand to determine if the shapes have valid dimensions or not. */ @@ -163,7 +165,7 @@ private static Operand hasValidDims( Operand validDims = tf.concat(Arrays.asList(valuesShape2d, tf.onesLike(valuesShape2d)), tf.constant(1)); SetDiff1d invalidDimsDiff = - tf.setDiff1d(tf.shape.flatten(valuesShape2d), tf.shape.flatten(validDims)); + tf.setDiff1d(weightsShape, tf.shape.flatten(validDims)); Operand invalidDims = invalidDimsDiff.out(); Operand numInvalidDims = tf.size(invalidDims); return tf.math.equal(tf.constant(0), numInvalidDims); @@ -178,9 +180,10 @@ private static Operand hasValidDims( * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean * @param the type of the Operand. + * @param the data type for the result * @return the mean of the operand */ - public static Operand mean(Ops tf, Operand x) { + public static Operand mean(Ops tf, Operand x) { return mean(tf, x, null, false); } @@ -190,58 +193,63 @@ public static Operand mean(Ops tf, Operand x) { * * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean - * @param axis Axes to compute the mean. + * @param axes Axes to compute the mean. * @param the type of the Operand. - * @param the type of the axis. - * @return the mean of the operand, alongside the specified axis. + * @param the type of the axes. + * @param the data type for the result + * @return the mean of the operand, along the specified axes. */ - public static Operand mean( - Ops tf, Operand x, Operand axis) { - return mean(tf, x, axis, false); + public static Operand mean( + Ops tf, Operand x, Operand axes) { + return mean(tf, x, axes, false); } /** - * Calculate the mean of the operand, along all axis. + * Calculate the mean of the operand, along all axes. * * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean * @param keepDims Indicates whether to keep the dimensions or not. If keepdims is - * false, the rank of the tensor is reduced by 1 for each entry in axis + * false, the rank of the tensor is reduced by 1 for each entry in axes * . If keepdims is true, the reduced dimensions are retained * with length 1. * @param the type of the operand + * @param the data type for the result * @return the mean of elements of x. */ - public static Operand mean(Ops tf, Operand x, boolean keepDims) { + public static Operand mean( + Ops tf, Operand x, boolean keepDims) { return mean(tf, x, null, keepDims); } /** - * Calculate the mean of the operand, alongside the specified axis. + * Calculate the mean of the operand, alongside the specified axes. * * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean - * @param axis Axes to compute the mean. + * @param axes Axes to compute the mean. * @param keepDims Indicates whether to keep the dimensions or not. If `keepdims` is `false`, the - * * rank of the tensor is reduced by 1 for each entry in `axis`. If `keepdims` is `true`, the + * * rank of the tensor is reduced by 1 for each entry in `axes`. If `keepdims` is `true`, the * * reduced dimensions are retained with length 1. * @param the data type of the Operand - * @param the data type of the axis + * @param the data type of the axes + * @param the data type for the result * @return the mean of elements of `x`. */ @SuppressWarnings({"unchecked", "rawtypes"}) - public static Operand mean( - Ops tf, Operand x, Operand axis, boolean keepDims) { + public static Operand mean( + Ops tf, Operand x, Operand axes, boolean keepDims) { // Cannot use generics here because xf may change from TBool to TFloat32 - Operand xf; - if (x.asOutput().type() == TBool.class) { - xf = tf.dtypes.cast(x, TFloat32.class); + Operand xf; + if (x.type().equals(TBool.class)) { + xf = (Operand) tf.dtypes.cast(x, TFloat32.class); } else { - xf = x; + xf = (Operand) x; } - if (axis == null) { - axis = allAxes(tf, xf); + if (axes == null) { + axes = (Operand) allAxes(tf, xf); } - return tf.math.mean(xf, axis, Mean.keepDims(keepDims)); + Operand theMean = tf.math.mean(xf, axes, Mean.keepDims(keepDims)); + return x.type().equals(TBool.class) ? tf.dtypes.cast(theMean, TBool.class) : theMean; } } From 9788983b58ec23e7a545442d9d6ae969de4d9c3e Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 11 Jan 2021 18:44:07 -0500 Subject: [PATCH 14/60] fix error message --- .../org/tensorflow/framework/metrics/impl/MetricVariable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java index c5c5dbb2ab2..aae5a8f30c4 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java @@ -79,7 +79,7 @@ public MetricVariable( } else { throw new IllegalArgumentException( String.format( - "Type %s is not a supported for metric variables", + "Type %s is not supported for metric variables", type.getSimpleName())); } } else { From 8857a663ec3135dde3167e523d3ef55a41b6cdef Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Tue, 12 Jan 2021 18:19:07 -0500 Subject: [PATCH 15/60] Change sampleWeights to have its own generic type --- .../org/tensorflow/framework/metrics/Metric.java | 16 ++++++++++------ .../metrics/impl/MeanMetricWrapper.java | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 123abae61d7..20151eb1408 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -74,9 +74,10 @@ protected Metric(Ops tf, String name, long seed) { * @param values the inputs to be passed to update state, this may not be null * @param sampleWeights sample weights to be applied to values, may be null. * @return a List of Operations to update the metric state + * @param the data type for sampleWeights */ @SuppressWarnings({"unchecked", "unused"}) - public List updateStateList(Operand values, Operand sampleWeights) { + public List updateStateList(Operand values, Operand sampleWeights) { return Collections.EMPTY_LIST; } @@ -89,11 +90,12 @@ public List updateStateList(Operand values, Operand the data type for the labels + * @param the data type for the sampleWeights * @return a List of Operations to update the metric state */ @SuppressWarnings({"unchecked", "unused"}) - public List updateStateList( - Operand labels, Operand predictions, Operand sampleWeights) { + public List updateStateList( + Operand labels, Operand predictions, Operand sampleWeights) { return Collections.EMPTY_LIST; } @@ -102,9 +104,10 @@ public List updateStateList( * * @param values the inputs to be passed to update state, this may not be null * @param sampleWeights sample weights to be applied to values, may be null. + * @param the data type for sampleWeights * @return the Operation to update the metric state */ - public final Op updateState(Operand values, Operand sampleWeights) { + public final Op updateState(Operand values, Operand sampleWeights) { List controlOps = updateStateList(values, sampleWeights); return tf.withSubScope("updateState").withControlDependencies(controlOps).noOp(); } @@ -116,10 +119,11 @@ public final Op updateState(Operand values, Operand sa * @param predictions the predictions * @param sampleWeights sample weights to be applied to values, may be null. * @param the data type for the labels + * @param the data type for the sampleWeights * @return the Operation to update the metric state */ - public final Op updateState( - Operand labels, Operand predictions, Operand sampleWeights) { + public final Op updateState( + Operand labels, Operand predictions, Operand sampleWeights) { List controlOps = updateStateList(labels, predictions, sampleWeights); return tf.withSubScope("updateState").withControlDependencies(controlOps).noOp(); } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index 173167c5370..98447142da6 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -86,10 +86,11 @@ protected void setLoss(LossMetric loss) { * predictions is scaled by the corresponding value of sampleWeights. (Note on dN-1: all loss * functions reduce by 1 dimension, usually axis=-1.) * @param the datatype of the predictions + * @param the data type for sampleWeights * @return a List of control operations that updates the Mean state variables. */ - public List updateStateList( - Operand labels, Operand predictions, Operand sampleWeights) { + public List updateStateList( + Operand labels, Operand predictions, Operand sampleWeights) { if (labels == null || predictions == null) { throw new IllegalArgumentException("missing required inputs for labels and predictions"); } From 34a779fcecbc02c50ca419953e8072b326ba0216 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Tue, 12 Jan 2021 18:19:56 -0500 Subject: [PATCH 16/60] Add commment about invalid tests expecting IllegalArgumentExceptions --- .../metrics/impl/WeightBroadcastTest.java | 118 ++++++++++-------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java index c89cff93dc2..08e19f82a89 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java @@ -204,8 +204,14 @@ public void testNxNxN() { } } + // Note: For invalid tests, either NotBroadcastableException is thrown for static shapes or + // TFInvalidInvalidException is thrown for dynamic shapes. Both of these extend + // IllegalArgumentException, + // To simply the assertThrows, only IllegalArgumentException is expected. + // The private method, testValid, tests for both static and dynamic shapes. @Test public void testInvalid1x1() { + assertThrows( IllegalArgumentException.class, () -> { @@ -267,69 +273,75 @@ public void testInvalidSuffixMatch() { @Test public void testInvalidOnesExtraDim() { assertThrows( - IllegalArgumentException.class, - () -> { - try (TestSession testSession = TestSession.createTestSession(tfMode)) { - Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); - Operand weights = tf.constant(new int[][][][] {{{{5}}}} ); - testValid(testSession, tf, weights, values, TInt32.class); - } - }); + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = tf.constant(new int[][][][] {{{{5}}}}); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); } @Test public void testInvalidPrefixMatchExtraDim() { assertThrows( - IllegalArgumentException.class, - () -> { - try (TestSession testSession = TestSession.createTestSession(tfMode)) { - Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); - Operand weights = tf.constant(new int[][][][] { - {{ { 5},{ 7}, {11}, { 3}}, {{ 2}, {12}, { 7}, { 5}} }, - {{ { 2}, {17}, {11}, { 3}}, {{ 2}, {17}, {11}, { 3}} }, - {{ { 5}, { 7}, {11}, { 3}}, {{ 2}, {12}, { 7}, { 5}} } - }); - testValid(testSession, tf, weights, values, TInt32.class); - } - }); + Operand weights = + tf.constant( + new int[][][][] { + {{{5}, {7}, {11}, {3}}, {{2}, {12}, {7}, {5}}}, + {{{2}, {17}, {11}, {3}}, {{2}, {17}, {11}, {3}}}, + {{{5}, {7}, {11}, {3}}, {{2}, {12}, {7}, {5}}} + }); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); } @Test public void testInvalidSuffixMatchExtraDim() { assertThrows( - IllegalArgumentException.class, - () -> { - try (TestSession testSession = TestSession.createTestSession(tfMode)) { - Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); - Operand weights = tf.constant(new int[][][][] {{ - { { 5, 7, 11, 3}, { 2, 12, 7, 5} }, - { { 2, 17, 11, 3}, { 2, 17, 11, 3} }, - { { 5, 7, 11, 3}, { 2, 12, 7, 5} } - }}); - testValid(testSession, tf, weights, values, TInt32.class); - } - }); + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = + tf.constant( + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }); + Operand weights = + tf.constant( + new int[][][][] { + { + {{5, 7, 11, 3}, {2, 12, 7, 5}}, + {{2, 17, 11, 3}, {2, 17, 11, 3}}, + {{5, 7, 11, 3}, {2, 12, 7, 5}} + } + }); + testValid(testSession, tf, weights, values, TInt32.class); + } + }); } } From 748f16d30b519c7339170c430f3e3b73e2f6cc44 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Tue, 12 Jan 2021 18:20:39 -0500 Subject: [PATCH 17/60] Add this exception instead of the more generic IllegalArgumentException when static shapes cannot boradcast. --- .../exceptions/NotBroadcastableException.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java new file mode 100644 index 00000000000..73f07b977c2 --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java @@ -0,0 +1,50 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.exceptions; + +import org.tensorflow.ndarray.Shape; + +/** + * Exception that indicates that static shapes are not able to broadcast among each other during arithmetic operations. + * Static shapes do not have unknown rank or any unknown dimensions {@link Shape#hasUnknownDimension()}. + * The term broadcasting describes how TensorFlow treats arrays with different shapes during arithmetic operations. + * + *

Broadcasting is the process of making arrays to have compatible shapes for arithmetic + * operations. Two shapes are compatible if for each dimension pair they are either equal or one of + * them is one. When trying to broadcast a Tensor to a shape, it starts with the trailing + * dimensions, and works its way forward. + * + * + * @see Numpy Broadcasting + */ +public class NotBroadcastableException extends IllegalArgumentException { + + /** + * Creates a new NotBroadcastableException exception with the specified detail message + * @param message the detail message. + */ + public NotBroadcastableException(String message) { + super(message); + } + + /** + * Creates a new NotBroadcastableException exception with the specified detail message + * @param message the detail message. + * @param cause the cause + */ + public NotBroadcastableException(String message, Throwable cause) { + super(message, cause); + } +} From 212541be36260dd4edc5acc5033c32999db816bb Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Tue, 12 Jan 2021 18:22:51 -0500 Subject: [PATCH 18/60] change IllegalArgumentException to NotBroadcastableException. change hasValidNonscalarShape to canBroadcastNonscalarShapes change hasValidNonscalarShape to canBroadcastNonscalarShapes --- .../framework/metrics/impl/MetricsHelper.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index eb7c1fbd221..b25a03b07c9 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -15,6 +15,7 @@ package org.tensorflow.framework.metrics.impl; import org.tensorflow.Operand; +import org.tensorflow.framework.metrics.exceptions.NotBroadcastableException; import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Op; import org.tensorflow.op.Ops; @@ -56,8 +57,8 @@ public class MetricsHelper { * @return Operation with control dependencies to ensure sampleWeight * can be broadcast to values * @param the type of Operand - * @throws IllegalArgumentException If static checks determine sampleWeights has an - * incorrect shape that prohibit broadcasting to to values + * @throws NotBroadcastableException If static checks determine sampleWeights has an + * incorrect shape that prohibit broadcasting to values */ @SuppressWarnings("unchecked") public static Op assertBroadcastable( @@ -81,7 +82,7 @@ public static Op assertBroadcastable( .noOp(); } if (weightsRankStatic != valuesRankStatic) { - throw new IllegalArgumentException( + throw new NotBroadcastableException( String.format( "%s values.rank=%d. weights.rank=%d. values.shape=%s. weights.shape=%s.", ASSERT_BROADCAST_ERROR_PREFIX, @@ -94,7 +95,7 @@ public static Op assertBroadcastable( for (int i = 0; i < valuesRankStatic; i++) { if (valuesShapeStatic.size(i) != weightsShapeStatic.size(i) && weightsShapeStatic.size(i) != 1) { - throw new IllegalArgumentException( + throw new NotBroadcastableException( String.format( "%s Mismatch at dim %d. values.shape=%s weights.shape=%s.", ASSERT_BROADCAST_ERROR_PREFIX, @@ -120,7 +121,7 @@ public static Op assertBroadcastable( isScalar); Operand validNonsclar = - hasValidNonscalarShape(tf, weightsRank, weightsShape, valuesRank, valuesShape); + canBroadcastNonscalarShapes(tf, weightsRank, weightsShape, valuesRank, valuesShape); Operand isValidShape = tf.select(isScalar, isScalar, validNonsclar); @@ -138,7 +139,7 @@ public static Op assertBroadcastable( * @param the data type for the operands * @return a boolean operand to determine if the Shape is scalar or not. */ - private static Operand hasValidNonscalarShape( + private static Operand canBroadcastNonscalarShapes( Ops tf, Operand weightsRank, Operand weightsShape, @@ -146,7 +147,7 @@ private static Operand hasValidNonscalarShape( Operand valuesShape) { tf = tf.withSubScope("hasValidNonscalarShape"); Operand isSameRank = tf.math.equal(valuesRank, weightsRank); - return tf.select(isSameRank, hasValidDims(tf, weightsShape, valuesShape), isSameRank); + return tf.select(isSameRank, canBroadcastDims(tf, weightsShape, valuesShape), isSameRank); } /** @@ -158,7 +159,7 @@ private static Operand hasValidNonscalarShape( * @param the data type for the operands * @return a boolean operand to determine if the shapes have valid dimensions or not. */ - private static Operand hasValidDims( + private static Operand canBroadcastDims( Ops tf, Operand weightsShape, Operand valuesShape) { tf = tf.withSubScope("hasValidDims"); Operand valuesShape2d = tf.expandDims(valuesShape, tf.constant(-1)); From f0d72d22143a788b4fe77eeb4334320ea6c949d2 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Tue, 12 Jan 2021 18:23:58 -0500 Subject: [PATCH 19/60] reformat code --- .../org/tensorflow/framework/metrics/Metric.java | 1 - .../org/tensorflow/framework/metrics/Metrics.java | 4 ++-- .../exceptions/NotBroadcastableException.java | 10 ++++++---- .../framework/metrics/impl/MeanMetricWrapper.java | 2 +- .../framework/metrics/impl/MetricVariable.java | 7 +++---- .../framework/metrics/impl/MetricsHelper.java | 7 +++---- .../tensorflow/framework/metrics/impl/Reduce.java | 14 +++++++++----- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 20151eb1408..57e332a0843 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -142,7 +142,6 @@ public final Op updateState( */ public abstract Op resetStates(); - /** * Calls update state once, followed by a call to get the result * diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java index b8e79efa450..e2cd5e368c2 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -117,8 +117,8 @@ public static Operand l2Normalize(Ops tf, Operand x, i * @param tf The TensorFlow ops * @param x The operand to normalize * @param axes Dimension(s) along which to normalize. - * @param epsilon A lower bound value for the norm. Will use sqrt(epsilon) as the divisor if - * norm < sqrt(epsilon). + * @param epsilon A lower bound value for the norm. Will use sqrt(epsilon) as the + * divisor if norm < sqrt(epsilon). * @param The data type for the values. * @return the normalized values of x. */ diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java index 73f07b977c2..66640e72f50 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/exceptions/NotBroadcastableException.java @@ -17,22 +17,23 @@ import org.tensorflow.ndarray.Shape; /** - * Exception that indicates that static shapes are not able to broadcast among each other during arithmetic operations. - * Static shapes do not have unknown rank or any unknown dimensions {@link Shape#hasUnknownDimension()}. - * The term broadcasting describes how TensorFlow treats arrays with different shapes during arithmetic operations. + * Exception that indicates that static shapes are not able to broadcast among each other during + * arithmetic operations. Static shapes do not have unknown rank or any unknown dimensions {@link + * Shape#hasUnknownDimension()}. The term broadcasting describes how TensorFlow treats arrays with + * different shapes during arithmetic operations. * *

Broadcasting is the process of making arrays to have compatible shapes for arithmetic * operations. Two shapes are compatible if for each dimension pair they are either equal or one of * them is one. When trying to broadcast a Tensor to a shape, it starts with the trailing * dimensions, and works its way forward. * - * * @see Numpy Broadcasting */ public class NotBroadcastableException extends IllegalArgumentException { /** * Creates a new NotBroadcastableException exception with the specified detail message + * * @param message the detail message. */ public NotBroadcastableException(String message) { @@ -41,6 +42,7 @@ public NotBroadcastableException(String message) { /** * Creates a new NotBroadcastableException exception with the specified detail message + * * @param message the detail message. * @param cause the cause */ diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index 98447142da6..e2f1345f356 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -89,7 +89,7 @@ protected void setLoss(LossMetric loss) { * @param the data type for sampleWeights * @return a List of control operations that updates the Mean state variables. */ - public List updateStateList( + public List updateStateList( Operand labels, Operand predictions, Operand sampleWeights) { if (labels == null || predictions == null) { throw new IllegalArgumentException("missing required inputs for labels and predictions"); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java index aae5a8f30c4..6b208c0d7bf 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java @@ -61,7 +61,8 @@ public MetricVariable(Ops tf, Variable variable, long seed, Class type) { * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. * @param type the type for the variable - * @throws IllegalArgumentException if the type does not inherit from TNumber and the initializer is null + * @throws IllegalArgumentException if the type does not inherit from TNumber and the initializer + * is null */ @SuppressWarnings("unchecked") public MetricVariable( @@ -78,9 +79,7 @@ public MetricVariable( this.initializer = new Zeros<>(tf); } else { throw new IllegalArgumentException( - String.format( - "Type %s is not supported for metric variables", - type.getSimpleName())); + String.format("Type %s is not supported for metric variables", type.getSimpleName())); } } else { this.initializer = initializer; diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index b25a03b07c9..05bfe17a1be 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -58,7 +58,7 @@ public class MetricsHelper { * can be broadcast to values * @param the type of Operand * @throws NotBroadcastableException If static checks determine sampleWeights has an - * incorrect shape that prohibit broadcasting to values + * incorrect shape that prohibit broadcasting to values */ @SuppressWarnings("unchecked") public static Op assertBroadcastable( @@ -121,7 +121,7 @@ public static Op assertBroadcastable( isScalar); Operand validNonsclar = - canBroadcastNonscalarShapes(tf, weightsRank, weightsShape, valuesRank, valuesShape); + canBroadcastNonscalarShapes(tf, weightsRank, weightsShape, valuesRank, valuesShape); Operand isValidShape = tf.select(isScalar, isScalar, validNonsclar); @@ -165,8 +165,7 @@ private static Operand canBroadcastDims( Operand valuesShape2d = tf.expandDims(valuesShape, tf.constant(-1)); Operand validDims = tf.concat(Arrays.asList(valuesShape2d, tf.onesLike(valuesShape2d)), tf.constant(1)); - SetDiff1d invalidDimsDiff = - tf.setDiff1d(weightsShape, tf.shape.flatten(validDims)); + SetDiff1d invalidDimsDiff = tf.setDiff1d(weightsShape, tf.shape.flatten(validDims)); Operand invalidDims = invalidDimsDiff.out(); Operand numInvalidDims = tf.size(invalidDims); return tf.math.equal(tf.constant(0), numInvalidDims); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index fb8e39f3f1f..6e1795af2eb 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -133,7 +133,8 @@ public List updateStateList(Operand values, Operand List updateStateList(Operand values, Operand 0) { // values rank is greater than weights rank, reduce values to weights rank. + if (numAxes + > 0) { // values rank is greater than weights rank, reduce values to weights rank. int[] axes = new int[numAxes]; for (int i = 0; i < numAxes; i++) axes[i] = i + weightsDim; if (reduction == MetricReduction.SUM) { @@ -168,18 +170,20 @@ public List updateStateList(Operand values, Operand Date: Wed, 13 Jan 2021 07:07:26 -0500 Subject: [PATCH 20/60] Fis=x Javadoc move the dynamic shapes and rank down to the dynamic section so they are created needlessly when static Fix if statement to check for unknown size and unknown dimensions --- .../framework/metrics/impl/MetricsHelper.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index 05bfe17a1be..00af7a6d1af 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -47,8 +47,8 @@ public class MetricsHelper { * Asserts that the sampleWeights can be broadcast to the same shape as values * * - *

In losses and metrics, limited weight broadcasting is supported. Weights be either scalar, - * or the same rank as the target values, with each dimension either 1, or the same as the + *

In losses and metrics, limited weight broadcasting is supported. Weights must be either + * scalar, or the same rank as the target values, with each dimension either 1, or the same as the * corresponding values dimension. * * @param tf the TensorFlow Ops @@ -65,17 +65,17 @@ public static Op assertBroadcastable( Ops tf, Operand sampleWeights, Operand values) { // try static check for exact match - Operand weightsShape = tf.shape(sampleWeights); - Operand weightsRank = tf.rank(sampleWeights); + Shape weightsShapeStatic = sampleWeights.shape(); int weightsRankStatic = weightsShapeStatic.numDimensions(); - Operand valuesShape = tf.shape(values); - Operand valuesRank = tf.rank(values); Shape valuesShapeStatic = values.shape(); int valuesRankStatic = valuesShapeStatic.numDimensions(); - if (weightsRankStatic != Shape.UNKNOWN_SIZE && valuesRankStatic != Shape.UNKNOWN_SIZE) { + // if (weightsRankStatic != Shape.UNKNOWN_SIZE && valuesRankStatic != Shape.UNKNOWN_SIZE) { + if (!weightsShapeStatic.isUnknown() + && !valuesShapeStatic.isUnknown() + && !weightsShapeStatic.hasUnknownDimension() & !valuesShapeStatic.hasUnknownDimension()) { if (weightsRankStatic == 0) { return tf.withSubScope("staticScalarCheckSuccess") .withControlDependencies(Collections.EMPTY_LIST) @@ -109,6 +109,11 @@ public static Op assertBroadcastable( .noOp(); } // Dynamic checks. + Operand weightsShape = tf.shape(sampleWeights); + Operand weightsRank = tf.rank(sampleWeights); + Operand valuesShape = tf.shape(values); + Operand valuesRank = tf.rank(values); + Operand isScalar = tf.math.equal(weightsRank, tf.constant(0)); List> data = Arrays.asList( From 20c6e98ccaed33556dd5d9992a05c1affd00923a Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Sun, 17 Jan 2021 13:00:06 -0500 Subject: [PATCH 21/60] Fix Reduce to use boradcastWeights, renamed WeightBroadcastTest to AssertBroadcastableTest and added BroadcastWeightsTest --- .../tensorflow/framework/metrics/Metric.java | 5 +- .../framework/metrics/impl/MetricsHelper.java | 31 +- .../framework/metrics/impl/Reduce.java | 26 +- ...Test.java => AssertBroadcastableTest.java} | 140 ++----- .../metrics/impl/BroadcastWeightsTest.java | 380 ++++++++++++++++++ .../framework/utils/GraphTestSession.java | 12 +- .../framework/utils/TestSession.java | 29 ++ 7 files changed, 498 insertions(+), 125 deletions(-) rename tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/{WeightBroadcastTest.java => AssertBroadcastableTest.java} (68%) create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/BroadcastWeightsTest.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java index 57e332a0843..bbb2aa73da2 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metric.java @@ -33,6 +33,7 @@ public abstract class Metric { /** The TensorFlow Ops */ private final Ops tf; + /** The seed for random number generation */ private final long seed; /** The name for this metric. Defaults to {@link Class#getSimpleName()}. */ @@ -148,8 +149,10 @@ public final Op updateState( * @param values the inputs to be passed to update state, this may not be null * @param sampleWeights sample weights to be applied to values, may be null. * @return the result, possibly with control dependencies + * @param the data type for the sampleWeights. */ - public final Operand callOnce(Operand values, Operand sampleWeights) { + public final Operand callOnce( + Operand values, Operand sampleWeights) { List controlOps = updateStateList(values, sampleWeights); Ops ltf = tf.withSubScope("callOnce").withControlDependencies(controlOps); return ltf.identity(result()); diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index 00af7a6d1af..fbe50151854 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -75,7 +75,8 @@ public static Op assertBroadcastable( // if (weightsRankStatic != Shape.UNKNOWN_SIZE && valuesRankStatic != Shape.UNKNOWN_SIZE) { if (!weightsShapeStatic.isUnknown() && !valuesShapeStatic.isUnknown() - && !weightsShapeStatic.hasUnknownDimension() & !valuesShapeStatic.hasUnknownDimension()) { + && !weightsShapeStatic.hasUnknownDimension() + && !valuesShapeStatic.hasUnknownDimension()) { if (weightsRankStatic == 0) { return tf.withSubScope("staticScalarCheckSuccess") .withControlDependencies(Collections.EMPTY_LIST) @@ -176,6 +177,34 @@ private static Operand canBroadcastDims( return tf.math.equal(tf.constant(0), numInvalidDims); } + /** + * Broadcast `weights` to the same shape as `values`. + * + * @param tf the TensorFlow ops + * @param weights `Tensor` whose shape is broadcastable to `values` + * @param values Tensor` of any shape + * @param the type of Operands + * @return weights broadcast to values shape + */ + public static Operand broadcastWeights( + Ops tf, Operand weights, Operand values) { + + Shape weightsShape = weights.shape(); + Shape valuesShape = values.shape(); + + if (!weightsShape.hasUnknownDimension() + && !valuesShape.hasUnknownDimension() + && weightsShape.isCompatibleWith(valuesShape)) { + return weights; + } + + Ops ctf = + tf.withSubScope("broadcastWeights") + .withControlDependencies( + Collections.singletonList(assertBroadcastable(tf, weights, tf.onesLike(values)))); + return ctf.math.mul(weights, tf.onesLike(values)); + } + // alias for mean /** diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index 6e1795af2eb..771f4804dea 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -27,7 +27,6 @@ import org.tensorflow.types.family.TNumber; import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -132,39 +131,32 @@ public List updateStateList(Operand values, Operand 0) { // values rank is greater than weights rank, reduce values to weights rank. int[] axes = new int[numAxes]; - for (int i = 0; i < numAxes; i++) axes[i] = i + weightsDim; + for (int i = 0; i < numAxes; i++) axes[i] = i + weightsRank; if (reduction == MetricReduction.SUM) { lValues = getTF().reduceSum(lValues, getTF().constant(axes)); } else { lValues = getTF().math.mean(lValues, getTF().constant(axes)); } } - lValues = getTF().math.mul(lValues, lSampleWeights); } + lValues = getTF().math.mul(lValues, lSampleWeights); } - Operand valueSum = getTF().reduceSum(lValues, LossesHelper.allAxes(getTF(), lValues)); + Operand weightedValueSum = + getTF().reduceSum(lValues, LossesHelper.allAxes(getTF(), lValues)); Operand totalUpdate = - getTF().assignAdd(total, CastHelper.cast(getTF(), valueSum, total.type())); + getTF().assignAdd(total, CastHelper.cast(getTF(), weightedValueSum, total.type())); updateOperations.add(totalUpdate); Operand numValues; if (reduction != MetricReduction.SUM) { diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java similarity index 68% rename from tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java rename to tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java index 08e19f82a89..af4a89692d1 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/WeightBroadcastTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java @@ -30,15 +30,39 @@ import static org.junit.jupiter.api.Assertions.assertThrows; -public class WeightBroadcastTest { +public class AssertBroadcastableTest { private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + int[][][] valueArrayI = + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + long[][][] valueArrayL = + new long[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + float[][][] valueArrayF = + new float[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + double[][][] valueArrayD = + new double[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + private void testValid( TestSession testSession, Ops tf, Operand weights, Operand values, Class type) { Op staticOp = MetricsHelper.assertBroadcastable(tf, weights, values); - testSession.run(staticOp); // dynamic test Operand weightsPlaceholder = tf.placeholder(type); @@ -66,13 +90,7 @@ public void testValidScalar() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new float[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayF); Operand weights = tf.constant(5f); testValid(testSession, tf, weights, values, TFloat32.class); } @@ -83,13 +101,7 @@ public void test1x1x1() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new double[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayD); Operand weights = tf.constant(new double[][][] {{{5}}}); testValid(testSession, tf, weights, values, TFloat64.class); } @@ -100,13 +112,7 @@ public void test1x1xN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new long[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayL); Operand weights = tf.constant(new long[][][] {{{5, 7, 11, 3}}}); testValid(testSession, tf, weights, values, TInt64.class); } @@ -117,13 +123,7 @@ public void test1xNx1() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5}, {11}}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -134,13 +134,7 @@ public void test1xNxN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5, 7, 11, 3}, {2, 13, 7, 5}}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -151,13 +145,7 @@ public void testNx1x1() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5}}, {{7}}, {{11}}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -168,13 +156,7 @@ public void testNx1xN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5, 7, 11, 3}}, {{2, 12, 7, 5}}, {{2, 17, 11, 3}}}); testValid(testSession, tf, weights, values, TInt32.class); @@ -186,13 +168,7 @@ public void testNxNxN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant( new int[][][] { @@ -217,13 +193,7 @@ public void testInvalid1x1() { () -> { try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][] {{5}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -237,13 +207,7 @@ public void testInvalidPrefixMatch() { () -> { try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][] {{5, 7}, {11, 3}, {2, 12}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -257,13 +221,7 @@ public void testInvalidSuffixMatch() { () -> { try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][] {{5, 7, 11, 3}, {2, 12, 7, 5}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -277,13 +235,7 @@ public void testInvalidOnesExtraDim() { () -> { try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][][] {{{{5}}}}); testValid(testSession, tf, weights, values, TInt32.class); } @@ -297,13 +249,7 @@ public void testInvalidPrefixMatchExtraDim() { () -> { try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant( @@ -324,13 +270,7 @@ public void testInvalidSuffixMatchExtraDim() { () -> { try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); - Operand values = - tf.constant( - new int[][][] { - {{1, 2, 3, 4}, {5, 6, 7, 8}}, - {{9, 10, 11, 12}, {13, 14, 15, 16}}, - {{17, 18, 19, 20}, {21, 22, 23, 24}} - }); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant( new int[][][][] { diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/BroadcastWeightsTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/BroadcastWeightsTest.java new file mode 100644 index 00000000000..3322a81fe5b --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/BroadcastWeightsTest.java @@ -0,0 +1,380 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.Tensor; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.op.Ops; +import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; +import org.tensorflow.types.family.TNumber; + +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class BroadcastWeightsTest { + private final TestSession.Mode tfMode = TestSession.Mode.GRAPH; + + int[][][] valueArrayI = + new int[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + long[][][] valueArrayL = + new long[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + float[][][] valueArrayF = + new float[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + double[][][] valueArrayD = + new double[][][] { + {{1, 2, 3, 4}, {5, 6, 7, 8}}, + {{9, 10, 11, 12}, {13, 14, 15, 16}}, + {{17, 18, 19, 20}, {21, 22, 23, 24}} + }; + + private void testValid( + TestSession testSession, + Ops tf, + Operand weights, + Operand values, + Number[] expected, // flattened array + Class type) { + + Operand staticOp = MetricsHelper.broadcastWeights(tf, weights, values); + if (expected != null) { + testSession.evaluate(expected, staticOp); + } else { + testSession.run(staticOp); + } + + // dynamic test + Operand weightsPlaceholder = tf.placeholder(type); + Operand valuesPlaceholder = tf.placeholder(type); + + List tensors = + testSession.getGraphSession().runner().fetch(weights).fetch(values).run(); + try (Tensor weightsTensor = tensors.get(0); + Tensor valuesTensor = tensors.get(1)) { + + Operand dynamicOp = + MetricsHelper.broadcastWeights(tf, weightsPlaceholder, valuesPlaceholder); + + List result = + testSession + .getGraphSession() + .runner() + .feed(weightsPlaceholder, weightsTensor) + .feed(valuesPlaceholder, valuesTensor) + .fetch(dynamicOp) + .run(); + + if (expected != null) { + if (type.equals(TInt32.class)) { + TInt32 intT = (TInt32) result.get(0); + AtomicInteger i = new AtomicInteger(); + intT.scalars() + .forEachIndexed( + (idx, f) -> assertEquals(expected[i.getAndIncrement()].intValue(), f.getInt())); + } else if (type.equals(TInt64.class)) { + TInt64 floatT = (TInt64) result.get(0); + AtomicInteger i = new AtomicInteger(); + floatT + .scalars() + .forEachIndexed( + (idx, f) -> assertEquals(expected[i.getAndIncrement()].longValue(), f.getLong())); + } else if (type.equals(TFloat32.class)) { + TFloat32 floatT = (TFloat32) result.get(0); + AtomicInteger i = new AtomicInteger(); + floatT + .scalars() + .forEachIndexed( + (idx, f) -> + assertEquals( + expected[i.getAndIncrement()].floatValue(), f.getFloat(), 1e-5F)); + } else if (type.equals(TFloat64.class)) { + TFloat64 doubleT = (TFloat64) result.get(0); + AtomicInteger i = new AtomicInteger(); + doubleT + .scalars() + .forEachIndexed( + (idx, f) -> + assertEquals( + expected[i.getAndIncrement()].doubleValue(), f.getDouble(), 1e-5F)); + } + } + } + } + + @Test + public void testValidScalar() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayF); + Operand weights = tf.constant(5f); + Float[] expected = { + 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, + 5f + }; + testValid(testSession, tf, weights, values, expected, TFloat32.class); + } + } + + @Test + public void test1x1x1() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayD); + Operand weights = tf.constant(new double[][][] {{{5}}}); + Double[] expected = { + 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., 5., + 5. + }; + + testValid(testSession, tf, weights, values, expected, TFloat64.class); + } + } + + @Test + public void test1x1xN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayL); + Operand weights = tf.constant(new long[][][] {{{5, 7, 11, 3}}}); + Long[] expected = { + 5L, 7L, 11L, 3L, 5L, 7L, 11L, 3L, 5L, 7L, 11L, 3L, 5L, 7L, 11L, 3L, 5L, 7L, 11L, 3L, 5L, 7L, + 11L, 3L, + }; + testValid(testSession, tf, weights, values, expected, TInt64.class); + } + } + + @Test + public void test1xNx1() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][][] {{{5}, {11}}}); + Integer[] expected = { + 5, 5, 5, 5, 11, 11, 11, 11, 5, 5, 5, 5, 11, 11, 11, 11, 5, 5, 5, 5, 11, 11, 11, 11 + }; + testValid(testSession, tf, weights, values, expected, TInt32.class); + } + } + + @Test + public void test1xNxN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][][] {{{5, 7, 11, 3}, {2, 13, 7, 5}}}); + Integer[] expected = { + 5, 7, 11, 3, 2, 13, 7, 5, 5, 7, 11, 3, 2, 13, 7, 5, 5, 7, 11, 3, 2, 13, 7, 5, + }; + testValid(testSession, tf, weights, values, expected, TInt32.class); + } + } + + @Test + public void testNx1x1() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][][] {{{5}}, {{7}}, {{11}}}); + Integer[] expected = { + 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 11, 11, 11, 11, 11, 11, 11, 11 + }; + testValid(testSession, tf, weights, values, expected, TInt32.class); + } + } + + @Test + public void testNx1xN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = + tf.constant(new int[][][] {{{5, 7, 11, 3}}, {{2, 12, 7, 5}}, {{2, 17, 11, 3}}}); + Integer[] expected = { + 5, 7, 11, 3, 5, 7, 11, 3, 2, 12, 7, 5, 2, 12, 7, 5, 2, 17, 11, 3, 2, 17, 11, 3 + }; + testValid(testSession, tf, weights, values, expected, TInt32.class); + } + } + + @Test + public void testNxNxN() { + // no exception should be thrown + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + + Operand weights = + tf.constant( + new int[][][] { + {{5, 7, 11, 3}, {2, 12, 7, 5}}, + {{2, 17, 11, 3}, {2, 17, 11, 3}}, + {{5, 7, 11, 3}, {2, 12, 7, 5}} + }); + Integer[] expected = { + 5, 7, 11, 3, 2, 12, 7, 5, 2, 17, 11, 3, 2, 17, 11, 3, 5, 7, 11, 3, 2, 12, 7, 5 + }; + testValid(testSession, tf, weights, values, expected, TInt32.class); + } + } + + // Note: For invalid tests, either NotBroadcastableException is thrown for static shapes or + // TFInvalidInvalidException is thrown for dynamic shapes. Both of these extend + // IllegalArgumentException, + // To simply the assertThrows, only IllegalArgumentException is expected. + // The private method, testValid, tests for both static and dynamic shapes. + @Test + public void testInvalid1() { + + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[] {5}); + + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } + + @Test + public void testInvalid1x1() { + + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][] {{5}}); + + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } + + @Test + public void testInvalidPrefixMatch() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][] {{5, 7}, {11, 3}, {2, 12}}); + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } + + @Test + public void testInvalidSuffixMatch() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][] {{5, 7, 11, 3}, {2, 12, 7, 5}}); + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } + + @Test + public void testInvalidOnesExtraDim() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = tf.constant(new int[][][][] {{{{5}}}}); + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } + + @Test + public void testInvalidPrefixMatchExtraDim() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + + Operand weights = + tf.constant( + new int[][][][] { + {{{5}, {7}, {11}, {3}}, {{2}, {12}, {7}, {5}}}, + {{{2}, {17}, {11}, {3}}, {{2}, {17}, {11}, {3}}}, + {{{5}, {7}, {11}, {3}}, {{2}, {12}, {7}, {5}}} + }); + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } + + @Test + public void testInvalidSuffixMatchExtraDim() { + assertThrows( + IllegalArgumentException.class, + () -> { + try (TestSession testSession = TestSession.createTestSession(tfMode)) { + Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); + Operand weights = + tf.constant( + new int[][][][] { + { + {{5, 7, 11, 3}, {2, 12, 7, 5}}, + {{2, 17, 11, 3}, {2, 17, 11, 3}}, + {{5, 7, 11, 3}, {2, 12, 7, 5}} + } + }); + testValid(testSession, tf, weights, values, null, TInt32.class); + } + }); + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java index 33c4e064e69..8e401c21627 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java @@ -1025,7 +1025,7 @@ public void print(PrintWriter writer, Output input) { (TFloat64)this.getGraphSession().runner().fetch(input).run().get(0)) { if (isScalar) { writer.printf( - "%d). %f\n", index.getAndIncrement(), ((Output) input).asTensor().getDouble()); + "%d). %f\n", index.getAndIncrement(), result.getDouble()); } else { result .scalars() @@ -1040,7 +1040,7 @@ public void print(PrintWriter writer, Output input) { (TInt32)this.getGraphSession().runner().fetch(input).run().get(0)) { if (isScalar) { writer.printf( - "%d). %d\n", index.getAndIncrement(), ((Output) input).asTensor().getInt()); + "%d). %d\n", index.getAndIncrement(),result.getInt()); } else { result .scalars() @@ -1055,7 +1055,7 @@ public void print(PrintWriter writer, Output input) { (TInt64)this.getGraphSession().runner().fetch(input).run().get(0)) { if (isScalar) { writer.printf( - "%d). %d\n", index.getAndIncrement(), ((Output) input).asTensor().getLong()); + "%d). %d\n", index.getAndIncrement(), result.getLong()); } else { result .scalars() @@ -1070,7 +1070,7 @@ public void print(PrintWriter writer, Output input) { (TUint8)this.getGraphSession().runner().fetch(input).run().get(0)) { if (isScalar) { writer.printf( - "%d). %x\n", index.getAndIncrement(), ((Output) input).asTensor().getByte()); + "%d). %x\n", index.getAndIncrement(), result.getByte()); } else { result .scalars() @@ -1085,7 +1085,7 @@ public void print(PrintWriter writer, Output input) { (TBool)this.getGraphSession().runner().fetch(input).run().get(0)) { if (isScalar) { writer.printf( - "%d). %b\n", index.getAndIncrement(), ((Output) input).asTensor().getBoolean()); + "%d). %b\n", index.getAndIncrement(), result.getBoolean()); } else { result .scalars() @@ -1100,7 +1100,7 @@ public void print(PrintWriter writer, Output input) { (TString)this.getGraphSession().runner().fetch(input).run().get(0)) { if (isScalar) { writer.printf( - "%d). %s\n", index.getAndIncrement(), ((Output) input).asTensor().getObject()); + "%d). %s\n", index.getAndIncrement(), result.getObject()); } else { result .scalars() diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/TestSession.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/TestSession.java index 3fccd0f0506..db39a330522 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/TestSession.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/TestSession.java @@ -492,6 +492,16 @@ public void evaluate(FloatNdArray input, Predicate predicate) { input.scalars().forEach(f -> assertTrue(predicate.test(f.getFloat()))); } + /** + * Print the input to standard out + * + + * @param input the operand to print + * @param the data type of the input + */ + public void print(Operand input) { + print(new PrintWriter(new OutputStreamWriter(System.out)), input.asOutput()); + } /** * Print the input * @@ -503,6 +513,15 @@ public void print(OutputStream out, Operand input) { print(new PrintWriter(new OutputStreamWriter(out)), input.asOutput()); } + /** + * Print the input to standard out + * + * @param input the op to print + */ + public void print(Op input) { + print(new PrintWriter(new OutputStreamWriter(System.out)), input.op().output(0)); + } + /** * Print the input * @@ -513,6 +532,16 @@ public void print(OutputStream out, Op input) { print(new PrintWriter(new OutputStreamWriter(out)), input.op().output(0)); } + /** + * Print the input to standard out + * + * @param input the op to print + * @param the data type of the input + */ + public void print(Output input) { + print(new PrintWriter(new OutputStreamWriter(System.out)), input); + } + /** * Print the input * From d3d7ee98a58e4d8fcea11136ebc7aa9ea2d09b23 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Sun, 17 Jan 2021 13:09:32 -0500 Subject: [PATCH 22/60] Added comment to count to indicate that it may be weighted. --- .../java/org/tensorflow/framework/metrics/impl/Reduce.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java index 771f4804dea..8e48cb4e573 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/Reduce.java @@ -45,7 +45,8 @@ public abstract class Reduce extends Metri private final Class resultType; /** the variable that holds the total of the metric values */ protected Variable total; - /** the variable that holds the count of the metric values */ + /** the variable that holds the count of the metric values. + * For {@link MetricReduction#WEIGHTED_MEAN}, this count may be weighted */ protected Variable count; /** From fe86b0b003834528e2b3a2d22621e3919ebe0f2c Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 18 Jan 2021 20:22:24 -0500 Subject: [PATCH 23/60] Added SetsOps and fixed AssertBroadcastable to use SetsOps methods, --- .../framework/metrics/impl/MetricsHelper.java | 127 +++++++++++----- .../framework/metrics/impl/SetsOps.java | 141 ++++++++++++++++++ .../metrics/impl/AssertBroadcastableTest.java | 7 +- .../framework/metrics/impl/SetsOpsTest.java | 110 ++++++++++++++ .../framework/utils/GraphTestSession.java | 22 ++- 5 files changed, 364 insertions(+), 43 deletions(-) create mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/SetsOps.java create mode 100644 tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/SetsOpsTest.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java index fbe50151854..ad8ff58e417 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricsHelper.java @@ -19,10 +19,10 @@ import org.tensorflow.ndarray.Shape; import org.tensorflow.op.Op; import org.tensorflow.op.Ops; -import org.tensorflow.op.core.SetDiff1d; import org.tensorflow.op.math.Mean; import org.tensorflow.types.TBool; import org.tensorflow.types.TFloat32; +import org.tensorflow.types.TFloat64; import org.tensorflow.types.TInt32; import org.tensorflow.types.family.TIntegral; import org.tensorflow.types.family.TNumber; @@ -33,6 +33,7 @@ import java.util.List; import static org.tensorflow.framework.losses.impl.LossesHelper.allAxes; +import static org.tensorflow.framework.utils.CastHelper.cast; /** * These are helper methods for Metrics and will be module private when Java modularity is applied @@ -126,10 +127,17 @@ public static Op assertBroadcastable( tf.constant("isScalar="), isScalar); - Operand validNonsclar = + // hack to work around the non-lazy select for isValidShape, otherwise validNonscalar fails on a + // scalar weight. If select was lazy, that branch wouldn't get executed when iScalar is true. + Operand reshapedWeights = + tf.select(isScalar, tf.math.mul(sampleWeights, tf.onesLike(values)), sampleWeights); + weightsShape = tf.shape(reshapedWeights); + weightsRank = tf.rank(reshapedWeights); + + Operand validNonscalar = canBroadcastNonscalarShapes(tf, weightsRank, weightsShape, valuesRank, valuesShape); - Operand isValidShape = tf.select(isScalar, isScalar, validNonsclar); + Operand isValidShape = tf.select(isScalar, isScalar, validNonscalar); return tf.withSubScope("broadcastWeights-dynamic").assertThat(isValidShape, data); } @@ -151,7 +159,7 @@ private static Operand canBroadcastNonscalarShapes( Operand weightsShape, Operand valuesRank, Operand valuesShape) { - tf = tf.withSubScope("hasValidNonscalarShape"); + tf = tf.withSubScope("canBroadcastNonscalarShapes"); Operand isSameRank = tf.math.equal(valuesRank, weightsRank); return tf.select(isSameRank, canBroadcastDims(tf, weightsShape, valuesShape), isSameRank); } @@ -167,22 +175,23 @@ private static Operand canBroadcastNonscalarShapes( */ private static Operand canBroadcastDims( Ops tf, Operand weightsShape, Operand valuesShape) { - tf = tf.withSubScope("hasValidDims"); + tf = tf.withSubScope("canBroadcastDims"); Operand valuesShape2d = tf.expandDims(valuesShape, tf.constant(-1)); Operand validDims = tf.concat(Arrays.asList(valuesShape2d, tf.onesLike(valuesShape2d)), tf.constant(1)); - SetDiff1d invalidDimsDiff = tf.setDiff1d(weightsShape, tf.shape.flatten(validDims)); - Operand invalidDims = invalidDimsDiff.out(); - Operand numInvalidDims = tf.size(invalidDims); + Operand weightsShape2D = tf.expandDims(weightsShape, tf.constant(-1)); + + Operand diffResult = SetsOps.difference(tf, weightsShape2D, validDims); + Operand numInvalidDims = tf.size(diffResult); return tf.math.equal(tf.constant(0), numInvalidDims); } /** - * Broadcast `weights` to the same shape as `values`. + * Broadcast weights to the same shape as values. * * @param tf the TensorFlow ops - * @param weights `Tensor` whose shape is broadcastable to `values` - * @param values Tensor` of any shape + * @param weights Operand whose shape is broadcastable to values. + * @param values Operand of any shape * @param the type of Operands * @return weights broadcast to values shape */ @@ -205,7 +214,7 @@ public static Operand broadcastWeights( return ctf.math.mul(weights, tf.onesLike(values)); } - // alias for mean + // aliases for mean /** * Calculate the mean of the operand, along all axes and keepDims is false @@ -214,10 +223,9 @@ public static Operand broadcastWeights( * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean * @param the type of the Operand. - * @param the data type for the result * @return the mean of the operand */ - public static Operand mean(Ops tf, Operand x) { + public static Operand mean(Ops tf, Operand x) { return mean(tf, x, null, false); } @@ -230,16 +238,15 @@ public static Operand mean(Ops tf, Opera * @param axes Axes to compute the mean. * @param the type of the Operand. * @param the type of the axes. - * @param the data type for the result * @return the mean of the operand, along the specified axes. */ - public static Operand mean( + public static Operand mean( Ops tf, Operand x, Operand axes) { return mean(tf, x, axes, false); } /** - * Calculate the mean of the operand, along all axes. + * Calculates the mean of the operand, along all axes. * * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean @@ -248,16 +255,17 @@ public static Operand< * . If keepdims is true, the reduced dimensions are retained * with length 1. * @param the type of the operand - * @param the data type for the result * @return the mean of elements of x. */ - public static Operand mean( + public static Operand mean( Ops tf, Operand x, boolean keepDims) { return mean(tf, x, null, keepDims); } + + /** - * Calculate the mean of the operand, alongside the specified axes. + * Calculates the mean of the operand, alongside the specified axes. * * @param tf the TensorFlow Ops * @param x the Operand used to calculate the mean @@ -267,23 +275,74 @@ public static Operand mean( * * reduced dimensions are retained with length 1. * @param the data type of the Operand * @param the data type of the axes - * @param the data type for the result - * @return the mean of elements of `x`. + * @return the mean of elements of x. */ - @SuppressWarnings({"unchecked", "rawtypes"}) - public static Operand mean( + + public static Operand mean( Ops tf, Operand x, Operand axes, boolean keepDims) { - // Cannot use generics here because xf may change from TBool to TFloat32 - Operand xf; - if (x.type().equals(TBool.class)) { - xf = (Operand) tf.dtypes.cast(x, TFloat32.class); - } else { - xf = (Operand) x; - } if (axes == null) { - axes = (Operand) allAxes(tf, xf); + axes = (Operand) allAxes(tf, x); } - Operand theMean = tf.math.mean(xf, axes, Mean.keepDims(keepDims)); - return x.type().equals(TBool.class) ? tf.dtypes.cast(theMean, TBool.class) : theMean; + return tf.math.mean(x, axes, Mean.keepDims(keepDims)); + } + + /** + * Calculate the mean of the operand, along all axes and keepDims is false + * + * + * @param tf the TensorFlow Ops + * @param x the Operand used to calculate the mean + * @return the mean of the operand containing floating point numbers + */ + public static Operand booleanMean(Ops tf, Operand x) { + return booleanMean(tf, x, null, false); } + + /** + * Calculate the mean of the operand, alongside the specified axis with keepDims is + * false + * + * @param tf the TensorFlow Ops + * @param x the Operand used to calculate the mean + * @param axes Axes to compute the mean. + * @param the type of the axes. + * @return the mean of the operand, along the specified axes, containing floating point numbers + */ + public static Operand booleanMean( + Ops tf, Operand x,Operand axes) { + return booleanMean(tf, x, axes, false); + } + + /** + * Calculates the mean of the boolean operand, alongside all axes. + * + * @param x the boolean Operand used to calculate the mean + * @param keepDims Indicates whether to keep the dimensions or not. If `keepdims` is `false`, the + * * rank of the tensor is reduced by 1 for each entry in `axes`. If `keepdims` is `true`, the + * * reduced dimensions are retained with length 1. + * @param the data type of the axes + * @return the mean of elements of x containing floating point numbers + */ + public static Operand booleanMean( + Ops tf, Operand x, boolean keepDims) { + return booleanMean(tf, x, null, keepDims); + } + + /** + * Calculates the mean of the boolean operand, alongside the specified axes. + * + * @param x the boolean Operand used to calculate the mean + * @param axes Axes to compute the mean. + * @param keepDims Indicates whether to keep the dimensions or not. If `keepdims` is `false`, the + * * rank of the tensor is reduced by 1 for each entry in `axes`. If `keepdims` is `true`, the + * * reduced dimensions are retained with length 1. + * @param the data type of the axes + * @return the mean of elements of x containing floating point numbers + */ + public static Operand booleanMean( + Ops tf, Operand x, Operand axes, boolean keepDims) { + Operand xf = cast(tf, x, TFloat64.class); + return mean(tf, xf, axes, keepDims); + } + } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/SetsOps.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/SetsOps.java new file mode 100644 index 00000000000..236b3d9084d --- /dev/null +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/SetsOps.java @@ -0,0 +1,141 @@ +/* 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. +=======================================================================*/ +package org.tensorflow.framework.metrics.impl; + +import org.tensorflow.Operand; +import org.tensorflow.op.Ops; +import org.tensorflow.op.SparseOps; +import org.tensorflow.op.sparse.DenseToDenseSetOperation; +import org.tensorflow.types.family.TNumber; + +import static org.tensorflow.framework.utils.CastHelper.cast; + +/** Implementation of set operations */ +public class SetsOps { + + /** + * Enumeration containing the string operation values to be passed to the TensorFlow Sparse Ops + * function {@link SparseOps#denseToDenseSetOperation} + */ + public enum Operation { + A_MINUS_B("a-b"), + B_MINUS_A("b-a"), + INTERSECTION("intersection"), + UNION("union"); + + private final String setOperation; + + Operation(String setOperation) { + this.setOperation = setOperation; + } + + /** + * Gets the set operation String value used to pass as the stringOperation value to {@link + * SparseOps#denseToDenseSetOperation} + * + * @return the set operation String value + */ + public String getSetOperation() { + return setOperation; + } + } + + /** + * Computes set difference of elements in last dimension of a and b with + * aMinusB set to true/ + * + *

All but the last dimension of a and b must match + * + * @param tf the TensorFlow Ops + * @param a The first operand representing set a + * @param b The other operand representing set b + * @param the data type for the sets + * @return An Operand with the same rank as a and b, and all but the + * last dimension the * same. Elements along the last dimension contain the results of the set + * operation. + */ + public static Operand difference(Ops tf, Operand a, Operand b) { + return difference(tf, a, b, true); + } + /** + * Computes set difference of elements in last dimension of a and b. + * + *

All but the last dimension of a and b must match + * + * @param tf the TensorFlow Ops + * @param a The first operand representing set a + * @param b The other operand representing set b + * @param aMinusB whether to subtract b from a, vs vice versa. + * @param the data type for the sets + * @return An Operand with the same rank as a and b, and all but the + * last dimension the * same. Elements along the last dimension contain the results of the set + * operation. + */ + public static Operand difference( + Ops tf, Operand a, Operand b, boolean aMinusB) { + return setOperation(tf, a, b, aMinusB ? Operation.A_MINUS_B : Operation.B_MINUS_A); + } + + /** + * Computes set union of elements in last dimension of a and b. + * + * @param tf the TensorFlow Ops + * @param a The first operand representing set a + * @param b The other operand representing set b + * @param the data type for the sets + * @return An Operand with the same rank as a and b, and all but the + * last dimension the * same. Elements along the last dimension contain the results of the set + * operation. + */ + public static Operand union(Ops tf, Operand a, Operand b) { + return setOperation(tf, a, b, Operation.UNION); + } + + /** + * Computes set intersection of elements in last dimension of a and b. + * + * @param tf the TensorFlow Ops + * @param a The first operand representing set a + * @param b The other operand representing set b + * @param the data type for the sets + * @return An Operand with the same rank as a and b, and all but the + * last dimension the * same. Elements along the last dimension contain the results of the set + * operation. + */ + public static Operand intersection(Ops tf, Operand a, Operand b) { + return setOperation(tf, a, b, Operation.INTERSECTION); + } + + /** + * Compute set operation of elements in last dimension of a and b. + * + * @param tf the TensorFlow Ops + * @param a The first set operation operand + * @param b The other et operation operand + * @param setOperation The set operation to perform, {@link Operation}. + * @param the data type for the sets + * @return An Operand with the same rank as a and b, and all but the + * last dimension the same. Elements along the last dimension contain the results of the set + * operation. + */ + public static Operand setOperation( + Ops tf, Operand a, Operand b, Operation setOperation) { + + DenseToDenseSetOperation setOperationResult = + tf.sparse.denseToDenseSetOperation( + a, b, setOperation.getSetOperation(), DenseToDenseSetOperation.validateIndices(true)); + return setOperationResult.resultValues(); + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java index af4a89692d1..63d666f8640 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/AssertBroadcastableTest.java @@ -72,7 +72,6 @@ private void testValid( testSession.getGraphSession().runner().fetch(weights).fetch(values).run(); try (Tensor weightsTensor = tensors.get(0); Tensor valuesTensor = tensors.get(1)) { - Op dynamicOp = MetricsHelper.assertBroadcastable(tf, weightsPlaceholder, valuesPlaceholder); testSession @@ -90,6 +89,7 @@ public void testValidScalar() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayF); Operand weights = tf.constant(5f); testValid(testSession, tf, weights, values, TFloat32.class); @@ -101,6 +101,7 @@ public void test1x1x1() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayD); Operand weights = tf.constant(new double[][][] {{{5}}}); testValid(testSession, tf, weights, values, TFloat64.class); @@ -134,6 +135,7 @@ public void test1xNxN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5, 7, 11, 3}, {2, 13, 7, 5}}}); testValid(testSession, tf, weights, values, TInt32.class); @@ -145,6 +147,7 @@ public void testNx1x1() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5}}, {{7}}, {{11}}}); testValid(testSession, tf, weights, values, TInt32.class); @@ -156,6 +159,7 @@ public void testNx1xN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant(new int[][][] {{{5, 7, 11, 3}}, {{2, 12, 7, 5}}, {{2, 17, 11, 3}}}); @@ -168,6 +172,7 @@ public void testNxNxN() { // no exception should be thrown try (TestSession testSession = TestSession.createTestSession(tfMode)) { Ops tf = testSession.getTF(); + Operand values = tf.constant(valueArrayI); Operand weights = tf.constant( diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/SetsOpsTest.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/SetsOpsTest.java new file mode 100644 index 00000000000..5250c22d740 --- /dev/null +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/metrics/impl/SetsOpsTest.java @@ -0,0 +1,110 @@ +package org.tensorflow.framework.metrics.impl; + +import org.junit.jupiter.api.Test; +import org.tensorflow.Operand; +import org.tensorflow.framework.utils.TestSession; +import org.tensorflow.ndarray.Shape; +import org.tensorflow.op.Ops; +import org.tensorflow.types.TInt32; +import org.tensorflow.types.TInt64; +import org.tensorflow.types.TUint8; +import org.tensorflow.types.family.TType; + +import java.util.Arrays; +import java.util.List; + +import static org.tensorflow.framework.utils.CastHelper.cast; + +class SetsOpsTest { + + private final TestSession.Mode[] tfModes = {TestSession.Mode.EAGER, TestSession.Mode.GRAPH}; + + List> types = Arrays.asList(TInt32.class, TInt64.class, TUint8.class); + + @Test + @SuppressWarnings({"unchecked", "rawtypes"}) + public void testSetIntersectionMultirow2() { + + for (TestSession.Mode tfMode : tfModes) + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Operand a = tf.constant(new int[][] {{9, 1, 5}, {2, 4, 3}}); + Operand b = tf.constant(new int[][] {{1, 9}, {1, 5}}); + Integer[] expected = new Integer[] {1, 9}; + Shape expectedShape = Shape.of(2); + for (Class type : types) { + Operand aa = cast(tf, a, type); + Operand bb = cast(tf, b, type); + Operand intersection = SetsOps.intersection(tf, aa, bb); + session.evaluate(expected, intersection); + session.evaluate(tf.constant(expectedShape), tf.shape(intersection, TInt64.class)); + } + } + } + + @Test + @SuppressWarnings({"unchecked", "rawtypes"}) + public void testSetIntersectionDuplicates2d() { + + for (TestSession.Mode tfMode : tfModes) + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Operand a = tf.constant(new int[][] {{1, 1, 3}}); + Operand b = tf.constant(new int[][] {{1}}); + Integer[] expected = new Integer[] {1}; + Shape expectedShape = Shape.of(1); + for (Class type : types) { + Operand aa = cast(tf, a, type); + Operand bb = cast(tf, b, type); + Operand intersection = SetsOps.intersection(tf, aa, bb); + session.evaluate(expected, intersection); + session.evaluate(tf.constant(expectedShape), tf.shape(intersection, TInt64.class)); + } + } + } + + public void testDenseSetDifferenceMultirow2d() { + + for (TestSession.Mode tfMode : tfModes) + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Operand a = tf.constant(new int[][] {{1, 5, 9}, {4, 5, 3}}); + Operand b = tf.constant(new int[][] {{1, 2, 6}, {1, 2, 2}}); + Integer[] expected = new Integer[] {5, 9, 3, 4, 5}; + for (Class type : types) { + Operand aa = cast(tf, a, type); + Operand bb = cast(tf, b, type); + // a- b + Operand intersection = SetsOps.difference(tf, aa, bb); + session.evaluate(expected, intersection); + session.evaluate(tf.constant(5L), tf.shape(intersection, TInt64.class)); + + // b - a + expected = new Integer[] {2, 6, 1, 2}; + intersection = SetsOps.difference(tf, aa, bb, false); + session.evaluate(expected, intersection); + session.evaluate(tf.constant(4L), tf.shape(intersection, TInt64.class)); + } + } + } + + public void testDenseUnionMultirow2d() { + + for (TestSession.Mode tfMode : tfModes) + try (TestSession session = TestSession.createTestSession(tfMode)) { + Ops tf = session.getTF(); + Operand a = tf.constant(new int[][] {{9, 1, 5}, {2, 4, 3}}); + Operand b = tf.constant(new int[][] {{1, 9}, {1, 2}}); + Integer[] expected = new Integer[] {1, 5, 9, 1, 2, 3, 4}; + for (Class type : types) { + Operand aa = cast(tf, a, type); + Operand bb = cast(tf, b, type); + // a- b + Operand intersection = SetsOps.difference(tf, aa, bb); + session.evaluate(expected, intersection); + session.evaluate(tf.constant(7L), tf.shape(intersection, TInt64.class)); + + } + } + } +} diff --git a/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java b/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java index 8e401c21627..43c0642939e 100644 --- a/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java +++ b/tensorflow-framework/src/test/java/org/tensorflow/framework/utils/GraphTestSession.java @@ -213,10 +213,13 @@ public void evaluate(double expected, Operand input) { @Override public void evaluate(Number[] expected, Output input) { int size = input.shape().size() == 0 ? 1 : (int) input.shape().size(); - assertEquals( - expected.length, - size, - () -> String.format("expected length (%d) != to input length (%d)", expected.length, size)); + if (size != Shape.UNKNOWN_SIZE) { + assertEquals( + expected.length, + size, + () -> + String.format("expected length (%d) != to input length (%d)", expected.length, size)); + } Class inputType = input.type(); if (inputType == TFloat32.class) { AtomicInteger index = new AtomicInteger(); @@ -425,10 +428,13 @@ public void evaluate(FloatNdArray expected, Output input) { @Override public void evaluate(String[] expected, Output input) { int size = input.shape().size() == 0 ? 1 : (int) input.shape().size(); - assertEquals( - expected.length, - size, - () -> String.format("expected length (%d) != to input length (%d)", expected.length, size)); + if (size != Shape.UNKNOWN_SIZE) { + assertEquals( + expected.length, + size, + () -> + String.format("expected length (%d) != to input length (%d)", expected.length, size)); + } AtomicInteger index = new AtomicInteger(); if (debug) { try (TString result = From 0edd1143638c05fbd13ac6d3e9c07f5c62f5cfe7 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 18 Jan 2021 20:22:46 -0500 Subject: [PATCH 24/60] Fixed based on various PR comments. --- .../framework/metrics/BinaryCrossentropy.java | 2 +- .../framework/metrics/CategoricalCrossentropy.java | 4 ++-- .../org/tensorflow/framework/metrics/Metrics.java | 10 +++++----- .../metrics/SparseCategoricalCrossentropy.java | 12 ++++++------ .../framework/metrics/impl/MeanMetricWrapper.java | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java index c339b977007..651a6fac0b0 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/BinaryCrossentropy.java @@ -41,7 +41,7 @@ public class BinaryCrossentropy * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param fromLogits Whether to interpret predictions as a tensor of logit values as opposed to a probability distribution. * @param labelSmoothing value used to smooth labels, When 0, no smoothing occurs. When > 0, * compute the loss between the predicted labels and a smoothed version of the true labels, * where the smoothing squeezes the labels towards 0.5. Larger values of label_smoothing diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java index 7b8cf0054a4..c330ea88eaa 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/CategoricalCrossentropy.java @@ -48,7 +48,7 @@ public class CategoricalCrossentropy * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param fromLogits Whether to interpret predictions as a tensor of logit values oras opposed to a probability distribution. * @param labelSmoothing value used to smooth labels, When > 0, label values are smoothed, * meaning the confidence on label values are relaxed. e.g. labelSmoothing=0.2 * means that we will use a value of 0.1 for label 0 and 0.9 @@ -68,7 +68,7 @@ public CategoricalCrossentropy( * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. + * @param fromLogits Whether to interpret predictions as a tensor of logit values as opposed to a probability distribution. * @param labelSmoothing value used to smooth labels, When > 0, label values are smoothed, * meaning the confidence on label values are relaxed. e.g. labelSmoothing=0.2 * means that we will use a value of 0.1 for label 0 and 0.9 diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java index e2cd5e368c2..0169bc6b8bc 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/Metrics.java @@ -64,19 +64,19 @@ public static Operand topKCategoricalA * @param tf the TensorFlow Ops * @param labels The ground truth values. * @param predictions The prediction values. - * @param axis The dimension along which the cosine similarity is computed. + * @param axes The dimensions along which the cosine similarity is computed. * @param the data type for the labels * @param the data type for the predictions and result * @return Cosine similarity value. */ public static Operand cosineProximity( - Ops tf, Operand labels, Operand predictions, int[] axis) { + Ops tf, Operand labels, Operand predictions, int[] axes) { Operand labelsNorm = CastHelper.cast(tf, labels, predictions.type()); - labelsNorm = l2Normalize(tf, labelsNorm, axis); + labelsNorm = l2Normalize(tf, labelsNorm, axes); - Operand predictionsNorm = l2Normalize(tf, predictions, axis); + Operand predictionsNorm = l2Normalize(tf, predictions, axes); Operand mathMul = tf.math.mul(labelsNorm, predictionsNorm); - return tf.reduceSum(mathMul, tf.constant(axis), ReduceSum.keepDims(Boolean.FALSE)); + return tf.reduceSum(mathMul, tf.constant(axes), ReduceSum.keepDims(Boolean.FALSE)); } /** diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java index 3fde8b2ecf6..2e01f722de6 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/SparseCategoricalCrossentropy.java @@ -32,30 +32,30 @@ public class SparseCategoricalCrossentropy extends MeanMetricWrapper implements LossMetric { private final boolean fromLogits; - private final int axes; + private final int axis; /** * Creates a SparseCategoricalCrossentropy metric * * @param tf the TensorFlow Ops * @param name the name of this metric, if null then metric name is {@link Class#getSimpleName()}. - * @param fromLogits Whether to interpret predictions as a tensor of logit values or not. - * @param axes The dimension along which the entropy is computed. + * @param fromLogits Whether to interpret predictions as a tensor of logit values as opposed to a probability distribution. + * @param axis The dimension along which the entropy is computed. * @param seed the seed for random number generation. An initializer created with a given seed * will always produce the same random tensor for a given shape and data type. * @param type the type for the variables and result */ public SparseCategoricalCrossentropy( - Ops tf, String name, boolean fromLogits, int axes, long seed, Class type) { + Ops tf, String name, boolean fromLogits, int axis, long seed, Class type) { super(tf, name, seed, type); setLoss(this); this.fromLogits = fromLogits; - this.axes = axes; + this.axis = axis; } /** {@inheritDoc} */ @Override public Operand call(Operand labels, Operand predictions) { - return Losses.sparseCategoricalCrossentropy(getTF(), labels, predictions, fromLogits, axes); + return Losses.sparseCategoricalCrossentropy(getTF(), labels, predictions, fromLogits, axis); } } diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java index e2f1345f356..17c209a8fed 100644 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java +++ b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MeanMetricWrapper.java @@ -85,7 +85,7 @@ protected void setLoss(LossMetric loss) { * [batch_size, d0, .. dN-1] (or can be broadcasted to this shape), then each loss element of * predictions is scaled by the corresponding value of sampleWeights. (Note on dN-1: all loss * functions reduce by 1 dimension, usually axis=-1.) - * @param the datatype of the predictions + * @param the datatype of the labels * @param the data type for sampleWeights * @return a List of control operations that updates the Mean state variables. */ From 7d78fd3db7c2c8ebf20ba877fa40ab4a46a99244 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 18 Jan 2021 20:23:44 -0500 Subject: [PATCH 25/60] Deleted, no longer needed after change to Variable handling in Metrics. --- .../metrics/impl/MetricVariable.java | 125 ------------------ 1 file changed, 125 deletions(-) delete mode 100644 tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java diff --git a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java b/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java deleted file mode 100644 index 6b208c0d7bf..00000000000 --- a/tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/impl/MetricVariable.java +++ /dev/null @@ -1,125 +0,0 @@ -/* 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. -=======================================================================*/ -package org.tensorflow.framework.metrics.impl; - -import org.tensorflow.Operand; -import org.tensorflow.framework.initializers.Glorot; -import org.tensorflow.framework.initializers.Initializer; -import org.tensorflow.framework.initializers.VarianceScaling; -import org.tensorflow.framework.initializers.Zeros; -import org.tensorflow.op.Ops; -import org.tensorflow.op.core.Variable; -import org.tensorflow.types.family.TFloating; -import org.tensorflow.types.family.TIntegral; -import org.tensorflow.types.family.TNumber; - -/** - * Helper class that holds a metric variable - * - * @param the data type of the variable - */ -public class MetricVariable { - private final Variable variable; - private final Initializer initializer; - private final Ops tf; - private boolean initialized; - - /** - * Creates a Metric Variable - * - * @param tf the TensorFlow Ops - * @param variable the variable - * @param seed the seed for random number generation. An initializer created with a given seed - * will always produce the same random tensor for a given shape and data type. - * @param type the type for the variable - */ - public MetricVariable(Ops tf, Variable variable, long seed, Class type) { - this(tf, variable, null, seed, type); - } - - /** - * Creates a Metric Variable - * - * @param tf the TensorFlow Ops - * @param variable the variable - * @param initializer the initializer for the variable, if null, then the default for floating - * point types is {@link org.tensorflow.framework.initializers.Glorot} with distribution - * {@link org.tensorflow.framework.initializers.VarianceScaling.Distribution#UNIFORM}, for - * other types the default initializer is {@link org.tensorflow.framework.initializers.Zeros} - * @param seed the seed for random number generation. An initializer created with a given seed - * will always produce the same random tensor for a given shape and data type. - * @param type the type for the variable - * @throws IllegalArgumentException if the type does not inherit from TNumber and the initializer - * is null - */ - @SuppressWarnings("unchecked") - public MetricVariable( - Ops tf, Variable variable, Initializer initializer, long seed, Class type) { - this.tf = tf; - this.variable = variable; - - if (initializer == null) { - if (TFloating.class.isAssignableFrom(type)) { - //noinspection RedundantCast - this.initializer = - (Initializer) new Glorot<>(tf, VarianceScaling.Distribution.UNIFORM, seed); - } else if (TIntegral.class.isAssignableFrom(type)) { - this.initializer = new Zeros<>(tf); - } else { - throw new IllegalArgumentException( - String.format("Type %s is not supported for metric variables", type.getSimpleName())); - } - } else { - this.initializer = initializer; - } - } - - /** - * Initializers the variable based on the initializer - * - * @return the initialized variable - */ - public Operand initialize() { - initialized = true; - return initializer.call(tf.constant(variable.shape()), variable.type()); - } - - /** - * Gets the variable - * - * @return the variable - */ - public Variable getVariable() { - return variable; - } - - /** - * Gets the initializer - * - * @return the initializer - */ - public Initializer getInitializer() { - return initializer; - } - - /** - * Gets the value of initialized - * - * @return the value of initialized - */ - public boolean isInitialized() { - return initialized; - } -} From af1b49f837dcfe1f1a8ec137dd8dab091539c291 Mon Sep 17 00:00:00 2001 From: Ryan Nett Date: Sat, 2 Jan 2021 07:22:30 -0800 Subject: [PATCH 26/60] Nicer error messages for mode-forbidden ops (#169) * start fobbiden ops checks Signed-off-by: Ryan Nett * fix style Signed-off-by: Ryan Nett * move checks to builder method Signed-off-by: Ryan Nett --- .../org/tensorflow/EagerOperationBuilder.java | 12 +++++++----- .../main/java/org/tensorflow/EagerSession.java | 18 ++++++++++++++++++ .../org/tensorflow/ExecutionEnvironment.java | 9 +++++++++ .../src/main/java/org/tensorflow/Graph.java | 3 +++ .../org/tensorflow/GraphOperationBuilder.java | 10 ++++++---- 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperationBuilder.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperationBuilder.java index 9df8444a11f..37f3af7ca26 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperationBuilder.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerOperationBuilder.java @@ -75,7 +75,7 @@ public EagerOperation build() { @Override public EagerOperationBuilder addInput(Output input) { - addInput(opHandle, (TFE_TensorHandle)input.getUnsafeNativeHandle()); + addInput(opHandle, (TFE_TensorHandle) input.getUnsafeNativeHandle()); return this; } @@ -83,7 +83,7 @@ public EagerOperationBuilder addInput(Output input) { public EagerOperationBuilder addInputList(Output[] inputs) { TFE_TensorHandle[] inputHandles = new TFE_TensorHandle[inputs.length]; for (int i = 0; i < inputs.length; ++i) { - inputHandles[i] = (TFE_TensorHandle)inputs[i].getUnsafeNativeHandle(); + inputHandles[i] = (TFE_TensorHandle) inputs[i].getUnsafeNativeHandle(); } addInputList(opHandle, inputHandles); return this; @@ -226,7 +226,9 @@ public EagerOperationBuilder setAttr(String name, Shape[] values) { private final String type; private final String name; - /** This value should be >= to the maximum number of outputs in any op */ + /** + * This value should be >= to the maximum number of outputs in any op + */ private static final int MAX_OUTPUTS_PER_OP = 1000; private static void requireOp(TFE_Op handle) { @@ -358,7 +360,7 @@ private static void setAttrFloatList(TFE_Op opHandle, String name, float[] value private static void setAttrBool(TFE_Op opHandle, String name, boolean value) { requireOp(opHandle); - TFE_OpSetAttrBool(opHandle, name, (byte)(value ? 1 : 0)); + TFE_OpSetAttrBool(opHandle, name, (byte) (value ? 1 : 0)); } private static void setAttrBoolList(TFE_Op opHandle, String name, boolean[] values) { @@ -410,7 +412,7 @@ private static void setAttrShapeList(TFE_Op opHandle, String name, long[] shapes } TF_Status status = TF_Status.newStatus(); TFE_OpSetAttrShapeList(opHandle, new BytePointer(name), shapesPointers, new IntPointer(numDims), - numDims.length, status); + numDims.length, status); } } } diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java index 3f29245ce0b..96ef5228a4f 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java @@ -27,6 +27,9 @@ import org.tensorflow.internal.c_api.TFE_Context; import org.tensorflow.internal.c_api.TFE_ContextOptions; import org.tensorflow.internal.c_api.TF_Status; +import org.tensorflow.op.core.Assign; +import org.tensorflow.op.core.Placeholder; +import org.tensorflow.op.core.Variable; import org.tensorflow.proto.framework.ConfigProto; /** @@ -271,6 +274,9 @@ static void closeDefaultForTest() { @Override public OperationBuilder opBuilder(String type, String name) { checkSession(); + if (!isOpEnabled(type)) { + throw new IllegalArgumentException("Op " + type + " is not valid in eager mode."); + } return new EagerOperationBuilder(this, type, name); } @@ -279,6 +285,18 @@ public Types environmentType() { return Types.EAGER; } + @Override + public boolean isOpEnabled(String opType) { + switch (opType) { + case Variable.OP_NAME: + case Placeholder.OP_NAME: + case Assign.OP_NAME: + return false; + default: + return true; + } + } + TFE_Context nativeHandle() { checkSession(); return nativeHandle; diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java index a894b665763..a7a3363f690 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java @@ -34,6 +34,15 @@ enum Types { */ OperationBuilder opBuilder(String type, String name); + /** + * Returns true if the given operation is valid in this execution environment. + * @param opType The op to check. + * @return Whether the given operation is valid in this execution environment. + */ + default boolean isOpEnabled(String opType){ + return true; + } + /** * Get the type of this environment (from the `Environments` enumeration. * diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java index d70460ee4ea..f2717f263eb 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java @@ -147,6 +147,9 @@ public Iterator operations() { */ @Override public GraphOperationBuilder opBuilder(String type, String name) { + if (!isOpEnabled(type)) { + throw new IllegalArgumentException("Op " + type + " is not valid in graph mode."); + } return new GraphOperationBuilder(this, type, name); } diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java index 927d9c52dd1..9c0f011bab4 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java @@ -54,7 +54,9 @@ import org.tensorflow.ndarray.Shape; import org.tensorflow.proto.framework.DataType; -/** An {@link OperationBuilder} for adding {@link GraphOperation}s to a {@link Graph}. */ +/** + * An {@link OperationBuilder} for adding {@link GraphOperation}s to a {@link Graph}. + */ public final class GraphOperationBuilder implements OperationBuilder { GraphOperationBuilder(Graph graph, String type, String name) { @@ -103,7 +105,7 @@ public GraphOperationBuilder addControlInput(Operation control) { public GraphOperationBuilder addInput(Output input) { Graph.Reference r = graph.ref(); try { - addInput(unsafeNativeHandle, (TF_Operation)input.getUnsafeNativeHandle(), input.index()); + addInput(unsafeNativeHandle, (TF_Operation) input.getUnsafeNativeHandle(), input.index()); } finally { r.close(); } @@ -117,7 +119,7 @@ public GraphOperationBuilder addInputList(Output[] inputs) { TF_Operation[] opHandles = new TF_Operation[inputs.length]; int[] indices = new int[inputs.length]; for (int i = 0; i < inputs.length; ++i) { - opHandles[i] = (TF_Operation)inputs[i].getUnsafeNativeHandle(); + opHandles[i] = (TF_Operation) inputs[i].getUnsafeNativeHandle(); indices[i] = inputs[i].index(); } addInputList(unsafeNativeHandle, opHandles, indices); @@ -444,7 +446,7 @@ private static void setAttrFloatList(TF_OperationDescription handle, String name private static void setAttrBool(TF_OperationDescription handle, String name, boolean value) { requireHandle(handle); - TF_SetAttrBool(handle, name, (byte)(value ? 1 : 0)); + TF_SetAttrBool(handle, name, (byte) (value ? 1 : 0)); } private static void setAttrBoolList(TF_OperationDescription handle, String name, boolean[] value) { From 7732601c0ee9857d1ab28ebc02fa6b7ed542b21d Mon Sep 17 00:00:00 2001 From: Ryan Nett Date: Wed, 6 Jan 2021 21:28:12 -0800 Subject: [PATCH 27/60] Initialization imprvements (#178) * No-op on initAdd in eager mode Signed-off-by: Ryan Nett * runInit() method in session Signed-off-by: Ryan Nett * add doInitialization() to Runner Signed-off-by: Ryan Nett * fix javadoc Signed-off-by: Ryan Nett * assume only graph or eager environments Signed-off-by: Ryan Nett * Remove doInit(), update javadocs Signed-off-by: Ryan Nett * small fixes Signed-off-by: Ryan Nett --- .../src/gen/annotations/org/tensorflow/op/Ops.java | 9 ++++----- .../src/main/java/org/tensorflow/Session.java | 13 +++++++++++++ .../src/main/java/org/tensorflow/op/core/Init.java | 10 ++++------ 3 files changed, 21 insertions(+), 11 deletions(-) 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 d6e69085324..cf7c5b47030 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 @@ -347,10 +347,10 @@ public final class Ops { public final SignalOps signal; - public final QuantizationOps quantization; - public final TrainOps train; + public final QuantizationOps quantization; + private final Scope scope; private Ops(Scope scope) { @@ -372,8 +372,8 @@ private Ops(Scope scope) { math = new MathOps(this); audio = new AudioOps(this); signal = new SignalOps(this); - quantization = new QuantizationOps(this); train = new TrainOps(this); + quantization = new QuantizationOps(this); } /** @@ -2755,11 +2755,10 @@ public Init init() { * *

Registered initializers are then grouped as a single unit of computation by adding * and executing an {@link org.tensorflow.op.core.Init#create(Scope) init} operation from a graph - * session. + * session. This is a no-op if executed in an eager session. * * @param scope * @param initializer - * @throws IllegalArgumentException if the execution environment in scope is not a graph * @see org.tensorflow.op.core.Init#create(Scope) init */ public void initAdd(Op initializer) { diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Session.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Session.java index e9d517a6548..e156491d09a 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Session.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Session.java @@ -490,6 +490,19 @@ public void run(Op op) { runner().addTarget(op.op()).run(); } + + /** + * Execute the graph's initializers. + * + *

This method is equivalent to {@code session.run(Ops.create(session.graph).init())}. + * + */ + public void runInit(){ + Runner runner = runner(); + graph.initializers().forEach(runner::addTarget); + runner.run(); + } + /** * Saves the actual state of the variables of this session's graph. * diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Init.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Init.java index b7b65a973c9..b05eb07c8ca 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Init.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Init.java @@ -89,21 +89,19 @@ public static Init create(Scope scope) { * *

Registered initializers are then grouped as a single unit of computation by adding * and executing an {@link org.tensorflow.op.core.Init#create(Scope) init} operation from a graph - * session. + * session. This is a no-op if executed in an eager session. * * @param scope * @param initializer - * @throws IllegalArgumentException if the execution environment in scope is not a graph * @see org.tensorflow.op.core.Init#create(Scope) init */ @Endpoint(name = "initAdd") public static void add(Scope scope, Op initializer) { ExecutionEnvironment exEnv = scope.env(); - if (!(exEnv instanceof Graph)) { - throw new IllegalArgumentException("initAdd is only supported on Graph sessions."); + + if (exEnv.isGraph()) { + ((Graph) exEnv).addInitializer(initializer); } - Graph graph = (Graph) exEnv; - graph.addInitializer(initializer); } private Init(Operation operation) { From a73733407e8561e408cbb487f7bb10546c181b4f Mon Sep 17 00:00:00 2001 From: Ryan Nett Date: Tue, 19 Jan 2021 14:11:45 -0800 Subject: [PATCH 28/60] Clairify tensorOf lifetime requirements (#190) * Clairify tensorOf lifetime requirements Signed-off-by: Ryan Nett * Do codegen Signed-off-by: Ryan Nett --- .../src/gen/annotations/org/tensorflow/op/Ops.java | 3 ++- .../src/main/java/org/tensorflow/op/core/Constant.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 cf7c5b47030..23ca3497412 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 @@ -1867,7 +1867,8 @@ public Constant constant(Class type, Shape shape, ByteDa } /** - * Create a constant by making an immutable copy of {@code tensor}. + * Create a constant by making an immutable copy of {@code tensor}. {@code tensor} may be closed afterwards without + * issue. * *

Note: this endpoint cannot be simply called {@code constant} since it will conflict with * other endpoints accepting an NdArray in parameter {e.g. {@link #tensorOf(Scope, FloatNdArray)}}. diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Constant.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Constant.java index 1b6aee0284b..918f9083923 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Constant.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/op/core/Constant.java @@ -1278,7 +1278,8 @@ public static Constant tensorOf(Scope scope, Shape shape) { } /** - * Create a constant by making an immutable copy of {@code tensor}. + * Create a constant by making an immutable copy of {@code tensor}. {@code tensor} may be closed afterwards without + * issue. * *

Note: this endpoint cannot be simply called {@code constant} since it will conflict with * other endpoints accepting an NdArray in parameter {e.g. {@link #tensorOf(Scope, FloatNdArray)}}. From 253cc73894c934ba236cbbf6328300c80c8c9d02 Mon Sep 17 00:00:00 2001 From: Ryan Nett Date: Mon, 25 Jan 2021 16:52:03 -0800 Subject: [PATCH 29/60] Remove extra generics from op generation (#193) * Successfully remove extra type params, but it broke javadoc generation Signed-off-by: Ryan Nett * Generate covariant types Signed-off-by: Ryan Nett * Do generation Signed-off-by: Ryan Nett * Update help text. Signed-off-by: Ryan Nett * Fixes Signed-off-by: Ryan Nett --- .../src/bazel/op_generator/op_gen_main.cc | 7 +- .../src/bazel/op_generator/op_specs.cc | 55 +++ .../src/bazel/op_generator/op_specs.h | 7 +- .../org/tensorflow/op/DtypesOps.java | 4 +- .../org/tensorflow/op/ImageOps.java | 16 +- .../annotations/org/tensorflow/op/IoOps.java | 20 +- .../org/tensorflow/op/LinalgOps.java | 21 +- .../org/tensorflow/op/MathOps.java | 91 +++-- .../annotations/org/tensorflow/op/NnOps.java | 30 +- .../org/tensorflow/op/NnRawOps.java | 4 +- .../annotations/org/tensorflow/op/Ops.java | 380 ++++++++---------- .../org/tensorflow/op/QuantizationOps.java | 15 +- .../org/tensorflow/op/RandomOps.java | 85 ++-- .../org/tensorflow/op/SignalOps.java | 20 +- .../org/tensorflow/op/SparseOps.java | 70 ++-- .../org/tensorflow/op/StringsOps.java | 4 +- .../org/tensorflow/op/SummaryOps.java | 10 +- .../org/tensorflow/op/TrainOps.java | 99 ++--- .../annotations/org/tensorflow/op/XlaOps.java | 10 +- .../gen/java/org/tensorflow/op/core/All.java | 2 +- .../gen/java/org/tensorflow/op/core/Any.java | 2 +- .../op/core/AssignAddVariableOp.java | 2 +- .../op/core/AssignSubVariableOp.java | 2 +- .../tensorflow/op/core/AssignVariableOp.java | 2 +- .../tensorflow/op/core/BarrierInsertMany.java | 2 +- .../org/tensorflow/op/core/BatchToSpace.java | 2 +- .../tensorflow/op/core/BatchToSpaceNd.java | 2 +- .../java/org/tensorflow/op/core/Bitcast.java | 2 +- .../org/tensorflow/op/core/BroadcastTo.java | 2 +- .../org/tensorflow/op/core/Bucketize.java | 2 +- .../java/org/tensorflow/op/core/Concat.java | 2 +- .../op/core/DummySeedGenerator.java | 65 --- .../tensorflow/op/core/EmptyTensorList.java | 2 +- .../org/tensorflow/op/core/ExpandDims.java | 2 +- .../gen/java/org/tensorflow/op/core/Fill.java | 2 +- .../org/tensorflow/op/core/Fingerprint.java | 2 +- .../java/org/tensorflow/op/core/Gather.java | 2 +- .../java/org/tensorflow/op/core/GatherNd.java | 2 +- .../tensorflow/op/core/GetSessionHandle.java | 2 +- .../tensorflow/op/core/InitializeTable.java | 2 +- .../op/core/IsVariableInitialized.java | 2 +- .../java/org/tensorflow/op/core/LinSpace.java | 2 +- .../tensorflow/op/core/LookupTableFind.java | 2 +- .../tensorflow/op/core/LookupTableImport.java | 2 +- .../tensorflow/op/core/LookupTableInsert.java | 2 +- .../tensorflow/op/core/LookupTableRemove.java | 2 +- .../gen/java/org/tensorflow/op/core/Max.java | 2 +- .../gen/java/org/tensorflow/op/core/Min.java | 2 +- .../org/tensorflow/op/core/MirrorPad.java | 2 +- .../org/tensorflow/op/core/MirrorPadGrad.java | 2 +- .../java/org/tensorflow/op/core/OneHot.java | 2 +- .../gen/java/org/tensorflow/op/core/Pad.java | 2 +- .../gen/java/org/tensorflow/op/core/Prod.java | 2 +- .../tensorflow/op/core/QuantizedReshape.java | 2 +- .../gen/java/org/tensorflow/op/core/Rank.java | 2 +- .../org/tensorflow/op/core/ReduceAll.java | 2 +- .../org/tensorflow/op/core/ReduceAny.java | 2 +- .../org/tensorflow/op/core/ReduceMax.java | 2 +- .../org/tensorflow/op/core/ReduceMin.java | 2 +- .../org/tensorflow/op/core/ReduceProd.java | 2 +- .../org/tensorflow/op/core/ReduceSum.java | 2 +- .../java/org/tensorflow/op/core/Reshape.java | 2 +- .../tensorflow/op/core/ResourceGather.java | 2 +- .../tensorflow/op/core/ResourceGatherNd.java | 2 +- .../op/core/ResourceScatterAdd.java | 2 +- .../op/core/ResourceScatterDiv.java | 2 +- .../op/core/ResourceScatterMax.java | 2 +- .../op/core/ResourceScatterMin.java | 2 +- .../op/core/ResourceScatterMul.java | 2 +- .../op/core/ResourceScatterNdAdd.java | 2 +- .../op/core/ResourceScatterNdMax.java | 2 +- .../op/core/ResourceScatterNdMin.java | 2 +- .../op/core/ResourceScatterNdSub.java | 2 +- .../op/core/ResourceScatterNdUpdate.java | 2 +- .../op/core/ResourceScatterSub.java | 2 +- .../op/core/ResourceScatterUpdate.java | 2 +- .../op/core/ResourceStridedSliceAssign.java | 2 +- .../java/org/tensorflow/op/core/Reverse.java | 2 +- .../tensorflow/op/core/ReverseSequence.java | 2 +- .../gen/java/org/tensorflow/op/core/Roll.java | 2 +- .../org/tensorflow/op/core/ScatterAdd.java | 2 +- .../org/tensorflow/op/core/ScatterDiv.java | 2 +- .../org/tensorflow/op/core/ScatterMax.java | 2 +- .../org/tensorflow/op/core/ScatterMin.java | 2 +- .../org/tensorflow/op/core/ScatterMul.java | 2 +- .../org/tensorflow/op/core/ScatterNdAdd.java | 2 +- .../org/tensorflow/op/core/ScatterNdMax.java | 2 +- .../org/tensorflow/op/core/ScatterNdMin.java | 2 +- .../op/core/ScatterNdNonAliasingAdd.java | 2 +- .../org/tensorflow/op/core/ScatterNdSub.java | 2 +- .../tensorflow/op/core/ScatterNdUpdate.java | 2 +- .../org/tensorflow/op/core/ScatterSub.java | 2 +- .../org/tensorflow/op/core/ScatterUpdate.java | 2 +- .../gen/java/org/tensorflow/op/core/Send.java | 2 +- .../java/org/tensorflow/op/core/SetSize.java | 2 +- .../java/org/tensorflow/op/core/Shape.java | 4 +- .../gen/java/org/tensorflow/op/core/Size.java | 4 +- .../tensorflow/op/core/SpaceToBatchNd.java | 2 +- .../java/org/tensorflow/op/core/SplitV.java | 2 +- .../gen/java/org/tensorflow/op/core/Sum.java | 2 +- .../op/core/TensorArrayScatter.java | 2 +- .../tensorflow/op/core/TensorArraySplit.java | 2 +- .../tensorflow/op/core/TensorArrayUnpack.java | 2 +- .../tensorflow/op/core/TensorArrayWrite.java | 2 +- .../tensorflow/op/core/TensorListConcat.java | 2 +- .../op/core/TensorListFromTensor.java | 2 +- .../op/core/TensorListPushBack.java | 2 +- .../op/core/TensorListPushBackBatch.java | 2 +- .../tensorflow/op/core/TensorListReserve.java | 2 +- .../tensorflow/op/core/TensorListScatter.java | 2 +- .../TensorListScatterIntoExistingList.java | 2 +- .../tensorflow/op/core/TensorListSetItem.java | 2 +- .../tensorflow/op/core/TensorListSplit.java | 2 +- .../tensorflow/op/core/TensorScatterMax.java | 75 ---- .../tensorflow/op/core/TensorScatterMin.java | 75 ---- .../op/core/TensorScatterNdAdd.java | 2 +- .../op/core/TensorScatterNdMax.java | 2 +- .../op/core/TensorScatterNdMin.java | 2 +- .../op/core/TensorScatterNdSub.java | 2 +- .../op/core/TensorScatterNdUpdate.java | 2 +- .../gen/java/org/tensorflow/op/core/Tile.java | 2 +- .../java/org/tensorflow/op/core/Unique.java | 4 +- .../tensorflow/op/core/UniqueWithCounts.java | 4 +- .../java/org/tensorflow/op/core/Where.java | 2 +- .../op/data/SparseTensorSliceDataset.java | 2 +- .../op/debugging/DebugNanCount.java | 2 +- .../op/debugging/DebugNumericsSummary.java | 4 +- .../org/tensorflow/op/dtypes/AsString.java | 2 +- .../java/org/tensorflow/op/dtypes/Cast.java | 2 +- .../java/org/tensorflow/op/dtypes/ToBool.java | 2 +- .../tensorflow/op/image/CropAndResize.java | 2 +- .../op/image/CropAndResizeGradBoxes.java | 2 +- .../org/tensorflow/op/image/EncodePng.java | 2 +- .../org/tensorflow/op/image/ResizeArea.java | 2 +- .../tensorflow/op/image/ResizeBicubic.java | 2 +- .../tensorflow/op/image/ResizeBilinear.java | 2 +- .../op/image/ScaleAndTranslate.java | 2 +- .../tensorflow/op/io/SerializeManySparse.java | 4 +- .../org/tensorflow/op/io/SerializeSparse.java | 4 +- .../org/tensorflow/op/io/SerializeTensor.java | 2 +- .../op/linalg/ConjugateTranspose.java | 2 +- .../java/org/tensorflow/op/linalg/Eig.java | 2 +- .../tensorflow/op/linalg/EuclideanNorm.java | 2 +- .../tensorflow/op/linalg/QuantizedMatMul.java | 2 +- .../op/linalg/QuantizedMatMulWithBias.java | 2 +- .../QuantizedMatMulWithBiasAndRelu.java | 2 +- ...zedMatMulWithBiasAndReluAndRequantize.java | 2 +- .../org/tensorflow/op/linalg/Transpose.java | 2 +- .../linalg/sparse/DenseToCSRSparseMatrix.java | 2 +- .../op/linalg/sparse/SparseMatrixMul.java | 2 +- .../sparse/SparseTensorToCSRSparseMatrix.java | 2 +- .../java/org/tensorflow/op/math/Angle.java | 4 +- .../java/org/tensorflow/op/math/ArgMax.java | 4 +- .../java/org/tensorflow/op/math/ArgMin.java | 4 +- .../org/tensorflow/op/math/ComplexAbs.java | 4 +- .../java/org/tensorflow/op/math/Cumprod.java | 2 +- .../java/org/tensorflow/op/math/Cumsum.java | 2 +- .../op/math/CumulativeLogsumexp.java | 2 +- .../gen/java/org/tensorflow/op/math/Imag.java | 4 +- .../java/org/tensorflow/op/math/IsFinite.java | 2 +- .../java/org/tensorflow/op/math/IsInf.java | 2 +- .../java/org/tensorflow/op/math/IsNan.java | 2 +- .../gen/java/org/tensorflow/op/math/Mean.java | 2 +- .../tensorflow/op/math/PopulationCount.java | 2 +- .../org/tensorflow/op/math/QuantizedAdd.java | 2 +- .../org/tensorflow/op/math/QuantizedMul.java | 2 +- .../gen/java/org/tensorflow/op/math/Real.java | 4 +- .../math/RequantizationRangePerChannel.java | 2 +- .../op/math/RequantizePerChannel.java | 2 +- .../org/tensorflow/op/math/SegmentMax.java | 2 +- .../org/tensorflow/op/math/SegmentMean.java | 2 +- .../org/tensorflow/op/math/SegmentMin.java | 2 +- .../org/tensorflow/op/math/SegmentProd.java | 2 +- .../org/tensorflow/op/math/SegmentSum.java | 2 +- .../op/math/UnsortedSegmentMax.java | 2 +- .../op/math/UnsortedSegmentMin.java | 2 +- .../op/math/UnsortedSegmentProd.java | 2 +- .../op/math/UnsortedSegmentSum.java | 2 +- .../tensorflow/op/nn/Conv3dBackpropInput.java | 2 +- .../op/nn/MaxPoolGradGradWithArgmax.java | 2 +- .../op/nn/MaxPoolGradWithArgmax.java | 2 +- .../tensorflow/op/nn/QuantizedBiasAdd.java | 2 +- .../op/nn/QuantizedConv2DAndRelu.java | 2 +- .../QuantizedConv2DAndReluAndRequantize.java | 2 +- .../op/nn/QuantizedConv2DAndRequantize.java | 2 +- .../op/nn/QuantizedConv2DPerChannel.java | 2 +- .../op/nn/QuantizedConv2DWithBias.java | 2 +- .../op/nn/QuantizedConv2DWithBiasAndRelu.java | 2 +- ...zedConv2DWithBiasAndReluAndRequantize.java | 2 +- .../QuantizedConv2DWithBiasAndRequantize.java | 2 +- ...WithBiasSignedSumAndReluAndRequantize.java | 2 +- .../nn/QuantizedConv2DWithBiasSumAndRelu.java | 2 +- ...Conv2DWithBiasSumAndReluAndRequantize.java | 2 +- .../org/tensorflow/op/nn/QuantizedConv2d.java | 2 +- .../op/nn/QuantizedDepthwiseConv2D.java | 2 +- .../nn/QuantizedDepthwiseConv2DWithBias.java | 2 +- ...antizedDepthwiseConv2DWithBiasAndRelu.java | 2 +- ...iseConv2DWithBiasAndReluAndRequantize.java | 2 +- .../org/tensorflow/op/nn/QuantizedRelu.java | 2 +- .../org/tensorflow/op/nn/QuantizedRelu6.java | 2 +- .../org/tensorflow/op/nn/QuantizedReluX.java | 2 +- .../org/tensorflow/op/nn/SpaceToBatch.java | 2 +- .../SparseSoftmaxCrossEntropyWithLogits.java | 2 +- .../op/quantization/Dequantize.java | 4 +- .../QuantizeDownAndShrinkRange.java | 2 +- .../QuantizedMatMulWithBiasAndDequantize.java | 2 +- .../QuantizedMatMulWithBiasAndRequantize.java | 2 +- .../op/quantization/RequantizationRange.java | 2 +- .../op/quantization/Requantize.java | 2 +- .../op/ragged/RaggedCountSparseOutput.java | 2 +- .../tensorflow/op/ragged/RaggedGather.java | 2 +- .../op/ragged/RaggedTensorToTensor.java | 2 +- .../op/ragged/RaggedTensorToVariant.java | 2 +- .../org/tensorflow/op/random/Multinomial.java | 4 +- .../op/random/NonDeterministicInts.java | 4 +- .../random/ParameterizedTruncatedNormal.java | 2 +- .../org/tensorflow/op/random/RandomGamma.java | 2 +- .../tensorflow/op/random/RandomPoisson.java | 4 +- .../op/random/RandomStandardNormal.java | 2 +- .../tensorflow/op/random/RandomUniform.java | 2 +- .../op/random/RandomUniformInt.java | 2 +- .../op/random/StatefulRandomBinomial.java | 4 +- .../op/random/StatefulStandardNormal.java | 4 +- .../op/random/StatefulTruncatedNormal.java | 4 +- .../tensorflow/op/random/StatefulUniform.java | 4 +- .../op/random/StatefulUniformFullInt.java | 2 +- .../op/random/StatefulUniformInt.java | 2 +- .../op/random/StatelessMultinomial.java | 4 +- ...StatelessParameterizedTruncatedNormal.java | 2 +- .../op/random/StatelessRandomBinomial.java | 4 +- .../op/random/StatelessRandomGamma.java | 2 +- .../op/random/StatelessRandomNormal.java | 4 +- .../op/random/StatelessRandomPoisson.java | 2 +- .../op/random/StatelessRandomUniform.java | 4 +- .../random/StatelessRandomUniformFullInt.java | 2 +- .../op/random/StatelessRandomUniformInt.java | 2 +- .../op/random/StatelessTruncatedNormal.java | 4 +- .../tensorflow/op/random/TruncatedNormal.java | 2 +- .../java/org/tensorflow/op/signal/Irfft.java | 4 +- .../org/tensorflow/op/signal/Irfft2d.java | 4 +- .../org/tensorflow/op/signal/Irfft3d.java | 4 +- .../java/org/tensorflow/op/signal/Rfft.java | 2 +- .../java/org/tensorflow/op/signal/Rfft2d.java | 2 +- .../java/org/tensorflow/op/signal/Rfft3d.java | 2 +- .../op/sparse/AddManySparseToTensorsMap.java | 2 +- .../op/sparse/AddSparseToTensorsMap.java | 2 +- .../op/sparse/DenseCountSparseOutput.java | 2 +- .../op/sparse/DeserializeSparse.java | 2 +- .../SparseAccumulatorApplyGradient.java | 2 +- .../org/tensorflow/op/sparse/SparseAdd.java | 2 +- .../op/sparse/SparseCountSparseOutput.java | 2 +- .../tensorflow/op/sparse/SparseMatMul.java | 2 +- .../op/sparse/SparseSegmentMean.java | 2 +- .../op/sparse/SparseSegmentMeanGrad.java | 2 +- .../SparseSegmentMeanWithNumSegments.java | 2 +- .../op/sparse/SparseSegmentSqrtN.java | 2 +- .../op/sparse/SparseSegmentSqrtNGrad.java | 2 +- .../SparseSegmentSqrtNWithNumSegments.java | 2 +- .../op/sparse/SparseSegmentSum.java | 2 +- .../SparseSegmentSumWithNumSegments.java | 2 +- .../op/sparse/SparseTensorDenseMatMul.java | 2 +- .../tensorflow/op/strings/UnicodeEncode.java | 2 +- .../op/strings/UnsortedSegmentJoin.java | 2 +- .../op/summary/HistogramSummary.java | 2 +- .../tensorflow/op/summary/ImageSummary.java | 2 +- .../tensorflow/op/summary/ScalarSummary.java | 2 +- .../tensorflow/op/summary/TensorSummary.java | 2 +- .../op/summary/WriteHistogramSummary.java | 2 +- .../op/summary/WriteImageSummary.java | 2 +- .../op/summary/WriteScalarSummary.java | 2 +- .../tensorflow/op/summary/WriteSummary.java | 2 +- .../org/tensorflow/op/tpu/InfeedEnqueue.java | 2 +- .../org/tensorflow/op/tpu/OutfeedEnqueue.java | 2 +- .../org/tensorflow/op/tpu/Prelinearize.java | 2 +- .../op/train/AccumulatorApplyGradient.java | 2 +- .../ResourceAccumulatorApplyGradient.java | 2 +- .../op/train/ResourceSparseApplyAdadelta.java | 2 +- .../op/train/ResourceSparseApplyAdagrad.java | 2 +- .../train/ResourceSparseApplyAdagradDa.java | 2 +- .../train/ResourceSparseApplyAdagradV2.java | 2 +- .../ResourceSparseApplyCenteredRmsProp.java | 2 +- .../op/train/ResourceSparseApplyFtrl.java | 2 +- .../ResourceSparseApplyKerasMomentum.java | 2 +- .../op/train/ResourceSparseApplyMomentum.java | 2 +- .../ResourceSparseApplyProximalAdagrad.java | 2 +- ...rceSparseApplyProximalGradientDescent.java | 2 +- .../op/train/ResourceSparseApplyRmsProp.java | 2 +- .../op/train/SparseApplyAdadelta.java | 2 +- .../op/train/SparseApplyAdagrad.java | 2 +- .../op/train/SparseApplyAdagradDa.java | 2 +- .../op/train/SparseApplyCenteredRmsProp.java | 2 +- .../tensorflow/op/train/SparseApplyFtrl.java | 2 +- .../op/train/SparseApplyMomentum.java | 2 +- .../op/train/SparseApplyProximalAdagrad.java | 2 +- .../SparseApplyProximalGradientDescent.java | 2 +- .../op/train/SparseApplyRmsProp.java | 2 +- .../tensorflow/op/xla/BroadcastHelper.java | 2 +- .../tensorflow/op/xla/DynamicUpdateSlice.java | 2 +- .../gen/java/org/tensorflow/op/xla/Send.java | 2 +- 299 files changed, 797 insertions(+), 978 deletions(-) delete mode 100644 tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DummySeedGenerator.java delete mode 100644 tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMax.java delete mode 100644 tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMin.java diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_gen_main.cc b/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_gen_main.cc index f35a84b8178..5ab9c820832 100644 --- a/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_gen_main.cc +++ b/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_gen_main.cc @@ -34,6 +34,9 @@ const char kUsageHeader[] = "provided list of libraries. A wrapper exposes an intuitive and\n" "strongly-typed interface for building its underlying operation and linking " "it into a graph.\n\n" + "The first argument is the location of the tensorflow binary built for TF-" + "Java.\nFor example, `bazel-out/k8-opt/bin/external/org_tensorflow/tensorfl" + "ow/libtensorflow_cc.so`.\n\n" "Operation wrappers are generated under the path specified by the " "'--output_dir' argument. This path can be absolute or relative to the\n" "current working directory and will be created if it does not exist.\n\n" @@ -45,7 +48,9 @@ const char kUsageHeader[] = "Finally, the `--api_dirs` argument takes a list of comma-separated " "directories of API definitions can be provided to override default\n" "values found in the ops definitions. Directories are ordered by priority " - "(the last having precedence over the first).\n\n"; + "(the last having precedence over the first).\nFor example, `bazel-tensorf" + "low-core-api/external/org_tensorflow/tensorflow/core/api_def/base_api,src" + "/bazel/api_def`\n\n"; } // namespace java } // namespace tensorflow diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.cc b/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.cc index 56de15d9ab7..d0567b4eb83 100644 --- a/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.cc +++ b/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.cc @@ -391,8 +391,63 @@ OpSpec OpSpec::Create(const OpDef& op_def, const ApiDef& api_def) { for (const auto& endpoint_def : api_def.endpoint()) { op.endpoints_.push_back(CreateEndpoint(op_def, api_def, endpoint_def)); } + op.RemoveExtraGenerics(); return op; } +void OpSpec::RemoveExtraGenerics() { + std::map generics; + + for (const ArgumentSpec& output : this->outputs()) { + if (output.type().kind() == Type::GENERIC && !output.type().wildcard()) { + if (generics.find(output.type().name()) == generics.end()) { + generics[output.type().name()] = 1; + } else { + generics[output.type().name()] = generics.find(output.type().name())->second + 1; + } + } + } + + for (const ArgumentSpec& input : this->inputs()) { + if (input.type().kind() == Type::GENERIC && !input.type().wildcard()) { + if (generics.find(input.type().name()) == generics.end()) { + generics[input.type().name()] = 1; + } else { + generics[input.type().name()] = generics.find(input.type().name())->second + 1; + } + } + } + + for (ArgumentSpec& output : this->outputs_) { + if (output.type().kind() == Type::GENERIC && !output.type().wildcard()) { + if (generics[output.type().name()] <= 1) { + output.toUpperBound(); + } + } + } + + for (ArgumentSpec& input : this->inputs_) { + if (generics[input.type().name()] <= 1) { + input.toUpperBound(); + } + } +} + +void ArgumentSpec::toUpperBound() { + if(this->type().kind() == Type::GENERIC && this->var().type().name() == "Operand" && + this->type().supertypes().size() == 1){ + Type newType = Type::Wildcard().add_supertype(this->type().supertypes().front()); + Type varType = Type::Interface("Operand", "org.tensorflow").add_parameter(newType); + + if(this->var().variadic()){ + this->var_ = Variable::Varargs(this->var().name(), varType); + } else { + this->var_ = Variable::Create(this->var().name(), varType); + } + + this->type_ = newType; + } +} + } // namespace java } // namespace tensorflow diff --git a/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.h b/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.h index 40d72656561..493dc777384 100644 --- a/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.h +++ b/tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.h @@ -74,13 +74,14 @@ class ArgumentSpec { const string& op_def_name() const { return op_def_name_; } const Variable& var() const { return var_; } const Type& type() const { return type_; } + void toUpperBound(); const string& description() const { return description_; } bool iterable() const { return iterable_; } private: const string op_def_name_; - const Variable var_; - const Type type_; + Variable var_; + Type type_; const string description_; const bool iterable_; }; @@ -164,6 +165,8 @@ class OpSpec { hidden_(hidden), deprecation_explanation_(deprecation_explanation) {} + void RemoveExtraGenerics(); + const string graph_op_name_; const bool hidden_; const string deprecation_explanation_; diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java index acf6a748b70..b4a7373e862 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DtypesOps.java @@ -59,7 +59,7 @@ public final class DtypesOps { * @param options carries optional attributes values * @return a new instance of AsString */ - public AsString asString(Operand input, AsString.Options... options) { + public AsString asString(Operand input, AsString.Options... options) { return AsString.create(scope, input, options); } @@ -72,7 +72,7 @@ public AsString asString(Operand input, AsString.Options... * @param options carries optional attributes values * @return a new instance of Cast */ - public Cast cast(Operand x, Class DstT, + public Cast cast(Operand x, Class DstT, Cast.Options... options) { return Cast.create(scope, x, DstT, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java index 13db1243c8a..9ef048655ba 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/ImageOps.java @@ -213,7 +213,7 @@ public CombinedNonMaxSuppression combinedNonMaxSuppression(Operand box * @param options carries optional attributes values * @return a new instance of CropAndResize */ - public CropAndResize cropAndResize(Operand image, Operand boxes, + public CropAndResize cropAndResize(Operand image, Operand boxes, Operand boxInd, Operand cropSize, CropAndResize.Options... options) { return CropAndResize.create(scope, image, boxes, boxInd, cropSize, options); } @@ -239,8 +239,8 @@ public CropAndResize cropAndResize(Operand image, Operand * @param options carries optional attributes values * @return a new instance of CropAndResizeGradBoxes */ - public CropAndResizeGradBoxes cropAndResizeGradBoxes(Operand grads, - Operand image, Operand boxes, Operand boxInd, + public CropAndResizeGradBoxes cropAndResizeGradBoxes(Operand grads, + Operand image, Operand boxes, Operand boxInd, CropAndResizeGradBoxes.Options... options) { return CropAndResizeGradBoxes.create(scope, grads, image, boxes, boxInd, options); } @@ -573,7 +573,7 @@ public EncodeJpegVariableQuality encodeJpegVariableQuality(Operand image * @param options carries optional attributes values * @return a new instance of EncodePng */ - public EncodePng encodePng(Operand image, EncodePng.Options... options) { + public EncodePng encodePng(Operand image, EncodePng.Options... options) { return EncodePng.create(scope, image, options); } @@ -791,7 +791,7 @@ public RandomCrop randomCrop(Operand image, Operand ResizeArea resizeArea(Operand images, Operand size, + public ResizeArea resizeArea(Operand images, Operand size, ResizeArea.Options... options) { return ResizeArea.create(scope, images, size, options); } @@ -807,7 +807,7 @@ public ResizeArea resizeArea(Operand images, Operand ResizeBicubic resizeBicubic(Operand images, Operand size, + public ResizeBicubic resizeBicubic(Operand images, Operand size, ResizeBicubic.Options... options) { return ResizeBicubic.create(scope, images, size, options); } @@ -823,7 +823,7 @@ public ResizeBicubic resizeBicubic(Operand images, Operan * @param options carries optional attributes values * @return a new instance of ResizeBilinear */ - public ResizeBilinear resizeBilinear(Operand images, Operand size, + public ResizeBilinear resizeBilinear(Operand images, Operand size, ResizeBilinear.Options... options) { return ResizeBilinear.create(scope, images, size, options); } @@ -939,7 +939,7 @@ public SampleDistortedBoundingBox sampleDistortedBounding * @param options carries optional attributes values * @return a new instance of ScaleAndTranslate */ - public ScaleAndTranslate scaleAndTranslate(Operand images, + public ScaleAndTranslate scaleAndTranslate(Operand images, Operand size, Operand scale, Operand translation, ScaleAndTranslate.Options... options) { return ScaleAndTranslate.create(scope, images, size, scale, translation, options); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java index f8d48de3690..f73859d91b9 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java @@ -895,8 +895,8 @@ public ReaderSerializeState readerSerializeState(Operand readerHandle) { * @param sparseShape 1-D. The `shape` of the minibatch `SparseTensor`. * @return a new instance of SerializeManySparse */ - public SerializeManySparse serializeManySparse( - Operand sparseIndices, Operand sparseValues, Operand sparseShape) { + public SerializeManySparse serializeManySparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape) { return SerializeManySparse.create(scope, sparseIndices, sparseValues, sparseShape); } @@ -919,9 +919,8 @@ public SerializeManySparse serializeManySparse( * (default) and `variant`. * @return a new instance of SerializeManySparse */ - public SerializeManySparse serializeManySparse( - Operand sparseIndices, Operand sparseValues, Operand sparseShape, - Class outType) { + public SerializeManySparse serializeManySparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, Class outType) { return SerializeManySparse.create(scope, sparseIndices, sparseValues, sparseShape, outType); } @@ -934,8 +933,8 @@ public SerializeManySparse serializeManySp * @param sparseShape 1-D. The `shape` of the `SparseTensor`. * @return a new instance of SerializeSparse */ - public SerializeSparse serializeSparse(Operand sparseIndices, - Operand sparseValues, Operand sparseShape) { + public SerializeSparse serializeSparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape) { return SerializeSparse.create(scope, sparseIndices, sparseValues, sparseShape); } @@ -950,9 +949,8 @@ public SerializeSparse serializeSparse(Operand SerializeSparse serializeSparse( - Operand sparseIndices, Operand sparseValues, Operand sparseShape, - Class outType) { + public SerializeSparse serializeSparse(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, Class outType) { return SerializeSparse.create(scope, sparseIndices, sparseValues, sparseShape, outType); } @@ -962,7 +960,7 @@ public SerializeSparse serializeSparse( * @param tensor A Tensor of type `T`. * @return a new instance of SerializeTensor */ - public SerializeTensor serializeTensor(Operand tensor) { + public SerializeTensor serializeTensor(Operand tensor) { return SerializeTensor.create(scope, tensor); } 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 f15c50fe691..f5d8d22e85e 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 @@ -342,8 +342,8 @@ public CholeskyGrad choleskyGrad(Operand l, Operand * @param perm * @return a new instance of ConjugateTranspose */ - public ConjugateTranspose conjugateTranspose(Operand x, - Operand perm) { + public ConjugateTranspose conjugateTranspose(Operand x, + Operand perm) { return ConjugateTranspose.create(scope, x, perm); } @@ -398,7 +398,7 @@ public Det det(Operand input) { * @param options carries optional attributes values * @return a new instance of Eig */ - public Eig eig(Operand input, Class Tout, + public Eig eig(Operand input, Class Tout, Eig.Options... options) { return Eig.create(scope, input, Tout, options); } @@ -505,8 +505,8 @@ public Einsum einsum(Iterable> inputs, String eq * @param options carries optional attributes values * @return a new instance of EuclideanNorm */ - public EuclideanNorm euclideanNorm(Operand input, - Operand axis, EuclideanNorm.Options... options) { + public EuclideanNorm euclideanNorm(Operand input, + Operand axis, EuclideanNorm.Options... options) { return EuclideanNorm.create(scope, input, axis, options); } @@ -1373,10 +1373,10 @@ public Qr qr(Operand input, Qr.Options... options) { * @param options carries optional attributes values * @return a new instance of QuantizedMatMul */ - public QuantizedMatMul quantizedMatMul( - Operand a, Operand b, Operand minA, Operand maxA, - Operand minB, Operand maxB, Class Toutput, Class Tactivation, - QuantizedMatMul.Options... options) { + public QuantizedMatMul quantizedMatMul( + Operand a, Operand b, Operand minA, + Operand maxA, Operand minB, Operand maxB, Class Toutput, + Class Tactivation, QuantizedMatMul.Options... options) { return QuantizedMatMul.create(scope, a, b, minA, maxA, minB, maxB, Toutput, Tactivation, options); } @@ -1544,8 +1544,7 @@ public TensorDiagPart tensorDiagPart(Operand input) { * @param perm * @return a new instance of Transpose */ - public Transpose transpose(Operand x, - Operand perm) { + public Transpose transpose(Operand x, Operand perm) { return Transpose.create(scope, x, perm); } 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 252a84fd745..5027828c262 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 @@ -264,7 +264,7 @@ public AddN addN(Iterable> inputs) { * @param input * @return a new instance of Angle */ - public Angle angle(Operand input) { + public Angle angle(Operand input) { return Angle.create(scope, input); } @@ -291,7 +291,7 @@ public Angle angle(Operand input) { * @param Tout * @return a new instance of Angle */ - public Angle angle(Operand input, Class Tout) { + public Angle angle(Operand input, Class Tout) { return Angle.create(scope, input, Tout); } @@ -330,8 +330,8 @@ public ApproximateEqual approximateEqual(Operand x, Operand * use dimension = 0. * @return a new instance of ArgMax */ - public ArgMax argMax(Operand input, - Operand dimension) { + public ArgMax argMax(Operand input, + Operand dimension) { return ArgMax.create(scope, input, dimension); } @@ -358,8 +358,8 @@ public ArgMax argMax(Operand inp * @param outputType * @return a new instance of ArgMax */ - public ArgMax argMax(Operand input, - Operand dimension, Class outputType) { + public ArgMax argMax(Operand input, + Operand dimension, Class outputType) { return ArgMax.create(scope, input, dimension, outputType); } @@ -385,8 +385,8 @@ public ArgMax argMax( * use dimension = 0. * @return a new instance of ArgMin */ - public ArgMin argMin(Operand input, - Operand dimension) { + public ArgMin argMin(Operand input, + Operand dimension) { return ArgMin.create(scope, input, dimension); } @@ -413,8 +413,8 @@ public ArgMin argMin(Operand inp * @param outputType * @return a new instance of ArgMin */ - public ArgMin argMin(Operand input, - Operand dimension, Class outputType) { + public ArgMin argMin(Operand input, + Operand dimension, Class outputType) { return ArgMin.create(scope, input, dimension, outputType); } @@ -635,7 +635,7 @@ public CompareAndBitpack compareAndBitpack(Operand input, * @param x * @return a new instance of ComplexAbs */ - public ComplexAbs complexAbs(Operand x) { + public ComplexAbs complexAbs(Operand x) { return ComplexAbs.create(scope, x); } @@ -652,8 +652,7 @@ public ComplexAbs complexAbs(Operand x) { * @param Tout * @return a new instance of ComplexAbs */ - public ComplexAbs complexAbs(Operand x, - Class Tout) { + public ComplexAbs complexAbs(Operand x, Class Tout) { return ComplexAbs.create(scope, x, Tout); } @@ -756,7 +755,7 @@ public Cosh cosh(Operand x) { * @param options carries optional attributes values * @return a new instance of Cumprod */ - public Cumprod cumprod(Operand x, Operand axis, + public Cumprod cumprod(Operand x, Operand axis, Cumprod.Options... options) { return Cumprod.create(scope, x, axis, options); } @@ -795,7 +794,7 @@ public Cumprod cumprod(Operand x, Ope * @param options carries optional attributes values * @return a new instance of Cumsum */ - public Cumsum cumsum(Operand x, Operand axis, + public Cumsum cumsum(Operand x, Operand axis, Cumsum.Options... options) { return Cumsum.create(scope, x, axis, options); } @@ -1157,7 +1156,7 @@ public Igammac igammac(Operand a, Operand x) { * @param input * @return a new instance of Imag */ - public Imag imag(Operand input) { + public Imag imag(Operand input) { return Imag.create(scope, input); } @@ -1180,7 +1179,7 @@ public Imag imag(Operand input) { * @param Tout * @return a new instance of Imag */ - public Imag imag(Operand input, Class Tout) { + public Imag imag(Operand input, Class Tout) { return Imag.create(scope, input, Tout); } @@ -1224,7 +1223,7 @@ public InvertPermutation invertPermutation(Operand x) * @param x * @return a new instance of IsFinite */ - public IsFinite isFinite(Operand x) { + public IsFinite isFinite(Operand x) { return IsFinite.create(scope, x); } @@ -1242,7 +1241,7 @@ public IsFinite isFinite(Operand x) { * @param x * @return a new instance of IsInf */ - public IsInf isInf(Operand x) { + public IsInf isInf(Operand x) { return IsInf.create(scope, x); } @@ -1260,7 +1259,7 @@ public IsInf isInf(Operand x) { * @param x * @return a new instance of IsNan */ - public IsNan isNan(Operand x) { + public IsNan isNan(Operand x) { return IsNan.create(scope, x); } @@ -1440,7 +1439,7 @@ public Maximum maximum(Operand x, Operand y) { * @param options carries optional attributes values * @return a new instance of Mean */ - public Mean mean(Operand input, Operand axis, + public Mean mean(Operand input, Operand axis, Mean.Options... options) { return Mean.create(scope, input, axis, options); } @@ -1598,7 +1597,7 @@ public Polygamma polygamma(Operand a, Operand x) { * @param x * @return a new instance of PopulationCount */ - public PopulationCount populationCount(Operand x) { + public PopulationCount populationCount(Operand x) { return PopulationCount.create(scope, x); } @@ -1635,8 +1634,8 @@ public Pow pow(Operand x, Operand y) { * @param Toutput * @return a new instance of QuantizedAdd */ - public QuantizedAdd quantizedAdd( - Operand x, Operand y, Operand minX, Operand maxX, + public QuantizedAdd quantizedAdd(Operand x, + Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { return QuantizedAdd.create(scope, x, y, minX, maxX, minY, maxY, Toutput); } @@ -1654,8 +1653,8 @@ public QuantizedAdd quant * @param Toutput * @return a new instance of QuantizedMul */ - public QuantizedMul quantizedMul( - Operand x, Operand y, Operand minX, Operand maxX, + public QuantizedMul quantizedMul(Operand x, + Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { return QuantizedMul.create(scope, x, y, minX, maxX, minY, maxY, Toutput); } @@ -1678,7 +1677,7 @@ public QuantizedMul quant * @param input * @return a new instance of Real */ - public Real real(Operand input) { + public Real real(Operand input) { return Real.create(scope, input); } @@ -1701,7 +1700,7 @@ public Real real(Operand input) { * @param Tout * @return a new instance of Real */ - public Real real(Operand input, Class Tout) { + public Real real(Operand input, Class Tout) { return Real.create(scope, input, Tout); } @@ -1813,8 +1812,8 @@ public Rsqrt rsqrt(Operand x) { * first dimension. Values should be sorted and can be repeated. * @return a new instance of SegmentMax */ - public SegmentMax segmentMax(Operand data, - Operand segmentIds) { + public SegmentMax segmentMax(Operand data, + Operand segmentIds) { return SegmentMax.create(scope, data, segmentIds); } @@ -1850,8 +1849,8 @@ public SegmentMax segmentMax(Operand SegmentMean segmentMean(Operand data, - Operand segmentIds) { + public SegmentMean segmentMean(Operand data, + Operand segmentIds) { return SegmentMean.create(scope, data, segmentIds); } @@ -1886,8 +1885,8 @@ public SegmentMean segmentMean(Operand SegmentMin segmentMin(Operand data, - Operand segmentIds) { + public SegmentMin segmentMin(Operand data, + Operand segmentIds) { return SegmentMin.create(scope, data, segmentIds); } @@ -1922,8 +1921,8 @@ public SegmentMin segmentMin(Operand SegmentProd segmentProd(Operand data, - Operand segmentIds) { + public SegmentProd segmentProd(Operand data, + Operand segmentIds) { return SegmentProd.create(scope, data, segmentIds); } @@ -1958,8 +1957,8 @@ public SegmentProd segmentProd(Operand SegmentSum segmentSum(Operand data, - Operand segmentIds) { + public SegmentSum segmentSum(Operand data, + Operand segmentIds) { return SegmentSum.create(scope, data, segmentIds); } @@ -2220,8 +2219,8 @@ public TruncateMod truncateMod(Operand x, Operand y * @param numSegments * @return a new instance of UnsortedSegmentMax */ - public UnsortedSegmentMax unsortedSegmentMax( - Operand data, Operand segmentIds, Operand numSegments) { + public UnsortedSegmentMax unsortedSegmentMax(Operand data, + Operand segmentIds, Operand numSegments) { return UnsortedSegmentMax.create(scope, data, segmentIds, numSegments); } @@ -2259,8 +2258,8 @@ public UnsortedSegment * @param numSegments * @return a new instance of UnsortedSegmentMin */ - public UnsortedSegmentMin unsortedSegmentMin( - Operand data, Operand segmentIds, Operand numSegments) { + public UnsortedSegmentMin unsortedSegmentMin(Operand data, + Operand segmentIds, Operand numSegments) { return UnsortedSegmentMin.create(scope, data, segmentIds, numSegments); } @@ -2297,8 +2296,8 @@ public UnsortedSegment * @param numSegments * @return a new instance of UnsortedSegmentProd */ - public UnsortedSegmentProd unsortedSegmentProd( - Operand data, Operand segmentIds, Operand numSegments) { + public UnsortedSegmentProd unsortedSegmentProd(Operand data, + Operand segmentIds, Operand numSegments) { return UnsortedSegmentProd.create(scope, data, segmentIds, numSegments); } @@ -2337,8 +2336,8 @@ public UnsortedSegmentPr * @param numSegments * @return a new instance of UnsortedSegmentSum */ - public UnsortedSegmentSum unsortedSegmentSum( - Operand data, Operand segmentIds, Operand numSegments) { + public UnsortedSegmentSum unsortedSegmentSum(Operand data, + Operand segmentIds, Operand numSegments) { return UnsortedSegmentSum.create(scope, data, segmentIds, numSegments); } 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 8b5b01fac32..5ec7f93020f 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 @@ -434,9 +434,9 @@ public Conv3dBackpropFilter conv3dBackpropFilter(Operand< * @param options carries optional attributes values * @return a new instance of Conv3dBackpropInput */ - public Conv3dBackpropInput conv3dBackpropInput( - Operand inputSizes, Operand filter, Operand outBackprop, List strides, - String padding, Conv3dBackpropInput.Options... options) { + public Conv3dBackpropInput conv3dBackpropInput( + Operand inputSizes, Operand filter, Operand outBackprop, + List strides, String padding, Conv3dBackpropInput.Options... options) { return Conv3dBackpropInput.create(scope, inputSizes, filter, outBackprop, strides, padding, options); } @@ -1444,9 +1444,9 @@ public MaxPoolGradGrad maxPoolGradGrad(Operand origInp * @param options carries optional attributes values * @return a new instance of MaxPoolGradGradWithArgmax */ - public MaxPoolGradGradWithArgmax maxPoolGradGradWithArgmax( - Operand input, Operand grad, Operand argmax, List ksize, List strides, - String padding, MaxPoolGradGradWithArgmax.Options... options) { + public MaxPoolGradGradWithArgmax maxPoolGradGradWithArgmax( + Operand input, Operand grad, Operand argmax, List ksize, + List strides, String padding, MaxPoolGradGradWithArgmax.Options... options) { return MaxPoolGradGradWithArgmax.create(scope, input, grad, argmax, ksize, strides, padding, options); } @@ -1610,8 +1610,8 @@ public QuantizedBatchNormWithGlobalNormalizat * @param outType * @return a new instance of QuantizedBiasAdd */ - public QuantizedBiasAdd quantizedBiasAdd( - Operand input, Operand bias, Operand minInput, Operand maxInput, + public QuantizedBiasAdd quantizedBiasAdd(Operand input, + Operand bias, Operand minInput, Operand maxInput, Operand minBias, Operand maxBias, Class outType) { return QuantizedBiasAdd.create(scope, input, bias, minInput, maxInput, minBias, maxBias, outType); } @@ -1638,8 +1638,8 @@ public QuantizedBiasAdd q * @param options carries optional attributes values * @return a new instance of QuantizedConv2d */ - public QuantizedConv2d quantizedConv2d( - Operand input, Operand filter, Operand minInput, Operand maxInput, + public QuantizedConv2d quantizedConv2d(Operand input, + Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, QuantizedConv2d.Options... options) { return QuantizedConv2d.create(scope, input, filter, minInput, maxInput, minFilter, maxFilter, outType, strides, padding, options); @@ -1690,7 +1690,7 @@ public QuantizedMaxPool quantizedMaxPool(Operand input, * @param outType * @return a new instance of QuantizedRelu */ - public QuantizedRelu quantizedRelu(Operand features, + public QuantizedRelu quantizedRelu(Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { return QuantizedRelu.create(scope, features, minFeatures, maxFeatures, outType); } @@ -1705,7 +1705,7 @@ public QuantizedRelu quantizedRelu(Operand * @param outType * @return a new instance of QuantizedRelu6 */ - public QuantizedRelu6 quantizedRelu6(Operand features, + public QuantizedRelu6 quantizedRelu6(Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { return QuantizedRelu6.create(scope, features, minFeatures, maxFeatures, outType); } @@ -1721,7 +1721,7 @@ public QuantizedRelu6 quantizedRelu6(Opera * @param outType * @return a new instance of QuantizedReluX */ - public QuantizedReluX quantizedReluX(Operand features, + public QuantizedReluX quantizedReluX(Operand features, Operand maxValue, Operand minFeatures, Operand maxFeatures, Class outType) { return QuantizedReluX.create(scope, features, maxValue, minFeatures, maxFeatures, outType); @@ -1985,8 +1985,8 @@ public Softsign softsign(Operand features) { * @param blockSize * @return a new instance of SpaceToBatch */ - public SpaceToBatch spaceToBatch(Operand input, - Operand paddings, Long blockSize) { + public SpaceToBatch spaceToBatch(Operand input, + Operand paddings, Long blockSize) { return SpaceToBatch.create(scope, input, paddings, blockSize); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnRawOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnRawOps.java index 64cecadbe6d..13c6baa651a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnRawOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/NnRawOps.java @@ -70,8 +70,8 @@ public SoftmaxCrossEntropyWithLogits softmaxCrossEntropyW * This is the label for the given minibatch entry. * @return a new instance of SparseSoftmaxCrossEntropyWithLogits */ - public SparseSoftmaxCrossEntropyWithLogits sparseSoftmaxCrossEntropyWithLogits( - Operand features, Operand labels) { + public SparseSoftmaxCrossEntropyWithLogits sparseSoftmaxCrossEntropyWithLogits( + Operand features, Operand labels) { return SparseSoftmaxCrossEntropyWithLogits.create(scope, features, labels); } 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 23ca3497412..810acfcbc25 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 @@ -243,8 +243,6 @@ import org.tensorflow.op.core.TensorListSetItem; import org.tensorflow.op.core.TensorListSplit; import org.tensorflow.op.core.TensorListStack; -import org.tensorflow.op.core.TensorScatterMax; -import org.tensorflow.op.core.TensorScatterMin; import org.tensorflow.op.core.TensorScatterNdAdd; import org.tensorflow.op.core.TensorScatterNdMax; import org.tensorflow.op.core.TensorScatterNdMin; @@ -405,8 +403,7 @@ public Abort abort(Abort.Options... options) { * @param options carries optional attributes values * @return a new instance of All */ - public All all(Operand input, Operand axis, - All.Options... options) { + public All all(Operand input, Operand axis, All.Options... options) { return All.create(scope, input, axis, options); } @@ -424,8 +421,7 @@ public All all(Operand input, Operand axis, * @param options carries optional attributes values * @return a new instance of Any */ - public Any any(Operand input, Operand axis, - Any.Options... options) { + public Any any(Operand input, Operand axis, Any.Options... options) { return Any.create(scope, input, axis, options); } @@ -579,8 +575,8 @@ public AssignAdd assignAdd(Operand ref, Operand value * @param value the value by which the variable will be incremented. * @return a new instance of AssignAddVariableOp */ - public AssignAddVariableOp assignAddVariableOp(Operand resource, - Operand value) { + public AssignAddVariableOp assignAddVariableOp(Operand resource, + Operand value) { return AssignAddVariableOp.create(scope, resource, value); } @@ -611,8 +607,8 @@ public AssignSub assignSub(Operand ref, Operand value * @param value the value by which the variable will be incremented. * @return a new instance of AssignSubVariableOp */ - public AssignSubVariableOp assignSubVariableOp(Operand resource, - Operand value) { + public AssignSubVariableOp assignSubVariableOp(Operand resource, + Operand value) { return AssignSubVariableOp.create(scope, resource, value); } @@ -626,8 +622,7 @@ public AssignSubVariableOp assignSubVariableOp(Operand reso * @param value the value to set the new tensor to use. * @return a new instance of AssignVariableOp */ - public AssignVariableOp assignVariableOp(Operand resource, - Operand value) { + public AssignVariableOp assignVariableOp(Operand resource, Operand value) { return AssignVariableOp.create(scope, resource, value); } @@ -694,8 +689,8 @@ public BarrierIncompleteSize barrierIncompleteSize(Operand handle) { * @param componentIndex The component of the barrier elements that is being assigned. * @return a new instance of BarrierInsertMany */ - public BarrierInsertMany barrierInsertMany(Operand handle, - Operand keys, Operand values, Long componentIndex) { + public BarrierInsertMany barrierInsertMany(Operand handle, Operand keys, + Operand values, Long componentIndex) { return BarrierInsertMany.create(scope, handle, keys, values, componentIndex); } @@ -809,8 +804,8 @@ public Batch batch(Iterable> inTensors, Long numBatchThreads, Long ma * @param blockSize * @return a new instance of BatchToSpace */ - public BatchToSpace batchToSpace(Operand input, - Operand crops, Long blockSize) { + public BatchToSpace batchToSpace(Operand input, + Operand crops, Long blockSize) { return BatchToSpace.create(scope, input, crops, blockSize); } @@ -924,8 +919,8 @@ public BatchToSpace batchToSpace(Operand * } * @return a new instance of BatchToSpaceNd */ - public BatchToSpaceNd batchToSpaceNd( - Operand input, Operand blockShape, Operand crops) { + public BatchToSpaceNd batchToSpaceNd(Operand input, + Operand blockShape, Operand crops) { return BatchToSpaceNd.create(scope, input, blockShape, crops); } @@ -988,7 +983,7 @@ public BatchToSpaceNd * @param type * @return a new instance of Bitcast */ - public Bitcast bitcast(Operand input, Class type) { + public Bitcast bitcast(Operand input, Class type) { return Bitcast.create(scope, input, type); } @@ -1044,8 +1039,8 @@ public BroadcastDynamicShape broadcastDynamicShape(Operan * @param shape An 1-D `int` Tensor. The shape of the desired output. * @return a new instance of BroadcastTo */ - public BroadcastTo broadcastTo(Operand input, - Operand shape) { + public BroadcastTo broadcastTo(Operand input, + Operand shape) { return BroadcastTo.create(scope, input, shape); } @@ -1067,7 +1062,7 @@ public BroadcastTo broadcastTo(Operand Bucketize bucketize(Operand input, List boundaries) { + public Bucketize bucketize(Operand input, List boundaries) { return Bucketize.create(scope, input, boundaries); } @@ -1102,8 +1097,8 @@ public ClipByValue clipByValue(Operand t, Operand cli * range [-rank(values), rank(values)). * @return a new instance of Concat */ - public Concat concat(Iterable> values, - Operand axis) { + public Concat concat(Iterable> values, + Operand axis) { return Concat.create(scope, values, axis); } @@ -2158,8 +2153,8 @@ public Empty empty(Operand shape, Class dtype, * @param elementDtype * @return a new instance of EmptyTensorList */ - public EmptyTensorList emptyTensorList( - Operand elementShape, Operand maxNumElements, Class elementDtype) { + public EmptyTensorList emptyTensorList(Operand elementShape, + Operand maxNumElements, Class elementDtype) { return EmptyTensorList.create(scope, elementShape, maxNumElements, elementDtype); } @@ -2217,8 +2212,8 @@ public EnsureShape ensureShape(Operand input, Shape shap * `[-rank(input) - 1, rank(input)]`. * @return a new instance of ExpandDims */ - public ExpandDims expandDims(Operand input, - Operand axis) { + public ExpandDims expandDims(Operand input, + Operand axis) { return ExpandDims.create(scope, input, axis); } @@ -2278,7 +2273,7 @@ public ExtractVolumePatches extractVolumePatches(Operand< * @end_compatibility * @return a new instance of Fill */ - public Fill fill(Operand dims, Operand value) { + public Fill fill(Operand dims, Operand value) { return Fill.create(scope, dims, value); } @@ -2319,7 +2314,7 @@ public Fill fill(Operand dims, Operan * `farmhash::fingerprint64`. * @return a new instance of Fingerprint */ - public Fingerprint fingerprint(Operand data, Operand method) { + public Fingerprint fingerprint(Operand data, Operand method) { return Fingerprint.create(scope, data, method); } @@ -2361,8 +2356,8 @@ public Fingerprint fingerprint(Operand data, Operand Gather gather(Operand params, - Operand indices, Operand axis, Gather.Options... options) { + public Gather gather(Operand params, Operand indices, + Operand axis, Gather.Options... options) { return Gather.create(scope, params, indices, axis, options); } @@ -2467,8 +2462,8 @@ public Gather gather( * @param indices Index tensor. * @return a new instance of GatherNd */ - public GatherNd gatherNd(Operand params, - Operand indices) { + public GatherNd gatherNd(Operand params, + Operand indices) { return GatherNd.create(scope, params, indices); } @@ -2478,7 +2473,7 @@ public GatherNd gatherNd(Operand para * @param value The tensor to be stored. * @return a new instance of GetSessionHandle */ - public GetSessionHandle getSessionHandle(Operand value) { + public GetSessionHandle getSessionHandle(Operand value) { return GetSessionHandle.create(scope, value); } @@ -2774,8 +2769,8 @@ public void initAdd(Op initializer) { * @param values Values of type Tval. * @return a new instance of InitializeTable */ - public InitializeTable initializeTable(Operand tableHandle, - Operand keys, Operand values) { + public InitializeTable initializeTable(Operand tableHandle, Operand keys, + Operand values) { return InitializeTable.create(scope, tableHandle, keys, values); } @@ -2864,7 +2859,7 @@ public InplaceUpdate inplaceUpdate(Operand x, Operand IsVariableInitialized isVariableInitialized(Operand ref) { + public IsVariableInitialized isVariableInitialized(Operand ref) { return IsVariableInitialized.create(scope, ref); } @@ -2898,8 +2893,8 @@ public LookupTableExport lookupTableExp * @param defaultValue * @return a new instance of LookupTableFind */ - public LookupTableFind lookupTableFind( - Operand tableHandle, Operand keys, Operand defaultValue) { + public LookupTableFind lookupTableFind(Operand tableHandle, + Operand keys, Operand defaultValue) { return LookupTableFind.create(scope, tableHandle, keys, defaultValue); } @@ -2914,8 +2909,8 @@ public LookupTableFind lookupTableFind( * @param values Values to associate with keys. * @return a new instance of LookupTableImport */ - public LookupTableImport lookupTableImport( - Operand tableHandle, Operand keys, Operand values) { + public LookupTableImport lookupTableImport(Operand tableHandle, Operand keys, + Operand values) { return LookupTableImport.create(scope, tableHandle, keys, values); } @@ -2930,8 +2925,8 @@ public LookupTableImport lookupTableImport( * @param values Values to associate with keys. * @return a new instance of LookupTableInsert */ - public LookupTableInsert lookupTableInsert( - Operand tableHandle, Operand keys, Operand values) { + public LookupTableInsert lookupTableInsert(Operand tableHandle, Operand keys, + Operand values) { return LookupTableInsert.create(scope, tableHandle, keys, values); } @@ -3074,7 +3069,7 @@ public MapUnstageNoKey mapUnstageNoKey(Operand indices, * @param options carries optional attributes values * @return a new instance of Max */ - public Max max(Operand input, Operand axis, + public Max max(Operand input, Operand axis, Max.Options... options) { return Max.create(scope, input, axis, options); } @@ -3111,7 +3106,7 @@ public Merge merge(Iterable> inputs) { * @param options carries optional attributes values * @return a new instance of Min */ - public Min min(Operand input, Operand axis, + public Min min(Operand input, Operand axis, Min.Options... options) { return Min.create(scope, input, axis, options); } @@ -3155,8 +3150,8 @@ public Min min(Operand input, Operand * it is `[1, 2, 3, 3, 2]` in symmetric mode. * @return a new instance of MirrorPad */ - public MirrorPad mirrorPad(Operand input, - Operand paddings, String mode) { + public MirrorPad mirrorPad(Operand input, + Operand paddings, String mode) { return MirrorPad.create(scope, input, paddings, mode); } @@ -3424,7 +3419,7 @@ public NoOp noOp() { * @param options carries optional attributes values * @return a new instance of OneHot */ - public OneHot oneHot(Operand indices, + public OneHot oneHot(Operand indices, Operand depth, Operand onValue, Operand offValue, OneHot.Options... options) { return OneHot.create(scope, indices, depth, onValue, offValue, options); } @@ -3592,7 +3587,7 @@ public OrderedMapUnstageNoKey orderedMapUnstageNoKey(Operand indices, * @param constantValues * @return a new instance of Pad */ - public Pad pad(Operand input, Operand paddings, + public Pad pad(Operand input, Operand paddings, Operand constantValues) { return Pad.create(scope, input, paddings, constantValues); } @@ -3752,7 +3747,7 @@ public Print print(Operand input, Print.Options... options) { * @param options carries optional attributes values * @return a new instance of Prod */ - public Prod prod(Operand input, Operand axis, + public Prod prod(Operand input, Operand axis, Prod.Options... options) { return Prod.create(scope, input, axis, options); } @@ -3769,8 +3764,8 @@ public Prod prod(Operand input, Opera * @param inputMax The maximum value of the input. * @return a new instance of QuantizedReshape */ - public QuantizedReshape quantizedReshape( - Operand tensor, Operand shape, Operand inputMin, Operand inputMax) { + public QuantizedReshape quantizedReshape(Operand tensor, + Operand shape, Operand inputMin, Operand inputMax) { return QuantizedReshape.create(scope, tensor, shape, inputMin, inputMax); } @@ -3816,7 +3811,7 @@ public Range range(Operand start, Operand limit, Op * @param input * @return a new instance of Rank */ - public Rank rank(Operand input) { + public Rank rank(Operand input) { return Rank.create(scope, input); } @@ -3853,7 +3848,7 @@ public ReadVariableOp readVariableOp(Operand resource, C * @param options carries optional attributes values * @return a new instance of ReduceAll */ - public ReduceAll reduceAll(Operand input, Operand axis, + public ReduceAll reduceAll(Operand input, Operand axis, ReduceAll.Options... options) { return ReduceAll.create(scope, input, axis, options); } @@ -3872,7 +3867,7 @@ public ReduceAll reduceAll(Operand input, Operand * @param options carries optional attributes values * @return a new instance of ReduceAny */ - public ReduceAny reduceAny(Operand input, Operand axis, + public ReduceAny reduceAny(Operand input, Operand axis, ReduceAny.Options... options) { return ReduceAny.create(scope, input, axis, options); } @@ -3892,8 +3887,8 @@ public ReduceAny reduceAny(Operand input, Operand * @param options carries optional attributes values * @return a new instance of ReduceMax */ - public ReduceMax reduceMax(Operand input, - Operand axis, ReduceMax.Options... options) { + public ReduceMax reduceMax(Operand input, Operand axis, + ReduceMax.Options... options) { return ReduceMax.create(scope, input, axis, options); } @@ -3912,8 +3907,8 @@ public ReduceMax reduceMax(Operand in * @param options carries optional attributes values * @return a new instance of ReduceMin */ - public ReduceMin reduceMin(Operand input, - Operand axis, ReduceMin.Options... options) { + public ReduceMin reduceMin(Operand input, Operand axis, + ReduceMin.Options... options) { return ReduceMin.create(scope, input, axis, options); } @@ -3932,8 +3927,8 @@ public ReduceMin reduceMin(Operand in * @param options carries optional attributes values * @return a new instance of ReduceProd */ - public ReduceProd reduceProd(Operand input, - Operand axis, ReduceProd.Options... options) { + public ReduceProd reduceProd(Operand input, + Operand axis, ReduceProd.Options... options) { return ReduceProd.create(scope, input, axis, options); } @@ -3952,8 +3947,8 @@ public ReduceProd reduceProd(Operand * @param options carries optional attributes values * @return a new instance of ReduceSum */ - public ReduceSum reduceSum(Operand input, - Operand axis, ReduceSum.Options... options) { + public ReduceSum reduceSum(Operand input, Operand axis, + ReduceSum.Options... options) { return ReduceSum.create(scope, input, axis, options); } @@ -4087,8 +4082,7 @@ public RemoteFusedGraphExecute remoteFusedGraphExecute(Iterable> inpu * @param shape Defines the shape of the output tensor. * @return a new instance of Reshape */ - public Reshape reshape(Operand tensor, - Operand shape) { + public Reshape reshape(Operand tensor, Operand shape) { return Reshape.create(scope, tensor, shape); } @@ -4130,8 +4124,8 @@ public ResourceCountUpTo resourceCountUpTo(Operand res * @param options carries optional attributes values * @return a new instance of ResourceGather */ - public ResourceGather resourceGather(Operand resource, - Operand indices, Class dtype, ResourceGather.Options... options) { + public ResourceGather resourceGather(Operand resource, + Operand indices, Class dtype, ResourceGather.Options... options) { return ResourceGather.create(scope, resource, indices, dtype, options); } @@ -4143,8 +4137,8 @@ public ResourceGather resourceGather(Ope * @param dtype * @return a new instance of ResourceGatherNd */ - public ResourceGatherNd resourceGatherNd( - Operand resource, Operand indices, Class dtype) { + public ResourceGatherNd resourceGatherNd(Operand resource, + Operand indices, Class dtype) { return ResourceGatherNd.create(scope, resource, indices, dtype); } @@ -4176,8 +4170,8 @@ public ResourceGatherNd resourceGatherNd * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterAdd */ - public ResourceScatterAdd resourceScatterAdd( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterAdd resourceScatterAdd(Operand resource, + Operand indices, Operand updates) { return ResourceScatterAdd.create(scope, resource, indices, updates); } @@ -4209,8 +4203,8 @@ public ResourceScatterAdd resourceScatterAd * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterDiv */ - public ResourceScatterDiv resourceScatterDiv( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterDiv resourceScatterDiv(Operand resource, + Operand indices, Operand updates) { return ResourceScatterDiv.create(scope, resource, indices, updates); } @@ -4242,8 +4236,8 @@ public ResourceScatterDiv resourceScatterDi * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterMax */ - public ResourceScatterMax resourceScatterMax( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterMax resourceScatterMax(Operand resource, + Operand indices, Operand updates) { return ResourceScatterMax.create(scope, resource, indices, updates); } @@ -4275,8 +4269,8 @@ public ResourceScatterMax resourceScatterMa * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterMin */ - public ResourceScatterMin resourceScatterMin( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterMin resourceScatterMin(Operand resource, + Operand indices, Operand updates) { return ResourceScatterMin.create(scope, resource, indices, updates); } @@ -4308,8 +4302,8 @@ public ResourceScatterMin resourceScatterMi * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterMul */ - public ResourceScatterMul resourceScatterMul( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterMul resourceScatterMul(Operand resource, + Operand indices, Operand updates) { return ResourceScatterMul.create(scope, resource, indices, updates); } @@ -4354,8 +4348,8 @@ public ResourceScatterMul resourceScatterMu * @param options carries optional attributes values * @return a new instance of ResourceScatterNdAdd */ - public ResourceScatterNdAdd resourceScatterNdAdd( - Operand ref, Operand indices, Operand updates, + public ResourceScatterNdAdd resourceScatterNdAdd(Operand ref, + Operand indices, Operand updates, ResourceScatterNdAdd.Options... options) { return ResourceScatterNdAdd.create(scope, ref, indices, updates, options); } @@ -4370,8 +4364,8 @@ public ResourceScatterNdAdd resourceScatter * @param options carries optional attributes values * @return a new instance of ResourceScatterNdMax */ - public ResourceScatterNdMax resourceScatterNdMax( - Operand ref, Operand indices, Operand updates, + public ResourceScatterNdMax resourceScatterNdMax(Operand ref, + Operand indices, Operand updates, ResourceScatterNdMax.Options... options) { return ResourceScatterNdMax.create(scope, ref, indices, updates, options); } @@ -4386,8 +4380,8 @@ public ResourceScatterNdMax resourceScatter * @param options carries optional attributes values * @return a new instance of ResourceScatterNdMin */ - public ResourceScatterNdMin resourceScatterNdMin( - Operand ref, Operand indices, Operand updates, + public ResourceScatterNdMin resourceScatterNdMin(Operand ref, + Operand indices, Operand updates, ResourceScatterNdMin.Options... options) { return ResourceScatterNdMin.create(scope, ref, indices, updates, options); } @@ -4433,8 +4427,8 @@ public ResourceScatterNdMin resourceScatter * @param options carries optional attributes values * @return a new instance of ResourceScatterNdSub */ - public ResourceScatterNdSub resourceScatterNdSub( - Operand ref, Operand indices, Operand updates, + public ResourceScatterNdSub resourceScatterNdSub(Operand ref, + Operand indices, Operand updates, ResourceScatterNdSub.Options... options) { return ResourceScatterNdSub.create(scope, ref, indices, updates, options); } @@ -4482,8 +4476,8 @@ public ResourceScatterNdSub resourceScatter * @param options carries optional attributes values * @return a new instance of ResourceScatterNdUpdate */ - public ResourceScatterNdUpdate resourceScatterNdUpdate( - Operand ref, Operand indices, Operand updates, + public ResourceScatterNdUpdate resourceScatterNdUpdate(Operand ref, + Operand indices, Operand updates, ResourceScatterNdUpdate.Options... options) { return ResourceScatterNdUpdate.create(scope, ref, indices, updates, options); } @@ -4516,8 +4510,8 @@ public ResourceScatterNdUpdate resourceScat * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterSub */ - public ResourceScatterSub resourceScatterSub( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterSub resourceScatterSub(Operand resource, + Operand indices, Operand updates) { return ResourceScatterSub.create(scope, resource, indices, updates); } @@ -4540,8 +4534,8 @@ public ResourceScatterSub resourceScatterSu * @param updates A tensor of updated values to add to `ref`. * @return a new instance of ResourceScatterUpdate */ - public ResourceScatterUpdate resourceScatterUpdate( - Operand resource, Operand indices, Operand updates) { + public ResourceScatterUpdate resourceScatterUpdate(Operand resource, + Operand indices, Operand updates) { return ResourceScatterUpdate.create(scope, resource, indices, updates); } @@ -4563,8 +4557,8 @@ public ResourceScatterUpdate resourceScatte * @param options carries optional attributes values * @return a new instance of ResourceStridedSliceAssign */ - public ResourceStridedSliceAssign resourceStridedSliceAssign( - Operand ref, Operand begin, Operand end, Operand strides, Operand value, + public ResourceStridedSliceAssign resourceStridedSliceAssign(Operand ref, + Operand begin, Operand end, Operand strides, Operand value, ResourceStridedSliceAssign.Options... options) { return ResourceStridedSliceAssign.create(scope, ref, begin, end, strides, value, options); } @@ -4624,8 +4618,7 @@ public ResourceStridedSliceAssign resourceS * `[-rank(tensor), rank(tensor))`. * @return a new instance of Reverse */ - public Reverse reverse(Operand tensor, - Operand axis) { + public Reverse reverse(Operand tensor, Operand axis) { return Reverse.create(scope, tensor, axis); } @@ -4692,8 +4685,8 @@ public Reverse reverse(Operand tensor * @param options carries optional attributes values * @return a new instance of ReverseSequence */ - public ReverseSequence reverseSequence(Operand input, - Operand seqLengths, Long seqDim, ReverseSequence.Options... options) { + public ReverseSequence reverseSequence(Operand input, + Operand seqLengths, Long seqDim, ReverseSequence.Options... options) { return ReverseSequence.create(scope, input, seqLengths, seqDim, options); } @@ -4732,8 +4725,8 @@ public ReverseSequence reverseSequence(O * axis. * @return a new instance of Roll */ - public Roll roll(Operand input, - Operand shift, Operand axis) { + public Roll roll(Operand input, Operand shift, + Operand axis) { return Roll.create(scope, input, shift, axis); } @@ -4834,8 +4827,8 @@ public Rpc rpc(Operand address, Operand method, Operand ScatterAdd scatterAdd(Operand ref, - Operand indices, Operand updates, ScatterAdd.Options... options) { + public ScatterAdd scatterAdd(Operand ref, + Operand indices, Operand updates, ScatterAdd.Options... options) { return ScatterAdd.create(scope, ref, indices, updates, options); } @@ -4868,8 +4861,8 @@ public ScatterAdd scatterAdd(Operand * @param options carries optional attributes values * @return a new instance of ScatterDiv */ - public ScatterDiv scatterDiv(Operand ref, - Operand indices, Operand updates, ScatterDiv.Options... options) { + public ScatterDiv scatterDiv(Operand ref, + Operand indices, Operand updates, ScatterDiv.Options... options) { return ScatterDiv.create(scope, ref, indices, updates, options); } @@ -4906,8 +4899,8 @@ public ScatterDiv scatterDiv(Operand * @param options carries optional attributes values * @return a new instance of ScatterMax */ - public ScatterMax scatterMax(Operand ref, - Operand indices, Operand updates, ScatterMax.Options... options) { + public ScatterMax scatterMax(Operand ref, + Operand indices, Operand updates, ScatterMax.Options... options) { return ScatterMax.create(scope, ref, indices, updates, options); } @@ -4944,8 +4937,8 @@ public ScatterMax scatterMax(Operand ScatterMin scatterMin(Operand ref, - Operand indices, Operand updates, ScatterMin.Options... options) { + public ScatterMin scatterMin(Operand ref, + Operand indices, Operand updates, ScatterMin.Options... options) { return ScatterMin.create(scope, ref, indices, updates, options); } @@ -4978,8 +4971,8 @@ public ScatterMin scatterMin(Operand ScatterMul scatterMul(Operand ref, - Operand indices, Operand updates, ScatterMul.Options... options) { + public ScatterMul scatterMul(Operand ref, + Operand indices, Operand updates, ScatterMul.Options... options) { return ScatterMul.create(scope, ref, indices, updates, options); } @@ -5116,8 +5109,8 @@ public ScatterNd scatterNd(Operand in * @param options carries optional attributes values * @return a new instance of ScatterNdAdd */ - public ScatterNdAdd scatterNdAdd(Operand ref, - Operand indices, Operand updates, ScatterNdAdd.Options... options) { + public ScatterNdAdd scatterNdAdd(Operand ref, + Operand indices, Operand updates, ScatterNdAdd.Options... options) { return ScatterNdAdd.create(scope, ref, indices, updates, options); } @@ -5166,8 +5159,8 @@ public ScatterNdAdd scatterNdAdd(Operand * to add to `input`. * @return a new instance of ScatterNdNonAliasingAdd */ - public ScatterNdNonAliasingAdd scatterNdNonAliasingAdd( - Operand input, Operand indices, Operand updates) { + public ScatterNdNonAliasingAdd scatterNdNonAliasingAdd(Operand input, + Operand indices, Operand updates) { return ScatterNdNonAliasingAdd.create(scope, input, indices, updates); } @@ -5215,8 +5208,8 @@ public ScatterNdNonAliasingAdd scatterNd * @param options carries optional attributes values * @return a new instance of ScatterNdSub */ - public ScatterNdSub scatterNdSub(Operand ref, - Operand indices, Operand updates, ScatterNdSub.Options... options) { + public ScatterNdSub scatterNdSub(Operand ref, + Operand indices, Operand updates, ScatterNdSub.Options... options) { return ScatterNdSub.create(scope, ref, indices, updates, options); } @@ -5266,8 +5259,8 @@ public ScatterNdSub scatterNdSub(Operand * @param options carries optional attributes values * @return a new instance of ScatterNdUpdate */ - public ScatterNdUpdate scatterNdUpdate(Operand ref, - Operand indices, Operand updates, ScatterNdUpdate.Options... options) { + public ScatterNdUpdate scatterNdUpdate(Operand ref, + Operand indices, Operand updates, ScatterNdUpdate.Options... options) { return ScatterNdUpdate.create(scope, ref, indices, updates, options); } @@ -5303,8 +5296,8 @@ public ScatterNdUpdate scatterNdUpdate(O * @param options carries optional attributes values * @return a new instance of ScatterSub */ - public ScatterSub scatterSub(Operand ref, - Operand indices, Operand updates, ScatterSub.Options... options) { + public ScatterSub scatterSub(Operand ref, + Operand indices, Operand updates, ScatterSub.Options... options) { return ScatterSub.create(scope, ref, indices, updates, options); } @@ -5344,8 +5337,8 @@ public ScatterSub scatterSub(Operand * @param options carries optional attributes values * @return a new instance of ScatterUpdate */ - public ScatterUpdate scatterUpdate(Operand ref, - Operand indices, Operand updates, ScatterUpdate.Options... options) { + public ScatterUpdate scatterUpdate(Operand ref, + Operand indices, Operand updates, ScatterUpdate.Options... options) { return ScatterUpdate.create(scope, ref, indices, updates, options); } @@ -5443,7 +5436,7 @@ public SetDiff1d setDiff1d(Operand * @param options carries optional attributes values * @return a new instance of SetSize */ - public SetSize setSize(Operand setIndices, Operand setValues, + public SetSize setSize(Operand setIndices, Operand setValues, Operand setShape, SetSize.Options... options) { return SetSize.create(scope, setIndices, setValues, setShape, options); } @@ -5463,7 +5456,7 @@ public SetSize setSize(Operand setIndices, Operand * @param input * @return a new instance of Shape */ - public org.tensorflow.op.core.Shape shape(Operand input) { + public org.tensorflow.op.core.Shape shape(Operand input) { return org.tensorflow.op.core.Shape.create(scope, input); } @@ -5483,8 +5476,8 @@ public org.tensorflow.op.core.Shape shape(Operand i * @param outType * @return a new instance of Shape */ - public org.tensorflow.op.core.Shape shape( - Operand input, Class outType) { + public org.tensorflow.op.core.Shape shape(Operand input, + Class outType) { return org.tensorflow.op.core.Shape.create(scope, input, outType); } @@ -5532,7 +5525,7 @@ public ShapeN shapeN(Iterable * @param input * @return a new instance of Size */ - public Size size(Operand input) { + public Size size(Operand input) { return Size.create(scope, input); } @@ -5553,7 +5546,7 @@ public Size size(Operand input) { * @param outType * @return a new instance of Size */ - public Size size(Operand input, Class outType) { + public Size size(Operand input, Class outType) { return Size.create(scope, input, outType); } @@ -5715,8 +5708,8 @@ public Snapshot snapshot(Operand input) { * regular convolution. * @return a new instance of SpaceToBatchNd */ - public SpaceToBatchNd spaceToBatchNd( - Operand input, Operand blockShape, Operand paddings) { + public SpaceToBatchNd spaceToBatchNd(Operand input, + Operand blockShape, Operand paddings) { return SpaceToBatchNd.create(scope, input, blockShape, paddings); } @@ -5748,8 +5741,8 @@ public Split split(Operand axis, Operand value, * @param numSplit * @return a new instance of SplitV */ - public SplitV splitV(Operand value, - Operand sizeSplits, Operand axis, Long numSplit) { + public SplitV splitV(Operand value, Operand sizeSplits, + Operand axis, Long numSplit) { return SplitV.create(scope, value, sizeSplits, axis, numSplit); } @@ -6080,7 +6073,7 @@ public StridedSliceGrad stridedSliceGrad * @param options carries optional attributes values * @return a new instance of Sum */ - public Sum sum(Operand input, Operand axis, + public Sum sum(Operand input, Operand axis, Sum.Options... options) { return Sum.create(scope, input, axis, options); } @@ -6317,8 +6310,8 @@ public TensorArrayRead tensorArrayRead(Operand handle, * @param flowIn A float scalar that enforces proper chaining of operations. * @return a new instance of TensorArrayScatter */ - public TensorArrayScatter tensorArrayScatter(Operand handle, - Operand indices, Operand value, Operand flowIn) { + public TensorArrayScatter tensorArrayScatter(Operand handle, Operand indices, + Operand value, Operand flowIn) { return TensorArrayScatter.create(scope, handle, indices, value, flowIn); } @@ -6364,7 +6357,7 @@ public TensorArraySize tensorArraySize(Operand handle, Operand flow * @param flowIn A float scalar that enforces proper chaining of operations. * @return a new instance of TensorArraySplit */ - public TensorArraySplit tensorArraySplit(Operand handle, Operand value, + public TensorArraySplit tensorArraySplit(Operand handle, Operand value, Operand lengths, Operand flowIn) { return TensorArraySplit.create(scope, handle, value, lengths, flowIn); } @@ -6376,8 +6369,8 @@ public TensorArraySplit tensorArraySplit(Operand handle, Op * @param flowIn * @return a new instance of TensorArrayUnpack */ - public TensorArrayUnpack tensorArrayUnpack(Operand handle, - Operand value, Operand flowIn) { + public TensorArrayUnpack tensorArrayUnpack(Operand handle, + Operand value, Operand flowIn) { return TensorArrayUnpack.create(scope, handle, value, flowIn); } @@ -6390,8 +6383,8 @@ public TensorArrayUnpack tensorArrayUnpack(Operand ha * @param flowIn A float scalar that enforces proper chaining of operations. * @return a new instance of TensorArrayWrite */ - public TensorArrayWrite tensorArrayWrite(Operand handle, - Operand index, Operand value, Operand flowIn) { + public TensorArrayWrite tensorArrayWrite(Operand handle, Operand index, + Operand value, Operand flowIn) { return TensorArrayWrite.create(scope, handle, index, value, flowIn); } @@ -6417,9 +6410,8 @@ public TensorArrayWrite tensorArrayWrite(Operand handle, * @param elementDtype * @return a new instance of TensorListConcat */ - public TensorListConcat tensorListConcat( - Operand inputHandle, Operand elementShape, Operand leadingDims, - Class elementDtype) { + public TensorListConcat tensorListConcat(Operand inputHandle, + Operand elementShape, Operand leadingDims, Class elementDtype) { return TensorListConcat.create(scope, inputHandle, elementShape, leadingDims, elementDtype); } @@ -6463,8 +6455,8 @@ public TensorListElementShape tensorListElementShape( * @param elementShape * @return a new instance of TensorListFromTensor */ - public TensorListFromTensor tensorListFromTensor( - Operand tensor, Operand elementShape) { + public TensorListFromTensor tensorListFromTensor(Operand tensor, + Operand elementShape) { return TensorListFromTensor.create(scope, tensor, elementShape); } @@ -6551,8 +6543,8 @@ public TensorListPopBack tensorListPopBack(Operand input * @param tensor * @return a new instance of TensorListPushBack */ - public TensorListPushBack tensorListPushBack(Operand inputHandle, - Operand tensor) { + public TensorListPushBack tensorListPushBack(Operand inputHandle, + Operand tensor) { return TensorListPushBack.create(scope, inputHandle, tensor); } @@ -6562,8 +6554,8 @@ public TensorListPushBack tensorListPushBack(Operand inputH * @param tensor * @return a new instance of TensorListPushBackBatch */ - public TensorListPushBackBatch tensorListPushBackBatch(Operand inputHandles, - Operand tensor) { + public TensorListPushBackBatch tensorListPushBackBatch(Operand inputHandles, + Operand tensor) { return TensorListPushBackBatch.create(scope, inputHandles, tensor); } @@ -6580,8 +6572,8 @@ public TensorListPushBackBatch tensorListPushBackBatch(Operand * @param elementDtype * @return a new instance of TensorListReserve */ - public TensorListReserve tensorListReserve( - Operand elementShape, Operand numElements, Class elementDtype) { + public TensorListReserve tensorListReserve( + Operand elementShape, Operand numElements, Class elementDtype) { return TensorListReserve.create(scope, elementShape, numElements, elementDtype); } @@ -6621,8 +6613,9 @@ public TensorListResize tensorListResize(Operand inputHandle, Operand * @param numElements * @return a new instance of TensorListScatter */ - public TensorListScatter tensorListScatter(Operand tensor, - Operand indices, Operand elementShape, Operand numElements) { + public TensorListScatter tensorListScatter(Operand tensor, + Operand indices, Operand elementShape, + Operand numElements) { return TensorListScatter.create(scope, tensor, indices, elementShape, numElements); } @@ -6642,8 +6635,8 @@ public TensorListScatter tensorListScatter( * @param indices * @return a new instance of TensorListScatterIntoExistingList */ - public TensorListScatterIntoExistingList tensorListScatterIntoExistingList( - Operand inputHandle, Operand tensor, Operand indices) { + public TensorListScatterIntoExistingList tensorListScatterIntoExistingList(Operand inputHandle, + Operand tensor, Operand indices) { return TensorListScatterIntoExistingList.create(scope, inputHandle, tensor, indices); } @@ -6654,8 +6647,8 @@ public TensorListScatterIntoExistingList tensorListScatterInto * @param item * @return a new instance of TensorListSetItem */ - public TensorListSetItem tensorListSetItem(Operand inputHandle, - Operand index, Operand item) { + public TensorListSetItem tensorListSetItem(Operand inputHandle, Operand index, + Operand item) { return TensorListSetItem.create(scope, inputHandle, index, item); } @@ -6675,8 +6668,8 @@ public TensorListSetItem tensorListSetItem(Operand inputHan * @param lengths * @return a new instance of TensorListSplit */ - public TensorListSplit tensorListSplit(Operand tensor, - Operand elementShape, Operand lengths) { + public TensorListSplit tensorListSplit(Operand tensor, + Operand elementShape, Operand lengths) { return TensorListSplit.create(scope, tensor, elementShape, lengths); } @@ -6701,32 +6694,6 @@ public TensorListStack tensorListStack(Operand inputHand return TensorListStack.create(scope, inputHandle, elementShape, elementDtype, options); } - /** - * - * @param data type for {@code output()} output - * @param tensor Tensor to update. - * @param indices Index tensor. - * @param updates Updates to scatter into output. - * @return a new instance of TensorScatterMax - */ - public TensorScatterMax tensorScatterMax( - Operand tensor, Operand indices, Operand updates) { - return TensorScatterMax.create(scope, tensor, indices, updates); - } - - /** - * - * @param data type for {@code output()} output - * @param tensor Tensor to update. - * @param indices Index tensor. - * @param updates Updates to scatter into output. - * @return a new instance of TensorScatterMin - */ - public TensorScatterMin tensorScatterMin( - Operand tensor, Operand indices, Operand updates) { - return TensorScatterMin.create(scope, tensor, indices, updates); - } - /** * Adds sparse `updates` to an existing tensor according to `indices`. *

@@ -6796,8 +6763,8 @@ public TensorScatterMin tensorScatterMin * @param updates Updates to scatter into output. * @return a new instance of TensorScatterNdAdd */ - public TensorScatterNdAdd tensorScatterNdAdd( - Operand tensor, Operand indices, Operand updates) { + public TensorScatterNdAdd tensorScatterNdAdd(Operand tensor, + Operand indices, Operand updates) { return TensorScatterNdAdd.create(scope, tensor, indices, updates); } @@ -6809,8 +6776,8 @@ public TensorScatterNdAdd tensorScatterN * @param updates Updates to scatter into output. * @return a new instance of TensorScatterNdMax */ - public TensorScatterNdMax tensorScatterNdMax( - Operand tensor, Operand indices, Operand updates) { + public TensorScatterNdMax tensorScatterNdMax(Operand tensor, + Operand indices, Operand updates) { return TensorScatterNdMax.create(scope, tensor, indices, updates); } @@ -6822,8 +6789,8 @@ public TensorScatterNdMax tensorScatterN * @param updates Updates to scatter into output. * @return a new instance of TensorScatterNdMin */ - public TensorScatterNdMin tensorScatterNdMin( - Operand tensor, Operand indices, Operand updates) { + public TensorScatterNdMin tensorScatterNdMin(Operand tensor, + Operand indices, Operand updates) { return TensorScatterNdMin.create(scope, tensor, indices, updates); } @@ -6895,8 +6862,8 @@ public TensorScatterNdMin tensorScatterN * @param updates Updates to scatter into output. * @return a new instance of TensorScatterNdSub */ - public TensorScatterNdSub tensorScatterNdSub( - Operand tensor, Operand indices, Operand updates) { + public TensorScatterNdSub tensorScatterNdSub(Operand tensor, + Operand indices, Operand updates) { return TensorScatterNdSub.create(scope, tensor, indices, updates); } @@ -6983,8 +6950,8 @@ public TensorScatterNdSub tensorScatterN * @param updates Updates to scatter into output. * @return a new instance of TensorScatterNdUpdate */ - public TensorScatterNdUpdate tensorScatterNdUpdate( - Operand tensor, Operand indices, Operand updates) { + public TensorScatterNdUpdate tensorScatterNdUpdate(Operand tensor, + Operand indices, Operand updates) { return TensorScatterNdUpdate.create(scope, tensor, indices, updates); } @@ -7048,7 +7015,7 @@ public TensorStridedSliceUpdate tensorSt * @param multiples 1-D. Length must be the same as the number of dimensions in `input` * @return a new instance of Tile */ - public Tile tile(Operand input, Operand multiples) { + public Tile tile(Operand input, Operand multiples) { return Tile.create(scope, input, multiples); } @@ -7248,8 +7215,7 @@ public UnbatchGrad unbatchGrad(Operand originalInput, * find the unique elements. * @return a new instance of Unique */ - public Unique unique(Operand x, - Operand axis) { + public Unique unique(Operand x, Operand axis) { return Unique.create(scope, x, axis); } @@ -7303,8 +7269,8 @@ public Unique unique(Operand * @param outIdx * @return a new instance of Unique */ - public Unique unique(Operand x, - Operand axis, Class outIdx) { + public Unique unique(Operand x, + Operand axis, Class outIdx) { return Unique.create(scope, x, axis, outIdx); } @@ -7361,8 +7327,8 @@ public Unique uniq * find the unique elements. * @return a new instance of UniqueWithCounts */ - public UniqueWithCounts uniqueWithCounts( - Operand x, Operand axis) { + public UniqueWithCounts uniqueWithCounts(Operand x, + Operand axis) { return UniqueWithCounts.create(scope, x, axis); } @@ -7420,8 +7386,8 @@ public UniqueWithCounts uniqueWi * @param outIdx * @return a new instance of UniqueWithCounts */ - public UniqueWithCounts uniqueWithCounts( - Operand x, Operand axis, Class outIdx) { + public UniqueWithCounts uniqueWithCounts(Operand x, + Operand axis, Class outIdx) { return UniqueWithCounts.create(scope, x, axis, outIdx); } @@ -7659,7 +7625,7 @@ public VariableShape variableShape(Operand input, Clas * @param condition * @return a new instance of Where */ - public Where where(Operand condition) { + public Where where(Operand condition) { return Where.create(scope, condition); } 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 bcca8f36505..812f2563605 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 @@ -109,8 +109,8 @@ public final class QuantizationOps { * @param options carries optional attributes values * @return a new instance of Dequantize */ - public Dequantize dequantize(Operand input, - Operand minRange, Operand maxRange, Dequantize.Options... options) { + public Dequantize dequantize(Operand input, Operand minRange, + Operand maxRange, Dequantize.Options... options) { return Dequantize.create(scope, input, minRange, maxRange, options); } @@ -174,7 +174,7 @@ public Dequantize dequantize(Operand input, * @param options carries optional attributes values * @return a new instance of Dequantize */ - public Dequantize dequantize(Operand input, + public Dequantize dequantize(Operand input, Operand minRange, Operand maxRange, Class dtype, Dequantize.Options... options) { return Dequantize.create(scope, input, minRange, maxRange, dtype, options); @@ -563,8 +563,9 @@ public QuantizeAndDequantize quantizeAndDequantize(Operan * @param outType The type of the output. Should be a lower bit depth than Tinput. * @return a new instance of QuantizeDownAndShrinkRange */ - public QuantizeDownAndShrinkRange quantizeDownAndShrinkRange( - Operand input, Operand inputMin, Operand inputMax, Class outType) { + public QuantizeDownAndShrinkRange quantizeDownAndShrinkRange( + Operand input, Operand inputMin, Operand inputMax, + Class outType) { return QuantizeDownAndShrinkRange.create(scope, input, inputMin, inputMax, outType); } @@ -599,7 +600,7 @@ public QuantizedConcat quantizedConcat(Operand conc * @param inputMax The float value that the maximum quantized input value represents. * @return a new instance of RequantizationRange */ - public RequantizationRange requantizationRange(Operand input, + public RequantizationRange requantizationRange(Operand input, Operand inputMin, Operand inputMax) { return RequantizationRange.create(scope, input, inputMin, inputMax); } @@ -624,7 +625,7 @@ public RequantizationRange requantizationRange(Operand inpu * @param outType The type of the output. Should be a lower bit depth than Tinput. * @return a new instance of Requantize */ - public Requantize requantize(Operand input, + public Requantize requantize(Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { return Requantize.create(scope, input, inputMin, inputMax, requestedOutputMin, requestedOutputMax, outType); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java index f0c3b8c660c..b1083100c6f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/RandomOps.java @@ -126,7 +126,7 @@ public LogUniformCandidateSampler logUniformCandidateSampler(Operand tru * @param options carries optional attributes values * @return a new instance of Multinomial */ - public Multinomial multinomial(Operand logits, + public Multinomial multinomial(Operand logits, Operand numSamples, Multinomial.Options... options) { return Multinomial.create(scope, logits, numSamples, options); } @@ -142,7 +142,7 @@ public Multinomial multinomial(Operand logits, * @param options carries optional attributes values * @return a new instance of Multinomial */ - public Multinomial multinomial(Operand logits, + public Multinomial multinomial(Operand logits, Operand numSamples, Class outputDtype, Multinomial.Options... options) { return Multinomial.create(scope, logits, numSamples, outputDtype, options); } @@ -163,9 +163,9 @@ public Multinomial multinomial(Operand * @param options carries optional attributes values * @return a new instance of ParameterizedTruncatedNormal */ - public ParameterizedTruncatedNormal parameterizedTruncatedNormal( - Operand shape, Operand means, Operand stdevs, Operand minvals, Operand maxvals, - ParameterizedTruncatedNormal.Options... options) { + public ParameterizedTruncatedNormal parameterizedTruncatedNormal( + Operand shape, Operand means, Operand stdevs, Operand minvals, + Operand maxvals, ParameterizedTruncatedNormal.Options... options) { return ParameterizedTruncatedNormal.create(scope, shape, means, stdevs, minvals, maxvals, options); } @@ -184,7 +184,7 @@ public ParameterizedTruncatedNormal pa * @param options carries optional attributes values * @return a new instance of RandomGamma */ - public RandomGamma randomGamma(Operand shape, + public RandomGamma randomGamma(Operand shape, Operand alpha, RandomGamma.Options... options) { return RandomGamma.create(scope, shape, alpha, options); } @@ -210,8 +210,8 @@ public RandomGamma randomGamma(Operand * @param options carries optional attributes values * @return a new instance of RandomPoisson */ - public RandomPoisson randomPoisson( - Operand shape, Operand rate, RandomPoisson.Options... options) { + public RandomPoisson randomPoisson(Operand shape, + Operand rate, RandomPoisson.Options... options) { return RandomPoisson.create(scope, shape, rate, options); } @@ -237,8 +237,8 @@ public RandomPoisson randomPoisso * @param options carries optional attributes values * @return a new instance of RandomPoisson */ - public RandomPoisson randomPoisson( - Operand shape, Operand rate, Class dtype, RandomPoisson.Options... options) { + public RandomPoisson randomPoisson(Operand shape, + Operand rate, Class dtype, RandomPoisson.Options... options) { return RandomPoisson.create(scope, shape, rate, dtype, options); } @@ -275,8 +275,8 @@ public RandomShuffle randomShuffle(Operand value, * @param options carries optional attributes values * @return a new instance of RandomStandardNormal */ - public RandomStandardNormal randomStandardNormal( - Operand shape, Class dtype, RandomStandardNormal.Options... options) { + public RandomStandardNormal randomStandardNormal( + Operand shape, Class dtype, RandomStandardNormal.Options... options) { return RandomStandardNormal.create(scope, shape, dtype, options); } @@ -292,7 +292,7 @@ public RandomStandardNormal randomStan * @param options carries optional attributes values * @return a new instance of RandomUniform */ - public RandomUniform randomUniform(Operand shape, + public RandomUniform randomUniform(Operand shape, Class dtype, RandomUniform.Options... options) { return RandomUniform.create(scope, shape, dtype, options); } @@ -315,8 +315,8 @@ public RandomUniform randomUniform(Ope * @param options carries optional attributes values * @return a new instance of RandomUniformInt */ - public RandomUniformInt randomUniformInt( - Operand shape, Operand minval, Operand maxval, RandomUniformInt.Options... options) { + public RandomUniformInt randomUniformInt(Operand shape, + Operand minval, Operand maxval, RandomUniformInt.Options... options) { return RandomUniformInt.create(scope, shape, minval, maxval, options); } @@ -341,9 +341,9 @@ public RecordInput recordInput(String filePattern, RecordInput.Options... option * @param probs * @return a new instance of StatefulRandomBinomial */ - public StatefulRandomBinomial statefulRandomBinomial( - Operand resource, Operand algorithm, Operand shape, Operand counts, - Operand probs) { + public StatefulRandomBinomial statefulRandomBinomial( + Operand resource, Operand algorithm, Operand shape, + Operand counts, Operand probs) { return StatefulRandomBinomial.create(scope, resource, algorithm, shape, counts, probs); } @@ -358,9 +358,9 @@ public StatefulRandomBinomial sta * @param dtype * @return a new instance of StatefulRandomBinomial */ - public StatefulRandomBinomial statefulRandomBinomial( - Operand resource, Operand algorithm, Operand shape, Operand counts, - Operand probs, Class dtype) { + public StatefulRandomBinomial statefulRandomBinomial( + Operand resource, Operand algorithm, Operand shape, + Operand counts, Operand probs, Class dtype) { return StatefulRandomBinomial.create(scope, resource, algorithm, shape, counts, probs, dtype); } @@ -375,8 +375,8 @@ public StatefulRandomB * @param shape The shape of the output tensor. * @return a new instance of StatefulStandardNormal */ - public StatefulStandardNormal statefulStandardNormal( - Operand resource, Operand algorithm, Operand shape) { + public StatefulStandardNormal statefulStandardNormal(Operand resource, + Operand algorithm, Operand shape) { return StatefulStandardNormal.create(scope, resource, algorithm, shape); } @@ -392,8 +392,8 @@ public StatefulStandardNormal statefulStandardNormal * @param dtype The type of the output. * @return a new instance of StatefulStandardNormal */ - public StatefulStandardNormal statefulStandardNormal( - Operand resource, Operand algorithm, Operand shape, Class dtype) { + public StatefulStandardNormal statefulStandardNormal(Operand resource, + Operand algorithm, Operand shape, Class dtype) { return StatefulStandardNormal.create(scope, resource, algorithm, shape, dtype); } @@ -407,8 +407,8 @@ public StatefulStandardNormal statefulStan * @param seed 2 seeds (shape [2]). * @return a new instance of StatelessMultinomial */ - public StatelessMultinomial statelessMultinomial( - Operand logits, Operand numSamples, Operand seed) { + public StatelessMultinomial statelessMultinomial(Operand logits, + Operand numSamples, Operand seed) { return StatelessMultinomial.create(scope, logits, numSamples, seed); } @@ -423,8 +423,9 @@ public StatelessMultinomial state * @param outputDtype * @return a new instance of StatelessMultinomial */ - public StatelessMultinomial statelessMultinomial( - Operand logits, Operand numSamples, Operand seed, Class outputDtype) { + public StatelessMultinomial statelessMultinomial( + Operand logits, Operand numSamples, + Operand seed, Class outputDtype) { return StatelessMultinomial.create(scope, logits, numSamples, seed, outputDtype); } @@ -440,8 +441,8 @@ public StatelessMultin * @param seed 2 seeds (shape [2]). * @return a new instance of StatelessRandomNormal */ - public StatelessRandomNormal statelessRandomNormal( - Operand shape, Operand seed) { + public StatelessRandomNormal statelessRandomNormal(Operand shape, + Operand seed) { return StatelessRandomNormal.create(scope, shape, seed); } @@ -458,8 +459,8 @@ public StatelessRandomNormal st * @param dtype The type of the output. * @return a new instance of StatelessRandomNormal */ - public StatelessRandomNormal statelessRandomNormal( - Operand shape, Operand seed, Class dtype) { + public StatelessRandomNormal statelessRandomNormal( + Operand shape, Operand seed, Class dtype) { return StatelessRandomNormal.create(scope, shape, seed, dtype); } @@ -476,8 +477,8 @@ public StatelessRandom * @param seed 2 seeds (shape [2]). * @return a new instance of StatelessRandomUniform */ - public StatelessRandomUniform statelessRandomUniform( - Operand shape, Operand seed) { + public StatelessRandomUniform statelessRandomUniform(Operand shape, + Operand seed) { return StatelessRandomUniform.create(scope, shape, seed); } @@ -495,8 +496,8 @@ public StatelessRandomUniform s * @param dtype The type of the output. * @return a new instance of StatelessRandomUniform */ - public StatelessRandomUniform statelessRandomUniform( - Operand shape, Operand seed, Class dtype) { + public StatelessRandomUniform statelessRandomUniform( + Operand shape, Operand seed, Class dtype) { return StatelessRandomUniform.create(scope, shape, seed, dtype); } @@ -514,8 +515,8 @@ public StatelessRandom * @param seed 2 seeds (shape [2]). * @return a new instance of StatelessTruncatedNormal */ - public StatelessTruncatedNormal statelessTruncatedNormal( - Operand shape, Operand seed) { + public StatelessTruncatedNormal statelessTruncatedNormal( + Operand shape, Operand seed) { return StatelessTruncatedNormal.create(scope, shape, seed); } @@ -534,8 +535,8 @@ public StatelessTruncatedNormal * @param dtype The type of the output. * @return a new instance of StatelessTruncatedNormal */ - public StatelessTruncatedNormal statelessTruncatedNormal( - Operand shape, Operand seed, Class dtype) { + public StatelessTruncatedNormal statelessTruncatedNormal( + Operand shape, Operand seed, Class dtype) { return StatelessTruncatedNormal.create(scope, shape, seed, dtype); } @@ -552,7 +553,7 @@ public StatelessTrunca * @param options carries optional attributes values * @return a new instance of TruncatedNormal */ - public TruncatedNormal truncatedNormal(Operand shape, + public TruncatedNormal truncatedNormal(Operand shape, Class dtype, TruncatedNormal.Options... options) { return TruncatedNormal.create(scope, shape, dtype, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java index e8ac9a0e53b..14d56516167 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SignalOps.java @@ -216,7 +216,7 @@ public Ifft3d ifft3d(Operand input) { * @param fftLength An int32 tensor of shape [1]. The FFT length. * @return a new instance of Irfft */ - public Irfft irfft(Operand input, Operand fftLength) { + public Irfft irfft(Operand input, Operand fftLength) { return Irfft.create(scope, input, fftLength); } @@ -243,7 +243,7 @@ public Irfft irfft(Operand input, Operand * @param Treal * @return a new instance of Irfft */ - public Irfft irfft(Operand input, + public Irfft irfft(Operand input, Operand fftLength, Class Treal) { return Irfft.create(scope, input, fftLength, Treal); } @@ -271,7 +271,7 @@ public Irfft irfft(Operand input, * @param fftLength An int32 tensor of shape [2]. The FFT length for each dimension. * @return a new instance of Irfft2d */ - public Irfft2d irfft2d(Operand input, Operand fftLength) { + public Irfft2d irfft2d(Operand input, Operand fftLength) { return Irfft2d.create(scope, input, fftLength); } @@ -299,7 +299,7 @@ public Irfft2d irfft2d(Operand input, Operand Irfft2d irfft2d(Operand input, + public Irfft2d irfft2d(Operand input, Operand fftLength, Class Treal) { return Irfft2d.create(scope, input, fftLength, Treal); } @@ -327,7 +327,7 @@ public Irfft2d irfft2d(Operand input, * @param fftLength An int32 tensor of shape [3]. The FFT length for each dimension. * @return a new instance of Irfft3d */ - public Irfft3d irfft3d(Operand input, Operand fftLength) { + public Irfft3d irfft3d(Operand input, Operand fftLength) { return Irfft3d.create(scope, input, fftLength); } @@ -355,7 +355,7 @@ public Irfft3d irfft3d(Operand input, Operand Irfft3d irfft3d(Operand input, + public Irfft3d irfft3d(Operand input, Operand fftLength, Class Treal) { return Irfft3d.create(scope, input, fftLength, Treal); } @@ -380,8 +380,8 @@ public Irfft3d irfft3d(Operand input, * @param Tcomplex * @return a new instance of Rfft */ - public Rfft rfft(Operand input, - Operand fftLength, Class Tcomplex) { + public Rfft rfft(Operand input, Operand fftLength, + Class Tcomplex) { return Rfft.create(scope, input, fftLength, Tcomplex); } @@ -406,7 +406,7 @@ public Rfft rfft(Operand input, * @param Tcomplex * @return a new instance of Rfft2d */ - public Rfft2d rfft2d(Operand input, + public Rfft2d rfft2d(Operand input, Operand fftLength, Class Tcomplex) { return Rfft2d.create(scope, input, fftLength, Tcomplex); } @@ -432,7 +432,7 @@ public Rfft2d rfft2d(Operand input, * @param Tcomplex * @return a new instance of Rfft3d */ - public Rfft3d rfft3d(Operand input, + public Rfft3d rfft3d(Operand input, Operand fftLength, Class Tcomplex) { return Rfft3d.create(scope, input, fftLength, Tcomplex); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java index 3971fc6fc06..06109db5383 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SparseOps.java @@ -119,8 +119,8 @@ public final class SparseOps { * @param options carries optional attributes values * @return a new instance of AddManySparseToTensorsMap */ - public AddManySparseToTensorsMap addManySparseToTensorsMap( - Operand sparseIndices, Operand sparseValues, Operand sparseShape, + public AddManySparseToTensorsMap addManySparseToTensorsMap(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, AddManySparseToTensorsMap.Options... options) { return AddManySparseToTensorsMap.create(scope, sparseIndices, sparseValues, sparseShape, options); } @@ -149,8 +149,8 @@ public AddManySparseToTensorsMap addManySparseToTensorsMap( * @param options carries optional attributes values * @return a new instance of AddSparseToTensorsMap */ - public AddSparseToTensorsMap addSparseToTensorsMap( - Operand sparseIndices, Operand sparseValues, Operand sparseShape, + public AddSparseToTensorsMap addSparseToTensorsMap(Operand sparseIndices, + Operand sparseValues, Operand sparseShape, AddSparseToTensorsMap.Options... options) { return AddSparseToTensorsMap.create(scope, sparseIndices, sparseValues, sparseShape, options); } @@ -270,8 +270,8 @@ public DenseToSparseSetOperation denseToSparseSetOperation( * @param dtype The `dtype` of the serialized `SparseTensor` objects. * @return a new instance of DeserializeSparse */ - public DeserializeSparse deserializeSparse( - Operand serializedSparse, Class dtype) { + public DeserializeSparse deserializeSparse( + Operand serializedSparse, Class dtype) { return DeserializeSparse.create(scope, serializedSparse, dtype); } @@ -293,9 +293,10 @@ public DeserializeSparse deserializeSparse * case the input is ignored during validation. * @return a new instance of SparseAccumulatorApplyGradient */ - public SparseAccumulatorApplyGradient sparseAccumulatorApplyGradient( - Operand handle, Operand localStep, Operand gradientIndices, - Operand gradientValues, Operand gradientShape, Boolean hasKnownShape) { + public SparseAccumulatorApplyGradient sparseAccumulatorApplyGradient(Operand handle, + Operand localStep, Operand gradientIndices, + Operand gradientValues, Operand gradientShape, + Boolean hasKnownShape) { return SparseAccumulatorApplyGradient.create(scope, handle, localStep, gradientIndices, gradientValues, gradientShape, hasKnownShape); } @@ -349,9 +350,9 @@ public SparseAccumulatorTakeGradient sparseAccumulatorTakeG * pair takes space. * @return a new instance of SparseAdd */ - public SparseAdd sparseAdd(Operand aIndices, - Operand aValues, Operand aShape, Operand bIndices, Operand bValues, - Operand bShape, Operand thresh) { + public SparseAdd sparseAdd(Operand aIndices, Operand aValues, + Operand aShape, Operand bIndices, Operand bValues, Operand bShape, + Operand thresh) { return SparseAdd.create(scope, aIndices, aValues, aShape, bIndices, bValues, bShape, thresh); } @@ -753,8 +754,8 @@ public SparseFillEmptyRowsGrad sparseFillEmptyRowsGrad( * @param options carries optional attributes values * @return a new instance of SparseMatMul */ - public SparseMatMul sparseMatMul(Operand a, - Operand b, SparseMatMul.Options... options) { + public SparseMatMul sparseMatMul(Operand a, Operand b, + SparseMatMul.Options... options) { return SparseMatMul.create(scope, a, b, options); } @@ -950,8 +951,8 @@ public SparseReshape sparseReshape(Operand inputIndices, Operand * @param segmentIds A 1-D tensor. Values should be sorted and can be repeated. * @return a new instance of SparseSegmentMean */ - public SparseSegmentMean sparseSegmentMean( - Operand data, Operand indices, Operand segmentIds) { + public SparseSegmentMean sparseSegmentMean(Operand data, + Operand indices, Operand segmentIds) { return SparseSegmentMean.create(scope, data, indices, segmentIds); } @@ -968,8 +969,9 @@ public SparseSegmentMe * @param outputDim0 dimension 0 of "data" passed to SparseSegmentMean op. * @return a new instance of SparseSegmentMeanGrad */ - public SparseSegmentMeanGrad sparseSegmentMeanGrad( - Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { + public SparseSegmentMeanGrad sparseSegmentMeanGrad(Operand grad, + Operand indices, Operand segmentIds, + Operand outputDim0) { return SparseSegmentMeanGrad.create(scope, grad, indices, segmentIds, outputDim0); } @@ -990,8 +992,9 @@ public SparseSegmentMe * @param numSegments Should equal the number of distinct segment IDs. * @return a new instance of SparseSegmentMeanWithNumSegments */ - public SparseSegmentMeanWithNumSegments sparseSegmentMeanWithNumSegments( - Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + public SparseSegmentMeanWithNumSegments sparseSegmentMeanWithNumSegments( + Operand data, Operand indices, Operand segmentIds, + Operand numSegments) { return SparseSegmentMeanWithNumSegments.create(scope, data, indices, segmentIds, numSegments); } @@ -1008,8 +1011,8 @@ public SparseSegmentSqrtN sparseSegmentSqrtN( - Operand data, Operand indices, Operand segmentIds) { + public SparseSegmentSqrtN sparseSegmentSqrtN(Operand data, + Operand indices, Operand segmentIds) { return SparseSegmentSqrtN.create(scope, data, indices, segmentIds); } @@ -1026,8 +1029,9 @@ public SparseSegmentSq * @param outputDim0 dimension 0 of "data" passed to SparseSegmentSqrtN op. * @return a new instance of SparseSegmentSqrtNGrad */ - public SparseSegmentSqrtNGrad sparseSegmentSqrtNGrad( - Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { + public SparseSegmentSqrtNGrad sparseSegmentSqrtNGrad(Operand grad, + Operand indices, Operand segmentIds, + Operand outputDim0) { return SparseSegmentSqrtNGrad.create(scope, grad, indices, segmentIds, outputDim0); } @@ -1050,8 +1054,9 @@ public SparseSegmentSq * @param numSegments Should equal the number of distinct segment IDs. * @return a new instance of SparseSegmentSqrtNWithNumSegments */ - public SparseSegmentSqrtNWithNumSegments sparseSegmentSqrtNWithNumSegments( - Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + public SparseSegmentSqrtNWithNumSegments sparseSegmentSqrtNWithNumSegments( + Operand data, Operand indices, Operand segmentIds, + Operand numSegments) { return SparseSegmentSqrtNWithNumSegments.create(scope, data, indices, segmentIds, numSegments); } @@ -1093,8 +1098,8 @@ public SparseSegmentSum sparseSegmentSum( - Operand data, Operand indices, Operand segmentIds) { + public SparseSegmentSum sparseSegmentSum(Operand data, + Operand indices, Operand segmentIds) { return SparseSegmentSum.create(scope, data, indices, segmentIds); } @@ -1135,8 +1140,9 @@ public SparseSegmentSu * @param numSegments Should equal the number of distinct segment IDs. * @return a new instance of SparseSegmentSumWithNumSegments */ - public SparseSegmentSumWithNumSegments sparseSegmentSumWithNumSegments( - Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + public SparseSegmentSumWithNumSegments sparseSegmentSumWithNumSegments( + Operand data, Operand indices, Operand segmentIds, + Operand numSegments) { return SparseSegmentSumWithNumSegments.create(scope, data, indices, segmentIds, numSegments); } @@ -1342,8 +1348,8 @@ public SparseTensorDenseAdd sparseTensor * @param options carries optional attributes values * @return a new instance of SparseTensorDenseMatMul */ - public SparseTensorDenseMatMul sparseTensorDenseMatMul( - Operand aIndices, Operand aValues, Operand aShape, Operand b, + public SparseTensorDenseMatMul sparseTensorDenseMatMul( + Operand aIndices, Operand aValues, Operand aShape, Operand b, SparseTensorDenseMatMul.Options... options) { return SparseTensorDenseMatMul.create(scope, aIndices, aValues, aShape, b, options); } 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 6d380c31bc6..d2527c6563f 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 @@ -597,8 +597,8 @@ public UnicodeTranscode unicodeTranscode(Operand input, String inputEnc * @param options carries optional attributes values * @return a new instance of UnsortedSegmentJoin */ - public UnsortedSegmentJoin unsortedSegmentJoin( - Operand inputs, Operand segmentIds, Operand numSegments, + public UnsortedSegmentJoin unsortedSegmentJoin(Operand inputs, + Operand segmentIds, Operand numSegments, UnsortedSegmentJoin.Options... options) { return UnsortedSegmentJoin.create(scope, inputs, segmentIds, numSegments, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java index 83423d50121..5366744fcae 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/SummaryOps.java @@ -86,8 +86,8 @@ public AudioSummary audioSummary(Operand tag, Operand tensor, * @param values Any shape. Values to use to build the histogram. * @return a new instance of HistogramSummary */ - public HistogramSummary histogramSummary(Operand tag, - Operand values) { + public HistogramSummary histogramSummary(Operand tag, + Operand values) { return HistogramSummary.create(scope, tag, values); } @@ -147,7 +147,7 @@ public HistogramSummary histogramSummary(Operand ta * @param options carries optional attributes values * @return a new instance of ImageSummary */ - public ImageSummary imageSummary(Operand tag, Operand tensor, + public ImageSummary imageSummary(Operand tag, Operand tensor, ImageSummary.Options... options) { return ImageSummary.create(scope, tag, tensor, options); } @@ -181,7 +181,7 @@ public MergeSummary mergeSummary(Iterable> inputs) { * @param values Same shape as `tags. Values for the summary. * @return a new instance of ScalarSummary */ - public ScalarSummary scalarSummary(Operand tags, Operand values) { + public ScalarSummary scalarSummary(Operand tags, Operand values) { return ScalarSummary.create(scope, tags, values); } @@ -194,7 +194,7 @@ public ScalarSummary scalarSummary(Operand tags, Op * data. * @return a new instance of TensorSummary */ - public TensorSummary tensorSummary(Operand tag, Operand tensor, + public TensorSummary tensorSummary(Operand tag, Operand tensor, Operand serializedSummaryMetadata) { return TensorSummary.create(scope, tag, tensor, serializedSummaryMetadata); } 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 d21b5e037d3..87809e1a4c3 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 @@ -114,8 +114,8 @@ public final class TrainOps { * @param gradient A tensor of the gradient to be accumulated. * @return a new instance of AccumulatorApplyGradient */ - public AccumulatorApplyGradient accumulatorApplyGradient( - Operand handle, Operand localStep, Operand gradient) { + public AccumulatorApplyGradient accumulatorApplyGradient(Operand handle, + Operand localStep, Operand gradient) { return AccumulatorApplyGradient.create(scope, handle, localStep, gradient); } @@ -1019,9 +1019,9 @@ public ResourceApplyRmsProp resourceApplyRmsProp(Operand va * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyAdadelta */ - public ResourceSparseApplyAdadelta resourceSparseApplyAdadelta( - Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, - Operand epsilon, Operand grad, Operand indices, + public ResourceSparseApplyAdadelta resourceSparseApplyAdadelta(Operand var, + Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, + Operand grad, Operand indices, ResourceSparseApplyAdadelta.Options... options) { return ResourceSparseApplyAdadelta.create(scope, var, accum, accumUpdate, lr, rho, epsilon, grad, indices, options); } @@ -1041,8 +1041,8 @@ public ResourceSparseApplyAdadelta resource * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyAdagrad */ - public ResourceSparseApplyAdagrad resourceSparseApplyAdagrad( - Operand var, Operand accum, Operand lr, Operand grad, Operand indices, + public ResourceSparseApplyAdagrad resourceSparseApplyAdagrad(Operand var, + Operand accum, Operand lr, Operand grad, Operand indices, ResourceSparseApplyAdagrad.Options... options) { return ResourceSparseApplyAdagrad.create(scope, var, accum, lr, grad, indices, options); } @@ -1062,9 +1062,9 @@ public ResourceSparseApplyAdagrad resourceS * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyAdagradDa */ - public ResourceSparseApplyAdagradDa resourceSparseApplyAdagradDa( - Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, - Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, + public ResourceSparseApplyAdagradDa resourceSparseApplyAdagradDa(Operand var, + Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, + Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, ResourceSparseApplyAdagradDa.Options... options) { return ResourceSparseApplyAdagradDa.create(scope, var, gradientAccumulator, gradientSquaredAccumulator, grad, indices, lr, l1, l2, globalStep, options); } @@ -1102,9 +1102,9 @@ public ResourceSparseApplyAdagradDa resourc * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyCenteredRmsProp */ - public ResourceSparseApplyCenteredRmsProp resourceSparseApplyCenteredRmsProp( + public ResourceSparseApplyCenteredRmsProp resourceSparseApplyCenteredRmsProp( Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, - Operand momentum, Operand epsilon, Operand grad, Operand indices, + Operand momentum, Operand epsilon, Operand grad, Operand indices, ResourceSparseApplyCenteredRmsProp.Options... options) { return ResourceSparseApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); } @@ -1134,8 +1134,8 @@ public ResourceSparseApplyCenteredRmsProp r * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyFtrl */ - public ResourceSparseApplyFtrl resourceSparseApplyFtrl( - Operand var, Operand accum, Operand linear, Operand grad, Operand indices, + public ResourceSparseApplyFtrl resourceSparseApplyFtrl(Operand var, + Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, ResourceSparseApplyFtrl.Options... options) { return ResourceSparseApplyFtrl.create(scope, var, accum, linear, grad, indices, lr, l1, l2, l2Shrinkage, lrPower, options); @@ -1160,9 +1160,10 @@ public ResourceSparseApplyFtrl resourceSpar * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyKerasMomentum */ - public ResourceSparseApplyKerasMomentum resourceSparseApplyKerasMomentum( - Operand var, Operand accum, Operand lr, Operand grad, Operand indices, - Operand momentum, ResourceSparseApplyKerasMomentum.Options... options) { + public ResourceSparseApplyKerasMomentum resourceSparseApplyKerasMomentum( + Operand var, Operand accum, Operand lr, Operand grad, + Operand indices, Operand momentum, + ResourceSparseApplyKerasMomentum.Options... options) { return ResourceSparseApplyKerasMomentum.create(scope, var, accum, lr, grad, indices, momentum, options); } @@ -1185,8 +1186,8 @@ public ResourceSparseApplyKerasMomentum res * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyMomentum */ - public ResourceSparseApplyMomentum resourceSparseApplyMomentum( - Operand var, Operand accum, Operand lr, Operand grad, Operand indices, + public ResourceSparseApplyMomentum resourceSparseApplyMomentum(Operand var, + Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, ResourceSparseApplyMomentum.Options... options) { return ResourceSparseApplyMomentum.create(scope, var, accum, lr, grad, indices, momentum, options); } @@ -1210,9 +1211,10 @@ public ResourceSparseApplyMomentum resource * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyProximalAdagrad */ - public ResourceSparseApplyProximalAdagrad resourceSparseApplyProximalAdagrad( + public ResourceSparseApplyProximalAdagrad resourceSparseApplyProximalAdagrad( Operand var, Operand accum, Operand lr, Operand l1, Operand l2, - Operand grad, Operand indices, ResourceSparseApplyProximalAdagrad.Options... options) { + Operand grad, Operand indices, + ResourceSparseApplyProximalAdagrad.Options... options) { return ResourceSparseApplyProximalAdagrad.create(scope, var, accum, lr, l1, l2, grad, indices, options); } @@ -1232,9 +1234,10 @@ public ResourceSparseApplyProximalAdagrad r * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyProximalGradientDescent */ - public ResourceSparseApplyProximalGradientDescent resourceSparseApplyProximalGradientDescent( + public ResourceSparseApplyProximalGradientDescent resourceSparseApplyProximalGradientDescent( Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, - Operand indices, ResourceSparseApplyProximalGradientDescent.Options... options) { + Operand indices, + ResourceSparseApplyProximalGradientDescent.Options... options) { return ResourceSparseApplyProximalGradientDescent.create(scope, var, alpha, l1, l2, grad, indices, options); } @@ -1264,9 +1267,9 @@ public ResourceSparseApplyProximalGradientD * @param options carries optional attributes values * @return a new instance of ResourceSparseApplyRmsProp */ - public ResourceSparseApplyRmsProp resourceSparseApplyRmsProp( - Operand var, Operand ms, Operand mom, Operand lr, Operand rho, - Operand momentum, Operand epsilon, Operand grad, Operand indices, + public ResourceSparseApplyRmsProp resourceSparseApplyRmsProp(Operand var, + Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, + Operand epsilon, Operand grad, Operand indices, ResourceSparseApplyRmsProp.Options... options) { return ResourceSparseApplyRmsProp.create(scope, var, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); } @@ -1432,10 +1435,9 @@ public SdcaShrinkL1 sdcaShrinkL1(Iterable> weights, Float l1, * @param options carries optional attributes values * @return a new instance of SparseApplyAdadelta */ - public SparseApplyAdadelta sparseApplyAdadelta( - Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, - Operand epsilon, Operand grad, Operand indices, - SparseApplyAdadelta.Options... options) { + public SparseApplyAdadelta sparseApplyAdadelta(Operand var, + Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, + Operand grad, Operand indices, SparseApplyAdadelta.Options... options) { return SparseApplyAdadelta.create(scope, var, accum, accumUpdate, lr, rho, epsilon, grad, indices, options); } @@ -1455,9 +1457,9 @@ public SparseApplyAdadelta sparseApplyAd * @param options carries optional attributes values * @return a new instance of SparseApplyAdagradDa */ - public SparseApplyAdagradDa sparseApplyAdagradDa( - Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, - Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, + public SparseApplyAdagradDa sparseApplyAdagradDa(Operand var, + Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, + Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, SparseApplyAdagradDa.Options... options) { return SparseApplyAdagradDa.create(scope, var, gradientAccumulator, gradientSquaredAccumulator, grad, indices, lr, l1, l2, globalStep, options); } @@ -1496,9 +1498,9 @@ public SparseApplyAdagradDa sparseApplyA * @param options carries optional attributes values * @return a new instance of SparseApplyCenteredRmsProp */ - public SparseApplyCenteredRmsProp sparseApplyCenteredRmsProp( - Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, - Operand momentum, Operand epsilon, Operand grad, Operand indices, + public SparseApplyCenteredRmsProp sparseApplyCenteredRmsProp(Operand var, + Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, + Operand momentum, Operand epsilon, Operand grad, Operand indices, SparseApplyCenteredRmsProp.Options... options) { return SparseApplyCenteredRmsProp.create(scope, var, mg, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); } @@ -1529,8 +1531,8 @@ public SparseApplyCenteredRmsProp sparse * @param options carries optional attributes values * @return a new instance of SparseApplyFtrl */ - public SparseApplyFtrl sparseApplyFtrl(Operand var, - Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, + public SparseApplyFtrl sparseApplyFtrl(Operand var, Operand accum, + Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, SparseApplyFtrl.Options... options) { return SparseApplyFtrl.create(scope, var, accum, linear, grad, indices, lr, l1, l2, l2Shrinkage, lrPower, options); @@ -1556,8 +1558,8 @@ public SparseApplyFtrl sparseApplyFtrl(O * @param options carries optional attributes values * @return a new instance of SparseApplyMomentum */ - public SparseApplyMomentum sparseApplyMomentum( - Operand var, Operand accum, Operand lr, Operand grad, Operand indices, + public SparseApplyMomentum sparseApplyMomentum(Operand var, + Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, SparseApplyMomentum.Options... options) { return SparseApplyMomentum.create(scope, var, accum, lr, grad, indices, momentum, options); } @@ -1582,9 +1584,9 @@ public SparseApplyMomentum sparseApplyMo * @param options carries optional attributes values * @return a new instance of SparseApplyProximalAdagrad */ - public SparseApplyProximalAdagrad sparseApplyProximalAdagrad( - Operand var, Operand accum, Operand lr, Operand l1, Operand l2, - Operand grad, Operand indices, SparseApplyProximalAdagrad.Options... options) { + public SparseApplyProximalAdagrad sparseApplyProximalAdagrad(Operand var, + Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, + Operand indices, SparseApplyProximalAdagrad.Options... options) { return SparseApplyProximalAdagrad.create(scope, var, accum, lr, l1, l2, grad, indices, options); } @@ -1605,9 +1607,9 @@ public SparseApplyProximalAdagrad sparse * @param options carries optional attributes values * @return a new instance of SparseApplyProximalGradientDescent */ - public SparseApplyProximalGradientDescent sparseApplyProximalGradientDescent( + public SparseApplyProximalGradientDescent sparseApplyProximalGradientDescent( Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, - Operand indices, SparseApplyProximalGradientDescent.Options... options) { + Operand indices, SparseApplyProximalGradientDescent.Options... options) { return SparseApplyProximalGradientDescent.create(scope, var, alpha, l1, l2, grad, indices, options); } @@ -1638,10 +1640,9 @@ public SparseApplyProximalGradientDescent SparseApplyRmsProp sparseApplyRmsProp( - Operand var, Operand ms, Operand mom, Operand lr, Operand rho, - Operand momentum, Operand epsilon, Operand grad, Operand indices, - SparseApplyRmsProp.Options... options) { + public SparseApplyRmsProp sparseApplyRmsProp(Operand var, Operand ms, + Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, + Operand grad, Operand indices, SparseApplyRmsProp.Options... options) { return SparseApplyRmsProp.create(scope, var, ms, mom, lr, rho, momentum, epsilon, grad, indices, options); } 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 4c8df665739..d4e9c94d250 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 @@ -68,8 +68,8 @@ public final class XlaOps { * @param broadcastDims an XLA-style broadcast dimension specification * @return a new instance of BroadcastHelper */ - public BroadcastHelper broadcastHelper(Operand lhs, - Operand rhs, Operand broadcastDims) { + public BroadcastHelper broadcastHelper(Operand lhs, Operand rhs, + Operand broadcastDims) { return BroadcastHelper.create(scope, lhs, rhs, broadcastDims); } @@ -190,8 +190,8 @@ public DynamicSlice dynamicSlice(Operand * `input`. * @return a new instance of DynamicUpdateSlice */ - public DynamicUpdateSlice dynamicUpdateSlice( - Operand input, Operand update, Operand indices) { + public DynamicUpdateSlice dynamicUpdateSlice(Operand input, + Operand update, Operand indices) { return DynamicUpdateSlice.create(scope, input, update, indices); } @@ -328,7 +328,7 @@ public SelfAdjointEig selfAdjointEig(Operand a, Boolean * @param tensorName A string key that identifies the channel. * @return a new instance of Send */ - public Send send(Operand tensor, String tensorName) { + public Send send(Operand tensor, String tensorName) { return Send.create(scope, tensor, tensorName); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java index 17b3a3bf0c3..c0d9108cc7f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/All.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of All */ @Endpoint(describeByClass = true) - public static All create(Scope scope, Operand input, Operand axis, Options... options) { + public static All create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("All", scope.makeOpName("All")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java index 85a60f6b2e0..d9b339923a0 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Any.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of Any */ @Endpoint(describeByClass = true) - public static Any create(Scope scope, Operand input, Operand axis, Options... options) { + public static Any create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Any", scope.makeOpName("Any")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java index 58d7ed3ca45..6bb441bd9c7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignAddVariableOp.java @@ -44,7 +44,7 @@ public final class AssignAddVariableOp extends RawOp { * @return a new instance of AssignAddVariableOp */ @Endpoint(describeByClass = true) - public static AssignAddVariableOp create(Scope scope, Operand resource, Operand value) { + public static AssignAddVariableOp create(Scope scope, Operand resource, Operand value) { OperationBuilder opBuilder = scope.env().opBuilder("AssignAddVariableOp", scope.makeOpName("AssignAddVariableOp")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(value.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java index a7868911c52..dc2ce281c7e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignSubVariableOp.java @@ -44,7 +44,7 @@ public final class AssignSubVariableOp extends RawOp { * @return a new instance of AssignSubVariableOp */ @Endpoint(describeByClass = true) - public static AssignSubVariableOp create(Scope scope, Operand resource, Operand value) { + public static AssignSubVariableOp create(Scope scope, Operand resource, Operand value) { OperationBuilder opBuilder = scope.env().opBuilder("AssignSubVariableOp", scope.makeOpName("AssignSubVariableOp")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(value.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java index e2ea7b0b524..4fd1a56a06f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/AssignVariableOp.java @@ -44,7 +44,7 @@ public final class AssignVariableOp extends RawOp { * @return a new instance of AssignVariableOp */ @Endpoint(describeByClass = true) - public static AssignVariableOp create(Scope scope, Operand resource, Operand value) { + public static AssignVariableOp create(Scope scope, Operand resource, Operand value) { OperationBuilder opBuilder = scope.env().opBuilder("AssignVariableOp", scope.makeOpName("AssignVariableOp")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(value.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java index ccb8c6da826..5bd70a0a197 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BarrierInsertMany.java @@ -50,7 +50,7 @@ public final class BarrierInsertMany extends RawOp { * @return a new instance of BarrierInsertMany */ @Endpoint(describeByClass = true) - public static BarrierInsertMany create(Scope scope, Operand handle, Operand keys, Operand values, Long componentIndex) { + public static BarrierInsertMany create(Scope scope, Operand handle, Operand keys, Operand values, Long componentIndex) { OperationBuilder opBuilder = scope.env().opBuilder("BarrierInsertMany", scope.makeOpName("BarrierInsertMany")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(keys.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java index 0700ca1efd8..bf5100836e8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpace.java @@ -61,7 +61,7 @@ public final class BatchToSpace extends RawOp implements Operan * @return a new instance of BatchToSpace */ @Endpoint(describeByClass = true) - public static BatchToSpace create(Scope scope, Operand input, Operand crops, Long blockSize) { + public static BatchToSpace create(Scope scope, Operand input, Operand crops, Long blockSize) { OperationBuilder opBuilder = scope.env().opBuilder("BatchToSpace", scope.makeOpName("BatchToSpace")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(crops.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java index 3c56135aa37..1890b0e5d54 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BatchToSpaceNd.java @@ -148,7 +148,7 @@ public final class BatchToSpaceNd extends RawOp implements Oper * @return a new instance of BatchToSpaceNd */ @Endpoint(describeByClass = true) - public static BatchToSpaceNd create(Scope scope, Operand input, Operand blockShape, Operand crops) { + public static BatchToSpaceNd create(Scope scope, Operand input, Operand blockShape, Operand crops) { OperationBuilder opBuilder = scope.env().opBuilder("BatchToSpaceND", scope.makeOpName("BatchToSpaceNd")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(blockShape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java index 04ea83cf3be..e9176b8dd99 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bitcast.java @@ -96,7 +96,7 @@ public final class Bitcast extends RawOp implements Operand * @return a new instance of Bitcast */ @Endpoint(describeByClass = true) - public static Bitcast create(Scope scope, Operand input, Class type) { + public static Bitcast create(Scope scope, Operand input, Class type) { OperationBuilder opBuilder = scope.env().opBuilder("Bitcast", scope.makeOpName("Bitcast")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java index de9b4ee7c88..5cdf860d611 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/BroadcastTo.java @@ -73,7 +73,7 @@ public final class BroadcastTo extends RawOp implements Operand * @return a new instance of BroadcastTo */ @Endpoint(describeByClass = true) - public static BroadcastTo create(Scope scope, Operand input, Operand shape) { + public static BroadcastTo create(Scope scope, Operand input, Operand shape) { OperationBuilder opBuilder = scope.env().opBuilder("BroadcastTo", scope.makeOpName("BroadcastTo")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(shape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java index 87197f19c3d..355c7b7a46e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Bucketize.java @@ -55,7 +55,7 @@ public final class Bucketize extends RawOp implements Operand { * @return a new instance of Bucketize */ @Endpoint(describeByClass = true) - public static Bucketize create(Scope scope, Operand input, List boundaries) { + public static Bucketize create(Scope scope, Operand input, List boundaries) { OperationBuilder opBuilder = scope.env().opBuilder("Bucketize", scope.makeOpName("Bucketize")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java index 33723c7c364..279ae8e4b2f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Concat.java @@ -48,7 +48,7 @@ public final class Concat extends RawOp implements Operand { * @return a new instance of Concat */ @Endpoint(describeByClass = true) - public static Concat create(Scope scope, Iterable> values, Operand axis) { + public static Concat create(Scope scope, Iterable> values, Operand axis) { OperationBuilder opBuilder = scope.env().opBuilder("ConcatV2", scope.makeOpName("Concat")); opBuilder.addInputList(Operands.asOutputs(values)); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DummySeedGenerator.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DummySeedGenerator.java deleted file mode 100644 index 832887f1950..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/DummySeedGenerator.java +++ /dev/null @@ -1,65 +0,0 @@ -/* 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.core; - -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.types.family.TType; - -/** - */ -public final class DummySeedGenerator extends RawOp implements Operand { - - /** - * Factory method to create a class wrapping a new DummySeedGenerator operation. - * - * @param scope current scope - * @return a new instance of DummySeedGenerator - */ - @Endpoint(describeByClass = true) - public static DummySeedGenerator create(Scope scope) { - OperationBuilder opBuilder = scope.env().opBuilder("DummySeedGenerator", scope.makeOpName("DummySeedGenerator")); - opBuilder = scope.apply(opBuilder); - return new DummySeedGenerator(opBuilder.build()); - } - - /** - */ - public Output handle() { - return handle; - } - - @Override - @SuppressWarnings("unchecked") - public Output asOutput() { - return (Output) handle; - } - - private Output handle; - - private DummySeedGenerator(Operation operation) { - super(operation); - int outputIdx = 0; - handle = operation.output(outputIdx++); - } -} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java index e5ec261e5b8..db314701fe6 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/EmptyTensorList.java @@ -53,7 +53,7 @@ public final class EmptyTensorList extends RawOp implements Operand { * @return a new instance of EmptyTensorList */ @Endpoint(describeByClass = true) - public static EmptyTensorList create(Scope scope, Operand elementShape, Operand maxNumElements, Class elementDtype) { + public static EmptyTensorList create(Scope scope, Operand elementShape, Operand maxNumElements, Class elementDtype) { OperationBuilder opBuilder = scope.env().opBuilder("EmptyTensorList", scope.makeOpName("EmptyTensorList")); opBuilder.addInput(elementShape.asOutput()); opBuilder.addInput(maxNumElements.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java index 9f94e27b7f0..c80e1809420 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ExpandDims.java @@ -76,7 +76,7 @@ public final class ExpandDims extends RawOp implements Operand< * @return a new instance of ExpandDims */ @Endpoint(describeByClass = true) - public static ExpandDims create(Scope scope, Operand input, Operand axis) { + public static ExpandDims create(Scope scope, Operand input, Operand axis) { OperationBuilder opBuilder = scope.env().opBuilder("ExpandDims", scope.makeOpName("ExpandDims")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java index 9f79df9c99b..fac22b5f885 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fill.java @@ -72,7 +72,7 @@ public final class Fill extends RawOp implements Operand { * @return a new instance of Fill */ @Endpoint(describeByClass = true) - public static Fill create(Scope scope, Operand dims, Operand value) { + public static Fill create(Scope scope, Operand dims, Operand value) { OperationBuilder opBuilder = scope.env().opBuilder("Fill", scope.makeOpName("Fill")); opBuilder.addInput(dims.asOutput()); opBuilder.addInput(value.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java index 2bd330c9293..5911fa07e40 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Fingerprint.java @@ -74,7 +74,7 @@ public final class Fingerprint extends RawOp implements Operand { * @return a new instance of Fingerprint */ @Endpoint(describeByClass = true) - public static Fingerprint create(Scope scope, Operand data, Operand method) { + public static Fingerprint create(Scope scope, Operand data, Operand method) { OperationBuilder opBuilder = scope.env().opBuilder("Fingerprint", scope.makeOpName("Fingerprint")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(method.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java index 358a5dbfab0..e4a366d96f3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Gather.java @@ -94,7 +94,7 @@ private Options() { * @return a new instance of Gather */ @Endpoint(describeByClass = true) - public static Gather create(Scope scope, Operand params, Operand indices, Operand axis, Options... options) { + public static Gather create(Scope scope, Operand params, Operand indices, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("GatherV2", scope.makeOpName("Gather")); opBuilder.addInput(params.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java index 1bf4500fd75..d7a5fa04b7e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GatherNd.java @@ -138,7 +138,7 @@ public final class GatherNd extends RawOp implements Operand * @return a new instance of GatherNd */ @Endpoint(describeByClass = true) - public static GatherNd create(Scope scope, Operand params, Operand indices) { + public static GatherNd create(Scope scope, Operand params, Operand indices) { OperationBuilder opBuilder = scope.env().opBuilder("GatherNd", scope.makeOpName("GatherNd")); opBuilder.addInput(params.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java index b03925faa4e..e3a46804398 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/GetSessionHandle.java @@ -41,7 +41,7 @@ public final class GetSessionHandle extends RawOp implements Operand { * @return a new instance of GetSessionHandle */ @Endpoint(describeByClass = true) - public static GetSessionHandle create(Scope scope, Operand value) { + public static GetSessionHandle create(Scope scope, Operand value) { OperationBuilder opBuilder = scope.env().opBuilder("GetSessionHandleV2", scope.makeOpName("GetSessionHandle")); opBuilder.addInput(value.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java index d08f66042a6..d873004b378 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/InitializeTable.java @@ -42,7 +42,7 @@ public final class InitializeTable extends RawOp { * @return a new instance of InitializeTable */ @Endpoint(describeByClass = true) - public static InitializeTable create(Scope scope, Operand tableHandle, Operand keys, Operand values) { + public static InitializeTable create(Scope scope, Operand tableHandle, Operand keys, Operand values) { OperationBuilder opBuilder = scope.env().opBuilder("InitializeTableV2", scope.makeOpName("InitializeTable")); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java index 7fdf0ee33ee..aea759600e0 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/IsVariableInitialized.java @@ -44,7 +44,7 @@ public final class IsVariableInitialized extends RawOp implements Operand * @return a new instance of IsVariableInitialized */ @Endpoint(describeByClass = true) - public static IsVariableInitialized create(Scope scope, Operand ref) { + public static IsVariableInitialized create(Scope scope, Operand ref) { OperationBuilder opBuilder = scope.env().opBuilder("IsVariableInitialized", scope.makeOpName("IsVariableInitialized")); opBuilder.addInput(ref.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java index 29662e643f8..086bd32278d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LinSpace.java @@ -54,7 +54,7 @@ public final class LinSpace extends RawOp implements Operand< * @return a new instance of LinSpace */ @Endpoint(describeByClass = true) - public static LinSpace create(Scope scope, Operand start, Operand stop, Operand num) { + public static LinSpace create(Scope scope, Operand start, Operand stop, Operand num) { OperationBuilder opBuilder = scope.env().opBuilder("LinSpace", scope.makeOpName("LinSpace")); opBuilder.addInput(start.asOutput()); opBuilder.addInput(stop.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java index 8500e2c3cab..930f30b8ea7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableFind.java @@ -51,7 +51,7 @@ public final class LookupTableFind extends RawOp implements Ope * @return a new instance of LookupTableFind */ @Endpoint(describeByClass = true) - public static LookupTableFind create(Scope scope, Operand tableHandle, Operand keys, Operand defaultValue) { + public static LookupTableFind create(Scope scope, Operand tableHandle, Operand keys, Operand defaultValue) { OperationBuilder opBuilder = scope.env().opBuilder("LookupTableFindV2", scope.makeOpName("LookupTableFind")); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java index c8553c28569..b7957c394ce 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableImport.java @@ -45,7 +45,7 @@ public final class LookupTableImport extends RawOp { * @return a new instance of LookupTableImport */ @Endpoint(describeByClass = true) - public static LookupTableImport create(Scope scope, Operand tableHandle, Operand keys, Operand values) { + public static LookupTableImport create(Scope scope, Operand tableHandle, Operand keys, Operand values) { OperationBuilder opBuilder = scope.env().opBuilder("LookupTableImportV2", scope.makeOpName("LookupTableImport")); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java index 827d0f9509e..c444db4fe52 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableInsert.java @@ -45,7 +45,7 @@ public final class LookupTableInsert extends RawOp { * @return a new instance of LookupTableInsert */ @Endpoint(describeByClass = true) - public static LookupTableInsert create(Scope scope, Operand tableHandle, Operand keys, Operand values) { + public static LookupTableInsert create(Scope scope, Operand tableHandle, Operand keys, Operand values) { OperationBuilder opBuilder = scope.env().opBuilder("LookupTableInsertV2", scope.makeOpName("LookupTableInsert")); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java index 577c762e385..2965fd839da 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/LookupTableRemove.java @@ -43,7 +43,7 @@ public final class LookupTableRemove extends RawOp { * @return a new instance of LookupTableRemove */ @Endpoint(describeByClass = true) - public static LookupTableRemove create(Scope scope, Operand tableHandle, Operand keys) { + public static LookupTableRemove create(Scope scope, Operand tableHandle, Operand keys) { OperationBuilder opBuilder = scope.env().opBuilder("LookupTableRemoveV2", scope.makeOpName("LookupTableRemove")); opBuilder.addInput(tableHandle.asOutput()); opBuilder.addInput(keys.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java index 1ed2095c8c5..690767e561a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Max.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of Max */ @Endpoint(describeByClass = true) - public static Max create(Scope scope, Operand input, Operand axis, Options... options) { + public static Max create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Max", scope.makeOpName("Max")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java index dc491611bc4..bc06376c01f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Min.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of Min */ @Endpoint(describeByClass = true) - public static Min create(Scope scope, Operand input, Operand axis, Options... options) { + public static Min create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Min", scope.makeOpName("Min")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java index fc875c50e29..717a77c7a6a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPad.java @@ -77,7 +77,7 @@ public final class MirrorPad extends RawOp implements Operand MirrorPad create(Scope scope, Operand input, Operand paddings, String mode) { + public static MirrorPad create(Scope scope, Operand input, Operand paddings, String mode) { OperationBuilder opBuilder = scope.env().opBuilder("MirrorPad", scope.makeOpName("MirrorPad")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java index 5d8b1b19b71..901620aa27d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/MirrorPadGrad.java @@ -65,7 +65,7 @@ public final class MirrorPadGrad extends RawOp implements Opera * @return a new instance of MirrorPadGrad */ @Endpoint(describeByClass = true) - public static MirrorPadGrad create(Scope scope, Operand input, Operand paddings, String mode) { + public static MirrorPadGrad create(Scope scope, Operand input, Operand paddings, String mode) { OperationBuilder opBuilder = scope.env().opBuilder("MirrorPadGrad", scope.makeOpName("MirrorPadGrad")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java index ab4e675613e..46e82fd3b41 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/OneHot.java @@ -149,7 +149,7 @@ private Options() { * @return a new instance of OneHot */ @Endpoint(describeByClass = true) - public static OneHot create(Scope scope, Operand indices, Operand depth, Operand onValue, Operand offValue, Options... options) { + public static OneHot create(Scope scope, Operand indices, Operand depth, Operand onValue, Operand offValue, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("OneHot", scope.makeOpName("OneHot")); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(depth.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java index ed4e3e5e36a..f455f0fc98c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Pad.java @@ -71,7 +71,7 @@ public final class Pad extends RawOp implements Operand { * @return a new instance of Pad */ @Endpoint(describeByClass = true) - public static Pad create(Scope scope, Operand input, Operand paddings, Operand constantValues) { + public static Pad create(Scope scope, Operand input, Operand paddings, Operand constantValues) { OperationBuilder opBuilder = scope.env().opBuilder("PadV2", scope.makeOpName("Pad")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java index bdd361de117..3d48cb2a4d3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Prod.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of Prod */ @Endpoint(describeByClass = true) - public static Prod create(Scope scope, Operand input, Operand axis, Options... options) { + public static Prod create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Prod", scope.makeOpName("Prod")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java index a0d66078672..13a8a62b000 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/QuantizedReshape.java @@ -50,7 +50,7 @@ public final class QuantizedReshape extends RawOp { * @return a new instance of QuantizedReshape */ @Endpoint(describeByClass = true) - public static QuantizedReshape create(Scope scope, Operand tensor, Operand shape, Operand inputMin, Operand inputMax) { + public static QuantizedReshape create(Scope scope, Operand tensor, Operand shape, Operand inputMin, Operand inputMax) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedReshape", scope.makeOpName("QuantizedReshape")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(shape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java index e948bc5d909..cff0df03467 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Rank.java @@ -54,7 +54,7 @@ public final class Rank extends RawOp implements Operand { * @return a new instance of Rank */ @Endpoint(describeByClass = true) - public static Rank create(Scope scope, Operand input) { + public static Rank create(Scope scope, Operand input) { OperationBuilder opBuilder = scope.env().opBuilder("Rank", scope.makeOpName("Rank")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java index 9c731309c44..fee74f3b81f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAll.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of ReduceAll */ @Endpoint(describeByClass = true) - public static ReduceAll create(Scope scope, Operand input, Operand axis, Options... options) { + public static ReduceAll create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("All", scope.makeOpName("ReduceAll")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java index ce57bd4911b..ff0b97078f9 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceAny.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of ReduceAny */ @Endpoint(describeByClass = true) - public static ReduceAny create(Scope scope, Operand input, Operand axis, Options... options) { + public static ReduceAny create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Any", scope.makeOpName("ReduceAny")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java index eadff9f51cc..44418b844d9 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMax.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of ReduceMax */ @Endpoint(describeByClass = true) - public static ReduceMax create(Scope scope, Operand input, Operand axis, Options... options) { + public static ReduceMax create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Max", scope.makeOpName("ReduceMax")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java index 04dad318bd7..6a7f4361324 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceMin.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of ReduceMin */ @Endpoint(describeByClass = true) - public static ReduceMin create(Scope scope, Operand input, Operand axis, Options... options) { + public static ReduceMin create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Min", scope.makeOpName("ReduceMin")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java index d58e64e5506..da78a30db62 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceProd.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of ReduceProd */ @Endpoint(describeByClass = true) - public static ReduceProd create(Scope scope, Operand input, Operand axis, Options... options) { + public static ReduceProd create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Prod", scope.makeOpName("ReduceProd")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java index 5344feb6790..c06b2998a67 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReduceSum.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of ReduceSum */ @Endpoint(describeByClass = true) - public static ReduceSum create(Scope scope, Operand input, Operand axis, Options... options) { + public static ReduceSum create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Sum", scope.makeOpName("ReduceSum")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java index 6bf11ac1cb6..1da37dd550d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reshape.java @@ -105,7 +105,7 @@ public final class Reshape extends RawOp implements Operand * @return a new instance of Reshape */ @Endpoint(describeByClass = true) - public static Reshape create(Scope scope, Operand tensor, Operand shape) { + public static Reshape create(Scope scope, Operand tensor, Operand shape) { OperationBuilder opBuilder = scope.env().opBuilder("Reshape", scope.makeOpName("Reshape")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(shape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java index 4830d44d3ba..c8906164dd7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGather.java @@ -90,7 +90,7 @@ private Options() { * @return a new instance of ResourceGather */ @Endpoint(describeByClass = true) - public static ResourceGather create(Scope scope, Operand resource, Operand indices, Class dtype, Options... options) { + public static ResourceGather create(Scope scope, Operand resource, Operand indices, Class dtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceGather", scope.makeOpName("ResourceGather")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java index d78b649a997..5cadc84d016 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceGatherNd.java @@ -45,7 +45,7 @@ public final class ResourceGatherNd extends RawOp implements Op * @return a new instance of ResourceGatherNd */ @Endpoint(describeByClass = true) - public static ResourceGatherNd create(Scope scope, Operand resource, Operand indices, Class dtype) { + public static ResourceGatherNd create(Scope scope, Operand resource, Operand indices, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceGatherNd", scope.makeOpName("ResourceGatherNd")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java index 3192cacae98..935000e7ec6 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterAdd.java @@ -63,7 +63,7 @@ public final class ResourceScatterAdd extends RawOp { * @return a new instance of ResourceScatterAdd */ @Endpoint(describeByClass = true) - public static ResourceScatterAdd create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterAdd create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterAdd", scope.makeOpName("ResourceScatterAdd")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java index bd09a85926c..8a21a2706a3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterDiv.java @@ -63,7 +63,7 @@ public final class ResourceScatterDiv extends RawOp { * @return a new instance of ResourceScatterDiv */ @Endpoint(describeByClass = true) - public static ResourceScatterDiv create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterDiv create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterDiv", scope.makeOpName("ResourceScatterDiv")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java index 45f49015271..7e6ca9e3302 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMax.java @@ -63,7 +63,7 @@ public final class ResourceScatterMax extends RawOp { * @return a new instance of ResourceScatterMax */ @Endpoint(describeByClass = true) - public static ResourceScatterMax create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterMax create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterMax", scope.makeOpName("ResourceScatterMax")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java index a39cbb50473..9fa3cf76ca8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMin.java @@ -63,7 +63,7 @@ public final class ResourceScatterMin extends RawOp { * @return a new instance of ResourceScatterMin */ @Endpoint(describeByClass = true) - public static ResourceScatterMin create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterMin create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterMin", scope.makeOpName("ResourceScatterMin")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java index 824a32a4365..1133e6f2f82 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterMul.java @@ -63,7 +63,7 @@ public final class ResourceScatterMul extends RawOp { * @return a new instance of ResourceScatterMul */ @Endpoint(describeByClass = true) - public static ResourceScatterMul create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterMul create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterMul", scope.makeOpName("ResourceScatterMul")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java index 7cbc9c5e95e..5a020f072df 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdAdd.java @@ -97,7 +97,7 @@ private Options() { * @return a new instance of ResourceScatterNdAdd */ @Endpoint(describeByClass = true) - public static ResourceScatterNdAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ResourceScatterNdAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdAdd", scope.makeOpName("ResourceScatterNdAdd")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java index a2376fdd93e..156af50c380 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMax.java @@ -66,7 +66,7 @@ private Options() { * @return a new instance of ResourceScatterNdMax */ @Endpoint(describeByClass = true) - public static ResourceScatterNdMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ResourceScatterNdMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdMax", scope.makeOpName("ResourceScatterNdMax")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java index b17a4bad0a8..45909f9cbab 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdMin.java @@ -66,7 +66,7 @@ private Options() { * @return a new instance of ResourceScatterNdMin */ @Endpoint(describeByClass = true) - public static ResourceScatterNdMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ResourceScatterNdMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdMin", scope.makeOpName("ResourceScatterNdMin")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java index c8f6072e0ee..4e166746f7b 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdSub.java @@ -97,7 +97,7 @@ private Options() { * @return a new instance of ResourceScatterNdSub */ @Endpoint(describeByClass = true) - public static ResourceScatterNdSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ResourceScatterNdSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdSub", scope.makeOpName("ResourceScatterNdSub")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java index 2319e1623a7..ae9539388d7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterNdUpdate.java @@ -99,7 +99,7 @@ private Options() { * @return a new instance of ResourceScatterNdUpdate */ @Endpoint(describeByClass = true) - public static ResourceScatterNdUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ResourceScatterNdUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterNdUpdate", scope.makeOpName("ResourceScatterNdUpdate")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java index bed6347bf94..35d94ad5a52 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterSub.java @@ -63,7 +63,7 @@ public final class ResourceScatterSub extends RawOp { * @return a new instance of ResourceScatterSub */ @Endpoint(describeByClass = true) - public static ResourceScatterSub create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterSub create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterSub", scope.makeOpName("ResourceScatterSub")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java index 117e4657c4a..df04dff7608 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceScatterUpdate.java @@ -54,7 +54,7 @@ public final class ResourceScatterUpdate extends RawOp { * @return a new instance of ResourceScatterUpdate */ @Endpoint(describeByClass = true) - public static ResourceScatterUpdate create(Scope scope, Operand resource, Operand indices, Operand updates) { + public static ResourceScatterUpdate create(Scope scope, Operand resource, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceScatterUpdate", scope.makeOpName("ResourceScatterUpdate")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java index e7e406142db..d0e6fc06b2f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ResourceStridedSliceAssign.java @@ -108,7 +108,7 @@ private Options() { * @return a new instance of ResourceStridedSliceAssign */ @Endpoint(describeByClass = true) - public static ResourceStridedSliceAssign create(Scope scope, Operand ref, Operand begin, Operand end, Operand strides, Operand value, Options... options) { + public static ResourceStridedSliceAssign create(Scope scope, Operand ref, Operand begin, Operand end, Operand strides, Operand value, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceStridedSliceAssign", scope.makeOpName("ResourceStridedSliceAssign")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(begin.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java index 9b87881ee88..95cc701bae3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Reverse.java @@ -93,7 +93,7 @@ public final class Reverse extends RawOp implements Operand * @return a new instance of Reverse */ @Endpoint(describeByClass = true) - public static Reverse create(Scope scope, Operand tensor, Operand axis) { + public static Reverse create(Scope scope, Operand tensor, Operand axis) { OperationBuilder opBuilder = scope.env().opBuilder("ReverseV2", scope.makeOpName("Reverse")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java index 7db393ecd50..6793713f659 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ReverseSequence.java @@ -120,7 +120,7 @@ private Options() { * @return a new instance of ReverseSequence */ @Endpoint(describeByClass = true) - public static ReverseSequence create(Scope scope, Operand input, Operand seqLengths, Long seqDim, Options... options) { + public static ReverseSequence create(Scope scope, Operand input, Operand seqLengths, Long seqDim, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ReverseSequence", scope.makeOpName("ReverseSequence")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(seqLengths.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java index f353e8f3053..4151cb41a3e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Roll.java @@ -73,7 +73,7 @@ public final class Roll extends RawOp implements Operand { * @return a new instance of Roll */ @Endpoint(describeByClass = true) - public static Roll create(Scope scope, Operand input, Operand shift, Operand axis) { + public static Roll create(Scope scope, Operand input, Operand shift, Operand axis) { OperationBuilder opBuilder = scope.env().opBuilder("Roll", scope.makeOpName("Roll")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(shift.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java index 560aa2f9ef5..61b7f0e29c6 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterAdd.java @@ -90,7 +90,7 @@ private Options() { * @return a new instance of ScatterAdd */ @Endpoint(describeByClass = true) - public static ScatterAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterAdd", scope.makeOpName("ScatterAdd")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java index 68053623830..d7de6fb959d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterDiv.java @@ -86,7 +86,7 @@ private Options() { * @return a new instance of ScatterDiv */ @Endpoint(describeByClass = true) - public static ScatterDiv create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterDiv create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterDiv", scope.makeOpName("ScatterDiv")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java index 746a6d30a35..b76c71f3aad 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMax.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of ScatterMax */ @Endpoint(describeByClass = true) - public static ScatterMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterMax", scope.makeOpName("ScatterMax")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java index 4f854496bf3..20c4393ce79 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMin.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of ScatterMin */ @Endpoint(describeByClass = true) - public static ScatterMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterMin", scope.makeOpName("ScatterMin")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java index fa4389e6ce9..7b155dd8fd5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterMul.java @@ -86,7 +86,7 @@ private Options() { * @return a new instance of ScatterMul */ @Endpoint(describeByClass = true) - public static ScatterMul create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterMul create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterMul", scope.makeOpName("ScatterMul")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java index 5de6047092a..3ccd389abcb 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdAdd.java @@ -100,7 +100,7 @@ private Options() { * @return a new instance of ScatterNdAdd */ @Endpoint(describeByClass = true) - public static ScatterNdAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterNdAdd create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdAdd", scope.makeOpName("ScatterNdAdd")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java index 8d2868513c5..8c77ecad143 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMax.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of ScatterNdMax */ @Endpoint(describeByClass = true) - public static ScatterNdMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterNdMax create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdMax", scope.makeOpName("ScatterNdMax")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java index 003fd99f1a4..19fbd9eac1e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdMin.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of ScatterNdMin */ @Endpoint(describeByClass = true) - public static ScatterNdMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterNdMin create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdMin", scope.makeOpName("ScatterNdMin")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java index 1e0ee82487a..09396a80e86 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdNonAliasingAdd.java @@ -82,7 +82,7 @@ public final class ScatterNdNonAliasingAdd extends RawOp implem * @return a new instance of ScatterNdNonAliasingAdd */ @Endpoint(describeByClass = true) - public static ScatterNdNonAliasingAdd create(Scope scope, Operand input, Operand indices, Operand updates) { + public static ScatterNdNonAliasingAdd create(Scope scope, Operand input, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdNonAliasingAdd", scope.makeOpName("ScatterNdNonAliasingAdd")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java index 6c07f70d28a..e391a05ff82 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdSub.java @@ -102,7 +102,7 @@ private Options() { * @return a new instance of ScatterNdSub */ @Endpoint(describeByClass = true) - public static ScatterNdSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterNdSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdSub", scope.makeOpName("ScatterNdSub")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java index 89e36796e22..13eb21a735c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterNdUpdate.java @@ -104,7 +104,7 @@ private Options() { * @return a new instance of ScatterNdUpdate */ @Endpoint(describeByClass = true) - public static ScatterNdUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterNdUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterNdUpdate", scope.makeOpName("ScatterNdUpdate")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java index 2b5d2c9d488..0d53ef622fe 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterSub.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of ScatterSub */ @Endpoint(describeByClass = true) - public static ScatterSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterSub create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterSub", scope.makeOpName("ScatterSub")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java index ae49b0f626d..37efa7194e8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/ScatterUpdate.java @@ -93,7 +93,7 @@ private Options() { * @return a new instance of ScatterUpdate */ @Endpoint(describeByClass = true) - public static ScatterUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { + public static ScatterUpdate create(Scope scope, Operand ref, Operand indices, Operand updates, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScatterUpdate", scope.makeOpName("ScatterUpdate")); opBuilder.addInput(ref.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Send.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Send.java index 92f4babee07..480cd265f1a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Send.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Send.java @@ -66,7 +66,7 @@ private Options() { * @return a new instance of Send */ @Endpoint(describeByClass = true) - public static Send create(Scope scope, Operand tensor, String tensorName, String sendDevice, Long sendDeviceIncarnation, String recvDevice, Options... options) { + public static Send create(Scope scope, Operand tensor, String tensorName, String sendDevice, Long sendDeviceIncarnation, String recvDevice, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Send", scope.makeOpName("Send")); opBuilder.addInput(tensor.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java index 921306f689d..bfa86868a72 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SetSize.java @@ -72,7 +72,7 @@ private Options() { * @return a new instance of SetSize */ @Endpoint(describeByClass = true) - public static SetSize create(Scope scope, Operand setIndices, Operand setValues, Operand setShape, Options... options) { + public static SetSize create(Scope scope, Operand setIndices, Operand setValues, Operand setShape, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SetSize", scope.makeOpName("SetSize")); opBuilder.addInput(setIndices.asOutput()); opBuilder.addInput(setValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java index a2d8a43a496..dbb34980213 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Shape.java @@ -56,7 +56,7 @@ public final class Shape extends RawOp implements Operand * @return a new instance of Shape */ @Endpoint(describeByClass = true) - public static Shape create(Scope scope, Operand input, Class outType) { + public static Shape create(Scope scope, Operand input, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("Shape", scope.makeOpName("Shape")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); @@ -72,7 +72,7 @@ public static Shape create(Scope scope, * @return a new instance of Shape */ @Endpoint(describeByClass = true) - public static Shape create(Scope scope, Operand input) { + public static Shape create(Scope scope, Operand input) { return create(scope, input, TInt32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java index 127608e1fac..07ab596ea23 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Size.java @@ -57,7 +57,7 @@ public final class Size extends RawOp implements Operand { * @return a new instance of Size */ @Endpoint(describeByClass = true) - public static Size create(Scope scope, Operand input, Class outType) { + public static Size create(Scope scope, Operand input, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("Size", scope.makeOpName("Size")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); @@ -73,7 +73,7 @@ public static Size create(Scope scope, O * @return a new instance of Size */ @Endpoint(describeByClass = true) - public static Size create(Scope scope, Operand input) { + public static Size create(Scope scope, Operand input) { return create(scope, input, TInt32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java index 2f01a06e6c6..df34fd91afd 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SpaceToBatchNd.java @@ -147,7 +147,7 @@ public final class SpaceToBatchNd extends RawOp implements Oper * @return a new instance of SpaceToBatchNd */ @Endpoint(describeByClass = true) - public static SpaceToBatchNd create(Scope scope, Operand input, Operand blockShape, Operand paddings) { + public static SpaceToBatchNd create(Scope scope, Operand input, Operand blockShape, Operand paddings) { OperationBuilder opBuilder = scope.env().opBuilder("SpaceToBatchND", scope.makeOpName("SpaceToBatchNd")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(blockShape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java index 9b0bfac7e6a..ee7dced8ee8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/SplitV.java @@ -54,7 +54,7 @@ public final class SplitV extends RawOp implements Iterable SplitV create(Scope scope, Operand value, Operand sizeSplits, Operand axis, Long numSplit) { + public static SplitV create(Scope scope, Operand value, Operand sizeSplits, Operand axis, Long numSplit) { OperationBuilder opBuilder = scope.env().opBuilder("SplitV", scope.makeOpName("SplitV")); opBuilder.addInput(value.asOutput()); opBuilder.addInput(sizeSplits.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java index 0d8e4741bdd..0eedfb90a82 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Sum.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of Sum */ @Endpoint(describeByClass = true) - public static Sum create(Scope scope, Operand input, Operand axis, Options... options) { + public static Sum create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Sum", scope.makeOpName("Sum")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java index 3bf5d2c0912..f00c1477b05 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayScatter.java @@ -48,7 +48,7 @@ public final class TensorArrayScatter extends RawOp implements Operand * @return a new instance of TensorArrayScatter */ @Endpoint(describeByClass = true) - public static TensorArrayScatter create(Scope scope, Operand handle, Operand indices, Operand value, Operand flowIn) { + public static TensorArrayScatter create(Scope scope, Operand handle, Operand indices, Operand value, Operand flowIn) { OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayScatterV3", scope.makeOpName("TensorArrayScatter")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java index 220c1bd5e09..eaab6d412fd 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArraySplit.java @@ -69,7 +69,7 @@ public final class TensorArraySplit extends RawOp implements Operand { * @return a new instance of TensorArraySplit */ @Endpoint(describeByClass = true) - public static TensorArraySplit create(Scope scope, Operand handle, Operand value, Operand lengths, Operand flowIn) { + public static TensorArraySplit create(Scope scope, Operand handle, Operand value, Operand lengths, Operand flowIn) { OperationBuilder opBuilder = scope.env().opBuilder("TensorArraySplitV3", scope.makeOpName("TensorArraySplit")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(value.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java index b1beed2573d..82f62c98658 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayUnpack.java @@ -44,7 +44,7 @@ public final class TensorArrayUnpack extends RawOp implements Operand * @return a new instance of TensorArrayUnpack */ @Endpoint(describeByClass = true) - public static TensorArrayUnpack create(Scope scope, Operand handle, Operand value, Operand flowIn) { + public static TensorArrayUnpack create(Scope scope, Operand handle, Operand value, Operand flowIn) { OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayUnpack", scope.makeOpName("TensorArrayUnpack")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(value.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java index 0d9224a1892..0d2fde02369 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorArrayWrite.java @@ -46,7 +46,7 @@ public final class TensorArrayWrite extends RawOp implements Operand { * @return a new instance of TensorArrayWrite */ @Endpoint(describeByClass = true) - public static TensorArrayWrite create(Scope scope, Operand handle, Operand index, Operand value, Operand flowIn) { + public static TensorArrayWrite create(Scope scope, Operand handle, Operand index, Operand value, Operand flowIn) { OperationBuilder opBuilder = scope.env().opBuilder("TensorArrayWriteV3", scope.makeOpName("TensorArrayWrite")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(index.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java index 685c9c1d900..e419a43b504 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListConcat.java @@ -62,7 +62,7 @@ public final class TensorListConcat extends RawOp { * @return a new instance of TensorListConcat */ @Endpoint(describeByClass = true) - public static TensorListConcat create(Scope scope, Operand inputHandle, Operand elementShape, Operand leadingDims, Class elementDtype) { + public static TensorListConcat create(Scope scope, Operand inputHandle, Operand elementShape, Operand leadingDims, Class elementDtype) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListConcatV2", scope.makeOpName("TensorListConcat")); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(elementShape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java index fe8bc83b4b0..128c23f0947 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListFromTensor.java @@ -48,7 +48,7 @@ public final class TensorListFromTensor extends RawOp implements Operand * @return a new instance of TensorListFromTensor */ @Endpoint(describeByClass = true) - public static TensorListFromTensor create(Scope scope, Operand tensor, Operand elementShape) { + public static TensorListFromTensor create(Scope scope, Operand tensor, Operand elementShape) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListFromTensor", scope.makeOpName("TensorListFromTensor")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(elementShape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java index 507c17654f3..8f831c0ba7c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBack.java @@ -48,7 +48,7 @@ public final class TensorListPushBack extends RawOp implements Operand { * @return a new instance of TensorListPushBack */ @Endpoint(describeByClass = true) - public static TensorListPushBack create(Scope scope, Operand inputHandle, Operand tensor) { + public static TensorListPushBack create(Scope scope, Operand inputHandle, Operand tensor) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListPushBack", scope.makeOpName("TensorListPushBack")); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(tensor.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java index 3ec33e9d73e..b39bb5027fd 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListPushBackBatch.java @@ -41,7 +41,7 @@ public final class TensorListPushBackBatch extends RawOp implements Operand TensorListPushBackBatch create(Scope scope, Operand inputHandles, Operand tensor) { + public static TensorListPushBackBatch create(Scope scope, Operand inputHandles, Operand tensor) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListPushBackBatch", scope.makeOpName("TensorListPushBackBatch")); opBuilder.addInput(inputHandles.asOutput()); opBuilder.addInput(tensor.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java index 71e4c2b2f06..19bf60b1ce2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListReserve.java @@ -51,7 +51,7 @@ public final class TensorListReserve extends RawOp implements Operand { * @return a new instance of TensorListReserve */ @Endpoint(describeByClass = true) - public static TensorListReserve create(Scope scope, Operand elementShape, Operand numElements, Class elementDtype) { + public static TensorListReserve create(Scope scope, Operand elementShape, Operand numElements, Class elementDtype) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListReserve", scope.makeOpName("TensorListReserve")); opBuilder.addInput(elementShape.asOutput()); opBuilder.addInput(numElements.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java index 3c8bf8c84b3..98aaadd7a7c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatter.java @@ -58,7 +58,7 @@ public final class TensorListScatter extends RawOp implements Operand { * @return a new instance of TensorListScatter */ @Endpoint(describeByClass = true) - public static TensorListScatter create(Scope scope, Operand tensor, Operand indices, Operand elementShape, Operand numElements) { + public static TensorListScatter create(Scope scope, Operand tensor, Operand indices, Operand elementShape, Operand numElements) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListScatterV2", scope.makeOpName("TensorListScatter")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java index 6ddd715fd0b..da49a9d672f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListScatterIntoExistingList.java @@ -52,7 +52,7 @@ public final class TensorListScatterIntoExistingList extends RawOp implements Op * @return a new instance of TensorListScatterIntoExistingList */ @Endpoint(describeByClass = true) - public static TensorListScatterIntoExistingList create(Scope scope, Operand inputHandle, Operand tensor, Operand indices) { + public static TensorListScatterIntoExistingList create(Scope scope, Operand inputHandle, Operand tensor, Operand indices) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListScatterIntoExistingList", scope.makeOpName("TensorListScatterIntoExistingList")); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(tensor.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java index 777feebff93..3f8df2fd889 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSetItem.java @@ -43,7 +43,7 @@ public final class TensorListSetItem extends RawOp implements Operand { * @return a new instance of TensorListSetItem */ @Endpoint(describeByClass = true) - public static TensorListSetItem create(Scope scope, Operand inputHandle, Operand index, Operand item) { + public static TensorListSetItem create(Scope scope, Operand inputHandle, Operand index, Operand item) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListSetItem", scope.makeOpName("TensorListSetItem")); opBuilder.addInput(inputHandle.asOutput()); opBuilder.addInput(index.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java index 5fffd258452..2dc7bf979b5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorListSplit.java @@ -53,7 +53,7 @@ public final class TensorListSplit extends RawOp implements Operand { * @return a new instance of TensorListSplit */ @Endpoint(describeByClass = true) - public static TensorListSplit create(Scope scope, Operand tensor, Operand elementShape, Operand lengths) { + public static TensorListSplit create(Scope scope, Operand tensor, Operand elementShape, Operand lengths) { OperationBuilder opBuilder = scope.env().opBuilder("TensorListSplit", scope.makeOpName("TensorListSplit")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(elementShape.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMax.java deleted file mode 100644 index 48c1d75a63f..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMax.java +++ /dev/null @@ -1,75 +0,0 @@ -/* 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.core; - -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; -import org.tensorflow.types.family.TType; - -/** - * @param data type for {@code output()} output - */ -@Operator -public final class TensorScatterMax extends RawOp implements Operand { - - /** - * Factory method to create a class wrapping a new TensorScatterMax operation. - * - * @param scope current scope - * @param tensor Tensor to update. - * @param indices Index tensor. - * @param updates Updates to scatter into output. - * @return a new instance of TensorScatterMax - */ - @Endpoint(describeByClass = true) - public static TensorScatterMax create(Scope scope, Operand tensor, Operand indices, Operand updates) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterMax", scope.makeOpName("TensorScatterMax")); - opBuilder.addInput(tensor.asOutput()); - opBuilder.addInput(indices.asOutput()); - opBuilder.addInput(updates.asOutput()); - opBuilder = scope.apply(opBuilder); - return new TensorScatterMax(opBuilder.build()); - } - - /** - * A new tensor copied from tensor whose values are element-wise maximum between tensor and updates according to the indices. - */ - public Output output() { - return output; - } - - @Override - public Output asOutput() { - return output; - } - - private Output output; - - private TensorScatterMax(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); - } -} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMin.java deleted file mode 100644 index ddbe03e7c6e..00000000000 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterMin.java +++ /dev/null @@ -1,75 +0,0 @@ -/* 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.core; - -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; -import org.tensorflow.types.family.TType; - -/** - * @param data type for {@code output()} output - */ -@Operator -public final class TensorScatterMin extends RawOp implements Operand { - - /** - * Factory method to create a class wrapping a new TensorScatterMin operation. - * - * @param scope current scope - * @param tensor Tensor to update. - * @param indices Index tensor. - * @param updates Updates to scatter into output. - * @return a new instance of TensorScatterMin - */ - @Endpoint(describeByClass = true) - public static TensorScatterMin create(Scope scope, Operand tensor, Operand indices, Operand updates) { - OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterMin", scope.makeOpName("TensorScatterMin")); - opBuilder.addInput(tensor.asOutput()); - opBuilder.addInput(indices.asOutput()); - opBuilder.addInput(updates.asOutput()); - opBuilder = scope.apply(opBuilder); - return new TensorScatterMin(opBuilder.build()); - } - - /** - * A new tensor copied from tensor whose values are element-wise minimum between tensor and updates according to the indices. - */ - public Output output() { - return output; - } - - @Override - public Output asOutput() { - return output; - } - - private Output output; - - private TensorScatterMin(Operation operation) { - super(operation); - int outputIdx = 0; - output = operation.output(outputIdx++); - } -} diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdAdd.java index 9a3a1a174a8..52954e4e323 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdAdd.java @@ -106,7 +106,7 @@ public final class TensorScatterNdAdd extends RawOp implements * @return a new instance of TensorScatterNdAdd */ @Endpoint(describeByClass = true) - public static TensorScatterNdAdd create(Scope scope, Operand tensor, Operand indices, Operand updates) { + public static TensorScatterNdAdd create(Scope scope, Operand tensor, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterAdd", scope.makeOpName("TensorScatterNdAdd")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java index b8d9834f08f..bd6d0be53e1 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMax.java @@ -44,7 +44,7 @@ public final class TensorScatterNdMax extends RawOp implements * @return a new instance of TensorScatterNdMax */ @Endpoint(describeByClass = true) - public static TensorScatterNdMax create(Scope scope, Operand tensor, Operand indices, Operand updates) { + public static TensorScatterNdMax create(Scope scope, Operand tensor, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterMax", scope.makeOpName("TensorScatterNdMax")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java index e4e652e099f..b823931fef8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdMin.java @@ -44,7 +44,7 @@ public final class TensorScatterNdMin extends RawOp implements * @return a new instance of TensorScatterNdMin */ @Endpoint(describeByClass = true) - public static TensorScatterNdMin create(Scope scope, Operand tensor, Operand indices, Operand updates) { + public static TensorScatterNdMin create(Scope scope, Operand tensor, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterMin", scope.makeOpName("TensorScatterNdMin")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java index 631e3d1ba08..a29743da711 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdSub.java @@ -105,7 +105,7 @@ public final class TensorScatterNdSub extends RawOp implements * @return a new instance of TensorScatterNdSub */ @Endpoint(describeByClass = true) - public static TensorScatterNdSub create(Scope scope, Operand tensor, Operand indices, Operand updates) { + public static TensorScatterNdSub create(Scope scope, Operand tensor, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterSub", scope.makeOpName("TensorScatterNdSub")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java index e7f610d4b38..ff7c1ee16d7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/TensorScatterNdUpdate.java @@ -120,7 +120,7 @@ public final class TensorScatterNdUpdate extends RawOp implemen * @return a new instance of TensorScatterNdUpdate */ @Endpoint(describeByClass = true) - public static TensorScatterNdUpdate create(Scope scope, Operand tensor, Operand indices, Operand updates) { + public static TensorScatterNdUpdate create(Scope scope, Operand tensor, Operand indices, Operand updates) { OperationBuilder opBuilder = scope.env().opBuilder("TensorScatterUpdate", scope.makeOpName("TensorScatterNdUpdate")); opBuilder.addInput(tensor.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java index a64f0847416..c7ee253114c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Tile.java @@ -72,7 +72,7 @@ public final class Tile extends RawOp implements Operand { * @return a new instance of Tile */ @Endpoint(describeByClass = true) - public static Tile create(Scope scope, Operand input, Operand multiples) { + public static Tile create(Scope scope, Operand input, Operand multiples) { OperationBuilder opBuilder = scope.env().opBuilder("Tile", scope.makeOpName("Tile")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(multiples.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java index 40b303e2a05..acbbbbc14cb 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Unique.java @@ -90,7 +90,7 @@ public final class Unique extends RawOp { * @return a new instance of Unique */ @Endpoint(describeByClass = true) - public static Unique create(Scope scope, Operand x, Operand axis, Class outIdx) { + public static Unique create(Scope scope, Operand x, Operand axis, Class outIdx) { OperationBuilder opBuilder = scope.env().opBuilder("UniqueV2", scope.makeOpName("Unique")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(axis.asOutput()); @@ -109,7 +109,7 @@ public static Unique Unique create(Scope scope, Operand x, Operand axis) { + public static Unique create(Scope scope, Operand x, Operand axis) { return create(scope, x, axis, TInt32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java index cf2ae7566cc..b2a9a5c2193 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/UniqueWithCounts.java @@ -94,7 +94,7 @@ public final class UniqueWithCounts extends * @return a new instance of UniqueWithCounts */ @Endpoint(describeByClass = true) - public static UniqueWithCounts create(Scope scope, Operand x, Operand axis, Class outIdx) { + public static UniqueWithCounts create(Scope scope, Operand x, Operand axis, Class outIdx) { OperationBuilder opBuilder = scope.env().opBuilder("UniqueWithCountsV2", scope.makeOpName("UniqueWithCounts")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(axis.asOutput()); @@ -113,7 +113,7 @@ public static UniqueWith * @return a new instance of UniqueWithCounts */ @Endpoint(describeByClass = true) - public static UniqueWithCounts create(Scope scope, Operand x, Operand axis) { + public static UniqueWithCounts create(Scope scope, Operand x, Operand axis) { return create(scope, x, axis, TInt32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java index 5bf2ad25f9e..558da8d85ac 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Where.java @@ -102,7 +102,7 @@ public final class Where extends RawOp implements Operand { * @return a new instance of Where */ @Endpoint(describeByClass = true) - public static Where create(Scope scope, Operand condition) { + public static Where create(Scope scope, Operand condition) { OperationBuilder opBuilder = scope.env().opBuilder("Where", scope.makeOpName("Where")); opBuilder.addInput(condition.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java index b9f5c3a6c72..540355e650b 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/data/SparseTensorSliceDataset.java @@ -43,7 +43,7 @@ public final class SparseTensorSliceDataset extends RawOp implements Operand SparseTensorSliceDataset create(Scope scope, Operand indices, Operand values, Operand denseShape) { + public static SparseTensorSliceDataset create(Scope scope, Operand indices, Operand values, Operand denseShape) { OperationBuilder opBuilder = scope.env().opBuilder("SparseTensorSliceDataset", scope.makeOpName("SparseTensorSliceDataset")); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNanCount.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNanCount.java index 72c0222dbe4..0c3648fcc53 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNanCount.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNanCount.java @@ -97,7 +97,7 @@ private Options() { * @return a new instance of DebugNanCount */ @Endpoint(describeByClass = true) - public static DebugNanCount create(Scope scope, Operand input, Options... options) { + public static DebugNanCount create(Scope scope, Operand input, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("DebugNanCount", scope.makeOpName("DebugNanCount")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNumericsSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNumericsSummary.java index 281d59d21c8..7482e821f72 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNumericsSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/debugging/DebugNumericsSummary.java @@ -132,7 +132,7 @@ private Options() { * @return a new instance of DebugNumericsSummary */ @Endpoint(describeByClass = true) - public static DebugNumericsSummary create(Scope scope, Operand input, Class outputDtype, Options... options) { + public static DebugNumericsSummary create(Scope scope, Operand input, Class outputDtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("DebugNumericSummaryV2", scope.makeOpName("DebugNumericsSummary")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); @@ -159,7 +159,7 @@ public static DebugNumericsSummary creat * @return a new instance of DebugNumericsSummary */ @Endpoint(describeByClass = true) - public static DebugNumericsSummary create(Scope scope, Operand input, Options... options) { + public static DebugNumericsSummary create(Scope scope, Operand input, Options... options) { return create(scope, input, TFloat32.class, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java index d81e8b6a386..90405452574 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/AsString.java @@ -116,7 +116,7 @@ private Options() { * @return a new instance of AsString */ @Endpoint(describeByClass = true) - public static AsString create(Scope scope, Operand input, Options... options) { + public static AsString create(Scope scope, Operand input, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("AsString", scope.makeOpName("AsString")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java index 502d0e564e3..06fe5919afd 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/Cast.java @@ -65,7 +65,7 @@ private Options() { * @return a new instance of Cast */ @Endpoint(describeByClass = true) - public static Cast create(Scope scope, Operand x, Class DstT, Options... options) { + public static Cast create(Scope scope, Operand x, Class DstT, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Cast", scope.makeOpName("Cast")); opBuilder.addInput(x.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/ToBool.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/ToBool.java index c531daca7f5..32b0e91eca4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/ToBool.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/dtypes/ToBool.java @@ -54,7 +54,7 @@ public final class ToBool extends RawOp implements Operand { * @return a new instance of ToBool */ @Endpoint(describeByClass = true) - public static ToBool create(Scope scope, Operand input) { + public static ToBool create(Scope scope, Operand input) { OperationBuilder opBuilder = scope.env().opBuilder("ToBool", scope.makeOpName("ToBool")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java index 7724191d9ef..3607c38dddf 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResize.java @@ -107,7 +107,7 @@ private Options() { * @return a new instance of CropAndResize */ @Endpoint(describeByClass = true) - public static CropAndResize create(Scope scope, Operand image, Operand boxes, Operand boxInd, Operand cropSize, Options... options) { + public static CropAndResize create(Scope scope, Operand image, Operand boxes, Operand boxInd, Operand cropSize, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("CropAndResize", scope.makeOpName("CropAndResize")); opBuilder.addInput(image.asOutput()); opBuilder.addInput(boxes.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java index 82dae7df1e0..a6b53c85a85 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/CropAndResizeGradBoxes.java @@ -78,7 +78,7 @@ private Options() { * @return a new instance of CropAndResizeGradBoxes */ @Endpoint(describeByClass = true) - public static CropAndResizeGradBoxes create(Scope scope, Operand grads, Operand image, Operand boxes, Operand boxInd, Options... options) { + public static CropAndResizeGradBoxes create(Scope scope, Operand grads, Operand image, Operand boxes, Operand boxInd, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("CropAndResizeGradBoxes", scope.makeOpName("CropAndResizeGradBoxes")); opBuilder.addInput(grads.asOutput()); opBuilder.addInput(image.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java index cd0e8b89f7b..7d998947efe 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/EncodePng.java @@ -82,7 +82,7 @@ private Options() { * @return a new instance of EncodePng */ @Endpoint(describeByClass = true) - public static EncodePng create(Scope scope, Operand image, Options... options) { + public static EncodePng create(Scope scope, Operand image, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("EncodePng", scope.makeOpName("EncodePng")); opBuilder.addInput(image.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java index 4d998f6cf1b..d030c1192b7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeArea.java @@ -78,7 +78,7 @@ private Options() { * @return a new instance of ResizeArea */ @Endpoint(describeByClass = true) - public static ResizeArea create(Scope scope, Operand images, Operand size, Options... options) { + public static ResizeArea create(Scope scope, Operand images, Operand size, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResizeArea", scope.makeOpName("ResizeArea")); opBuilder.addInput(images.asOutput()); opBuilder.addInput(size.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java index ecc156ed9d8..dc6b33e3dc1 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBicubic.java @@ -77,7 +77,7 @@ private Options() { * @return a new instance of ResizeBicubic */ @Endpoint(describeByClass = true) - public static ResizeBicubic create(Scope scope, Operand images, Operand size, Options... options) { + public static ResizeBicubic create(Scope scope, Operand images, Operand size, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResizeBicubic", scope.makeOpName("ResizeBicubic")); opBuilder.addInput(images.asOutput()); opBuilder.addInput(size.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java index 0c96019b54d..aaf561156e2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ResizeBilinear.java @@ -77,7 +77,7 @@ private Options() { * @return a new instance of ResizeBilinear */ @Endpoint(describeByClass = true) - public static ResizeBilinear create(Scope scope, Operand images, Operand size, Options... options) { + public static ResizeBilinear create(Scope scope, Operand images, Operand size, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResizeBilinear", scope.makeOpName("ResizeBilinear")); opBuilder.addInput(images.asOutput()); opBuilder.addInput(size.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ScaleAndTranslate.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ScaleAndTranslate.java index 41d49fd75f2..7c728f587c4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ScaleAndTranslate.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/image/ScaleAndTranslate.java @@ -74,7 +74,7 @@ private Options() { * @return a new instance of ScaleAndTranslate */ @Endpoint(describeByClass = true) - public static ScaleAndTranslate create(Scope scope, Operand images, Operand size, Operand scale, Operand translation, Options... options) { + public static ScaleAndTranslate create(Scope scope, Operand images, Operand size, Operand scale, Operand translation, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ScaleAndTranslate", scope.makeOpName("ScaleAndTranslate")); opBuilder.addInput(images.asOutput()); opBuilder.addInput(size.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java index 8a712e7278b..1d839e16c3e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeManySparse.java @@ -58,7 +58,7 @@ public final class SerializeManySparse extends RawOp implements * @return a new instance of SerializeManySparse */ @Endpoint(describeByClass = true) - public static SerializeManySparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Class outType) { + public static SerializeManySparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("SerializeManySparse", scope.makeOpName("SerializeManySparse")); opBuilder.addInput(sparseIndices.asOutput()); opBuilder.addInput(sparseValues.asOutput()); @@ -78,7 +78,7 @@ public static SerializeManySparse create(S * @return a new instance of SerializeManySparse */ @Endpoint(describeByClass = true) - public static SerializeManySparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape) { + public static SerializeManySparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape) { return create(scope, sparseIndices, sparseValues, sparseShape, TString.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java index 611feb50188..fea3e5c424e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeSparse.java @@ -50,7 +50,7 @@ public final class SerializeSparse extends RawOp implements Ope * @return a new instance of SerializeSparse */ @Endpoint(describeByClass = true) - public static SerializeSparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Class outType) { + public static SerializeSparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("SerializeSparse", scope.makeOpName("SerializeSparse")); opBuilder.addInput(sparseIndices.asOutput()); opBuilder.addInput(sparseValues.asOutput()); @@ -70,7 +70,7 @@ public static SerializeSparse create(Scope * @return a new instance of SerializeSparse */ @Endpoint(describeByClass = true) - public static SerializeSparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape) { + public static SerializeSparse create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape) { return create(scope, sparseIndices, sparseValues, sparseShape, TString.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java index 03f42534ba5..809b16786e4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/io/SerializeTensor.java @@ -42,7 +42,7 @@ public final class SerializeTensor extends RawOp implements Operand { * @return a new instance of SerializeTensor */ @Endpoint(describeByClass = true) - public static SerializeTensor create(Scope scope, Operand tensor) { + public static SerializeTensor create(Scope scope, Operand tensor) { OperationBuilder opBuilder = scope.env().opBuilder("SerializeTensor", scope.makeOpName("SerializeTensor")); opBuilder.addInput(tensor.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java index e4e9bc38f9c..12bfdcc5e8a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/ConjugateTranspose.java @@ -49,7 +49,7 @@ public final class ConjugateTranspose extends RawOp implements * @return a new instance of ConjugateTranspose */ @Endpoint(describeByClass = true) - public static ConjugateTranspose create(Scope scope, Operand x, Operand perm) { + public static ConjugateTranspose create(Scope scope, Operand x, Operand perm) { OperationBuilder opBuilder = scope.env().opBuilder("ConjugateTranspose", scope.makeOpName("ConjugateTranspose")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(perm.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Eig.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Eig.java index ac976cc929e..c295f5bb081 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Eig.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Eig.java @@ -78,7 +78,7 @@ private Options() { * @return a new instance of Eig */ @Endpoint(describeByClass = true) - public static Eig create(Scope scope, Operand input, Class Tout, Options... options) { + public static Eig create(Scope scope, Operand input, Class Tout, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Eig", scope.makeOpName("Eig")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/EuclideanNorm.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/EuclideanNorm.java index 220a1847c7d..2a30dd97d5d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/EuclideanNorm.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/EuclideanNorm.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of EuclideanNorm */ @Endpoint(describeByClass = true) - public static EuclideanNorm create(Scope scope, Operand input, Operand axis, Options... options) { + public static EuclideanNorm create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("EuclideanNorm", scope.makeOpName("EuclideanNorm")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java index 517578fe83e..28e9c3ae7c4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMul.java @@ -87,7 +87,7 @@ private Options() { * @return a new instance of QuantizedMatMul */ @Endpoint(describeByClass = true) - public static QuantizedMatMul create(Scope scope, Operand a, Operand b, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Class Tactivation, Options... options) { + public static QuantizedMatMul create(Scope scope, Operand a, Operand b, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Class Tactivation, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMul", scope.makeOpName("QuantizedMatMul")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBias.java index 26ebb08a09e..fd85581fbc9 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBias.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBias.java @@ -97,7 +97,7 @@ private Options() { * @return a new instance of QuantizedMatMulWithBias */ @Endpoint(describeByClass = true) - public static QuantizedMatMulWithBias create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Options... options) { + public static QuantizedMatMulWithBias create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBias", scope.makeOpName("QuantizedMatMulWithBias")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndRelu.java index 12208c96a14..ddf4f44b6d2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndRelu.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndRelu.java @@ -98,7 +98,7 @@ private Options() { * @return a new instance of QuantizedMatMulWithBiasAndRelu */ @Endpoint(describeByClass = true) - public static QuantizedMatMulWithBiasAndRelu create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Options... options) { + public static QuantizedMatMulWithBiasAndRelu create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Class Toutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBiasAndRelu", scope.makeOpName("QuantizedMatMulWithBiasAndRelu")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndReluAndRequantize.java index a20287446c7..06734e0a715 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndReluAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/QuantizedMatMulWithBiasAndReluAndRequantize.java @@ -101,7 +101,7 @@ private Options() { * @return a new instance of QuantizedMatMulWithBiasAndReluAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedMatMulWithBiasAndReluAndRequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { + public static QuantizedMatMulWithBiasAndReluAndRequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBiasAndReluAndRequantize", scope.makeOpName("QuantizedMatMulWithBiasAndReluAndRequantize")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java index de08e116e7b..41d9c28d9d2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/Transpose.java @@ -48,7 +48,7 @@ public final class Transpose extends RawOp implements Operand Transpose create(Scope scope, Operand x, Operand perm) { + public static Transpose create(Scope scope, Operand x, Operand perm) { OperationBuilder opBuilder = scope.env().opBuilder("Transpose", scope.makeOpName("Transpose")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(perm.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/DenseToCSRSparseMatrix.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/DenseToCSRSparseMatrix.java index c650dfdacb2..f380826f82d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/DenseToCSRSparseMatrix.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/DenseToCSRSparseMatrix.java @@ -42,7 +42,7 @@ public final class DenseToCSRSparseMatrix extends RawOp implements Operand DenseToCSRSparseMatrix create(Scope scope, Operand denseInput, Operand indices) { + public static DenseToCSRSparseMatrix create(Scope scope, Operand denseInput, Operand indices) { OperationBuilder opBuilder = scope.env().opBuilder("DenseToCSRSparseMatrix", scope.makeOpName("DenseToCSRSparseMatrix")); opBuilder.addInput(denseInput.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseMatrixMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseMatrixMul.java index 27068d40e1c..0939b31939c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseMatrixMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseMatrixMul.java @@ -50,7 +50,7 @@ public final class SparseMatrixMul extends RawOp implements Operand { * @return a new instance of SparseMatrixMul */ @Endpoint(describeByClass = true) - public static SparseMatrixMul create(Scope scope, Operand a, Operand b) { + public static SparseMatrixMul create(Scope scope, Operand a, Operand b) { OperationBuilder opBuilder = scope.env().opBuilder("SparseMatrixMul", scope.makeOpName("SparseMatrixMul")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseTensorToCSRSparseMatrix.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseTensorToCSRSparseMatrix.java index c503bdf897f..985d39b6ce5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseTensorToCSRSparseMatrix.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/linalg/sparse/SparseTensorToCSRSparseMatrix.java @@ -43,7 +43,7 @@ public final class SparseTensorToCSRSparseMatrix extends RawOp implements Operan * @return a new instance of SparseTensorToCSRSparseMatrix */ @Endpoint(describeByClass = true) - public static SparseTensorToCSRSparseMatrix create(Scope scope, Operand indices, Operand values, Operand denseShape) { + public static SparseTensorToCSRSparseMatrix create(Scope scope, Operand indices, Operand values, Operand denseShape) { OperationBuilder opBuilder = scope.env().opBuilder("SparseTensorToCSRSparseMatrix", scope.makeOpName("SparseTensorToCSRSparseMatrix")); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java index 9187006ac28..c92611dbc52 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Angle.java @@ -63,7 +63,7 @@ public final class Angle extends RawOp implements Operand * @return a new instance of Angle */ @Endpoint(describeByClass = true) - public static Angle create(Scope scope, Operand input, Class Tout) { + public static Angle create(Scope scope, Operand input, Class Tout) { OperationBuilder opBuilder = scope.env().opBuilder("Angle", scope.makeOpName("Angle")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); @@ -79,7 +79,7 @@ public static Angle create(Scope scope, * @return a new instance of Angle */ @Endpoint(describeByClass = true) - public static Angle create(Scope scope, Operand input) { + public static Angle create(Scope scope, Operand input) { return create(scope, input, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java index 2672a53fc83..051a1645c72 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMax.java @@ -63,7 +63,7 @@ public final class ArgMax extends RawOp implements Operand * @return a new instance of ArgMax */ @Endpoint(describeByClass = true) - public static ArgMax create(Scope scope, Operand input, Operand dimension, Class outputType) { + public static ArgMax create(Scope scope, Operand input, Operand dimension, Class outputType) { OperationBuilder opBuilder = scope.env().opBuilder("ArgMax", scope.makeOpName("ArgMax")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(dimension.asOutput()); @@ -83,7 +83,7 @@ public static ArgMax * @return a new instance of ArgMax */ @Endpoint(describeByClass = true) - public static ArgMax create(Scope scope, Operand input, Operand dimension) { + public static ArgMax create(Scope scope, Operand input, Operand dimension) { return create(scope, input, dimension, TInt64.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java index be484929189..8ff43dd5900 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ArgMin.java @@ -63,7 +63,7 @@ public final class ArgMin extends RawOp implements Operand * @return a new instance of ArgMin */ @Endpoint(describeByClass = true) - public static ArgMin create(Scope scope, Operand input, Operand dimension, Class outputType) { + public static ArgMin create(Scope scope, Operand input, Operand dimension, Class outputType) { OperationBuilder opBuilder = scope.env().opBuilder("ArgMin", scope.makeOpName("ArgMin")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(dimension.asOutput()); @@ -83,7 +83,7 @@ public static ArgMin * @return a new instance of ArgMin */ @Endpoint(describeByClass = true) - public static ArgMin create(Scope scope, Operand input, Operand dimension) { + public static ArgMin create(Scope scope, Operand input, Operand dimension) { return create(scope, input, dimension, TInt64.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java index ce3c3607215..67a698e0365 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/ComplexAbs.java @@ -52,7 +52,7 @@ public final class ComplexAbs extends RawOp implements Operan * @return a new instance of ComplexAbs */ @Endpoint(describeByClass = true) - public static ComplexAbs create(Scope scope, Operand x, Class Tout) { + public static ComplexAbs create(Scope scope, Operand x, Class Tout) { OperationBuilder opBuilder = scope.env().opBuilder("ComplexAbs", scope.makeOpName("ComplexAbs")); opBuilder.addInput(x.asOutput()); opBuilder = scope.apply(opBuilder); @@ -68,7 +68,7 @@ public static ComplexAbs create(Scope sc * @return a new instance of ComplexAbs */ @Endpoint(describeByClass = true) - public static ComplexAbs create(Scope scope, Operand x) { + public static ComplexAbs create(Scope scope, Operand x) { return create(scope, x, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java index 85897f46a8d..96c8285ea92 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumprod.java @@ -100,7 +100,7 @@ private Options() { * @return a new instance of Cumprod */ @Endpoint(describeByClass = true) - public static Cumprod create(Scope scope, Operand x, Operand axis, Options... options) { + public static Cumprod create(Scope scope, Operand x, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Cumprod", scope.makeOpName("Cumprod")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java index 540ed69bfee..72395338fda 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Cumsum.java @@ -100,7 +100,7 @@ private Options() { * @return a new instance of Cumsum */ @Endpoint(describeByClass = true) - public static Cumsum create(Scope scope, Operand x, Operand axis, Options... options) { + public static Cumsum create(Scope scope, Operand x, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Cumsum", scope.makeOpName("Cumsum")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CumulativeLogsumexp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CumulativeLogsumexp.java index 4e53bb981c0..b8d65b857da 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CumulativeLogsumexp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/CumulativeLogsumexp.java @@ -91,7 +91,7 @@ private Options() { * @return a new instance of CumulativeLogsumexp */ @Endpoint(describeByClass = true) - public static CumulativeLogsumexp create(Scope scope, Operand x, Operand axis, Options... options) { + public static CumulativeLogsumexp create(Scope scope, Operand x, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("CumulativeLogsumexp", scope.makeOpName("CumulativeLogsumexp")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java index a983a950dff..74058c43ad1 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Imag.java @@ -59,7 +59,7 @@ public final class Imag extends RawOp implements Operand { * @return a new instance of Imag */ @Endpoint(describeByClass = true) - public static Imag create(Scope scope, Operand input, Class Tout) { + public static Imag create(Scope scope, Operand input, Class Tout) { OperationBuilder opBuilder = scope.env().opBuilder("Imag", scope.makeOpName("Imag")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); @@ -75,7 +75,7 @@ public static Imag create(Scope scope, O * @return a new instance of Imag */ @Endpoint(describeByClass = true) - public static Imag create(Scope scope, Operand input) { + public static Imag create(Scope scope, Operand input) { return create(scope, input, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java index 516f2330b39..6f047b27412 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsFinite.java @@ -53,7 +53,7 @@ public final class IsFinite extends RawOp implements Operand { * @return a new instance of IsFinite */ @Endpoint(describeByClass = true) - public static IsFinite create(Scope scope, Operand x) { + public static IsFinite create(Scope scope, Operand x) { OperationBuilder opBuilder = scope.env().opBuilder("IsFinite", scope.makeOpName("IsFinite")); opBuilder.addInput(x.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java index ac1cf7946cc..a66ef147923 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsInf.java @@ -53,7 +53,7 @@ public final class IsInf extends RawOp implements Operand { * @return a new instance of IsInf */ @Endpoint(describeByClass = true) - public static IsInf create(Scope scope, Operand x) { + public static IsInf create(Scope scope, Operand x) { OperationBuilder opBuilder = scope.env().opBuilder("IsInf", scope.makeOpName("IsInf")); opBuilder.addInput(x.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java index f58f6a4aa38..e7542bad57e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/IsNan.java @@ -53,7 +53,7 @@ public final class IsNan extends RawOp implements Operand { * @return a new instance of IsNan */ @Endpoint(describeByClass = true) - public static IsNan create(Scope scope, Operand x) { + public static IsNan create(Scope scope, Operand x) { OperationBuilder opBuilder = scope.env().opBuilder("IsNan", scope.makeOpName("IsNan")); opBuilder.addInput(x.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java index dd192d28446..6cff5088249 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Mean.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of Mean */ @Endpoint(describeByClass = true) - public static Mean create(Scope scope, Operand input, Operand axis, Options... options) { + public static Mean create(Scope scope, Operand input, Operand axis, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Mean", scope.makeOpName("Mean")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(axis.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java index c3dfd8c23c9..4907717b342 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/PopulationCount.java @@ -49,7 +49,7 @@ public final class PopulationCount extends RawOp implements Operand { * @return a new instance of PopulationCount */ @Endpoint(describeByClass = true) - public static PopulationCount create(Scope scope, Operand x) { + public static PopulationCount create(Scope scope, Operand x) { OperationBuilder opBuilder = scope.env().opBuilder("PopulationCount", scope.makeOpName("PopulationCount")); opBuilder.addInput(x.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java index ad4a7435e16..5ae6dd24dd4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedAdd.java @@ -51,7 +51,7 @@ public final class QuantizedAdd extends RawOp { * @return a new instance of QuantizedAdd */ @Endpoint(describeByClass = true) - public static QuantizedAdd create(Scope scope, Operand x, Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { + public static QuantizedAdd create(Scope scope, Operand x, Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedAdd", scope.makeOpName("QuantizedAdd")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java index cc0a23b4a3c..bc64e12438b 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/QuantizedMul.java @@ -51,7 +51,7 @@ public final class QuantizedMul extends RawOp { * @return a new instance of QuantizedMul */ @Endpoint(describeByClass = true) - public static QuantizedMul create(Scope scope, Operand x, Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { + public static QuantizedMul create(Scope scope, Operand x, Operand y, Operand minX, Operand maxX, Operand minY, Operand maxY, Class Toutput) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMul", scope.makeOpName("QuantizedMul")); opBuilder.addInput(x.asOutput()); opBuilder.addInput(y.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java index eba116d98f2..8758983ba50 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/Real.java @@ -59,7 +59,7 @@ public final class Real extends RawOp implements Operand { * @return a new instance of Real */ @Endpoint(describeByClass = true) - public static Real create(Scope scope, Operand input, Class Tout) { + public static Real create(Scope scope, Operand input, Class Tout) { OperationBuilder opBuilder = scope.env().opBuilder("Real", scope.makeOpName("Real")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); @@ -75,7 +75,7 @@ public static Real create(Scope scope, O * @return a new instance of Real */ @Endpoint(describeByClass = true) - public static Real create(Scope scope, Operand input) { + public static Real create(Scope scope, Operand input) { return create(scope, input, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizationRangePerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizationRangePerChannel.java index 3e771f0cdef..9439a3be134 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizationRangePerChannel.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizationRangePerChannel.java @@ -45,7 +45,7 @@ public final class RequantizationRangePerChannel extends RawOp { * @return a new instance of RequantizationRangePerChannel */ @Endpoint(describeByClass = true) - public static RequantizationRangePerChannel create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Float clipValueMax) { + public static RequantizationRangePerChannel create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Float clipValueMax) { OperationBuilder opBuilder = scope.env().opBuilder("RequantizationRangePerChannel", scope.makeOpName("RequantizationRangePerChannel")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(inputMin.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizePerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizePerChannel.java index d1263d29d2e..a1995a76e20 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizePerChannel.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/RequantizePerChannel.java @@ -49,7 +49,7 @@ public final class RequantizePerChannel extends RawOp { * @return a new instance of RequantizePerChannel */ @Endpoint(describeByClass = true) - public static RequantizePerChannel create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { + public static RequantizePerChannel create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("RequantizePerChannel", scope.makeOpName("RequantizePerChannel")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(inputMin.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java index 8c0d4238d3f..8c5bc8344fa 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMax.java @@ -68,7 +68,7 @@ public final class SegmentMax extends RawOp implements Operan * @return a new instance of SegmentMax */ @Endpoint(describeByClass = true) - public static SegmentMax create(Scope scope, Operand data, Operand segmentIds) { + public static SegmentMax create(Scope scope, Operand data, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SegmentMax", scope.makeOpName("SegmentMax")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java index fd0fd5ca9dd..558a027606a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMean.java @@ -70,7 +70,7 @@ public final class SegmentMean extends RawOp implements Operand * @return a new instance of SegmentMean */ @Endpoint(describeByClass = true) - public static SegmentMean create(Scope scope, Operand data, Operand segmentIds) { + public static SegmentMean create(Scope scope, Operand data, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SegmentMean", scope.makeOpName("SegmentMean")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java index 19ab9059871..5b8b768ac75 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentMin.java @@ -68,7 +68,7 @@ public final class SegmentMin extends RawOp implements Operan * @return a new instance of SegmentMin */ @Endpoint(describeByClass = true) - public static SegmentMin create(Scope scope, Operand data, Operand segmentIds) { + public static SegmentMin create(Scope scope, Operand data, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SegmentMin", scope.makeOpName("SegmentMin")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java index 9fb8e26c721..ff79fb6fa8a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentProd.java @@ -69,7 +69,7 @@ public final class SegmentProd extends RawOp implements Operand * @return a new instance of SegmentProd */ @Endpoint(describeByClass = true) - public static SegmentProd create(Scope scope, Operand data, Operand segmentIds) { + public static SegmentProd create(Scope scope, Operand data, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SegmentProd", scope.makeOpName("SegmentProd")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java index 708d4e7d000..e86b3a55469 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/SegmentSum.java @@ -69,7 +69,7 @@ public final class SegmentSum extends RawOp implements Operand< * @return a new instance of SegmentSum */ @Endpoint(describeByClass = true) - public static SegmentSum create(Scope scope, Operand data, Operand segmentIds) { + public static SegmentSum create(Scope scope, Operand data, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SegmentSum", scope.makeOpName("SegmentSum")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java index efaaf2dea96..cdfc300c790 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMax.java @@ -76,7 +76,7 @@ public final class UnsortedSegmentMax extends RawOp implement * @return a new instance of UnsortedSegmentMax */ @Endpoint(describeByClass = true) - public static UnsortedSegmentMax create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + public static UnsortedSegmentMax create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentMax", scope.makeOpName("UnsortedSegmentMax")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java index e73ec14aa1b..080e45d9608 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentMin.java @@ -70,7 +70,7 @@ public final class UnsortedSegmentMin extends RawOp implement * @return a new instance of UnsortedSegmentMin */ @Endpoint(describeByClass = true) - public static UnsortedSegmentMin create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + public static UnsortedSegmentMin create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentMin", scope.makeOpName("UnsortedSegmentMin")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java index 8dfa3b48922..992f1863978 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentProd.java @@ -70,7 +70,7 @@ public final class UnsortedSegmentProd extends RawOp implements * @return a new instance of UnsortedSegmentProd */ @Endpoint(describeByClass = true) - public static UnsortedSegmentProd create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + public static UnsortedSegmentProd create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentProd", scope.makeOpName("UnsortedSegmentProd")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java index 06441ef1d6d..a5fbc0acbe2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/math/UnsortedSegmentSum.java @@ -73,7 +73,7 @@ public final class UnsortedSegmentSum extends RawOp implements * @return a new instance of UnsortedSegmentSum */ @Endpoint(describeByClass = true) - public static UnsortedSegmentSum create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { + public static UnsortedSegmentSum create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentSum", scope.makeOpName("UnsortedSegmentSum")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java index 0d6c1792495..eb4a0460a65 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/Conv3dBackpropInput.java @@ -90,7 +90,7 @@ private Options() { * @return a new instance of Conv3dBackpropInput */ @Endpoint(describeByClass = true) - public static Conv3dBackpropInput create(Scope scope, Operand inputSizes, Operand filter, Operand outBackprop, List strides, String padding, Options... options) { + public static Conv3dBackpropInput create(Scope scope, Operand inputSizes, Operand filter, Operand outBackprop, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Conv3DBackpropInputV2", scope.makeOpName("Conv3dBackpropInput")); opBuilder.addInput(inputSizes.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java index 5b4af53845d..9c01c23db6d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradGradWithArgmax.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of MaxPoolGradGradWithArgmax */ @Endpoint(describeByClass = true) - public static MaxPoolGradGradWithArgmax create(Scope scope, Operand input, Operand grad, Operand argmax, List ksize, List strides, String padding, Options... options) { + public static MaxPoolGradGradWithArgmax create(Scope scope, Operand input, Operand grad, Operand argmax, List ksize, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolGradGradWithArgmax", scope.makeOpName("MaxPoolGradGradWithArgmax")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(grad.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java index ef9af71cb95..c07cb6f16a5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/MaxPoolGradWithArgmax.java @@ -70,7 +70,7 @@ private Options() { * @return a new instance of MaxPoolGradWithArgmax */ @Endpoint(describeByClass = true) - public static MaxPoolGradWithArgmax create(Scope scope, Operand input, Operand grad, Operand argmax, List ksize, List strides, String padding, Options... options) { + public static MaxPoolGradWithArgmax create(Scope scope, Operand input, Operand grad, Operand argmax, List ksize, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("MaxPoolGradWithArgmax", scope.makeOpName("MaxPoolGradWithArgmax")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(grad.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java index 05e2ec67aa5..b0aeac360c4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedBiasAdd.java @@ -53,7 +53,7 @@ public final class QuantizedBiasAdd extends RawOp { * @return a new instance of QuantizedBiasAdd */ @Endpoint(describeByClass = true) - public static QuantizedBiasAdd create(Scope scope, Operand input, Operand bias, Operand minInput, Operand maxInput, Operand minBias, Operand maxBias, Class outType) { + public static QuantizedBiasAdd create(Scope scope, Operand input, Operand bias, Operand minInput, Operand maxInput, Operand minBias, Operand maxBias, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedBiasAdd", scope.makeOpName("QuantizedBiasAdd")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(bias.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRelu.java index 89aee4bd5f5..fecb450e7da 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRelu.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRelu.java @@ -80,7 +80,7 @@ private Options() { * @return a new instance of QuantizedConv2DAndRelu */ @Endpoint(describeByClass = true) - public static QuantizedConv2DAndRelu create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DAndRelu create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DAndRelu", scope.makeOpName("QuantizedConv2DAndRelu")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndReluAndRequantize.java index 513a9b240e5..b1408decd0f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndReluAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndReluAndRequantize.java @@ -82,7 +82,7 @@ private Options() { * @return a new instance of QuantizedConv2DAndReluAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedConv2DAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DAndReluAndRequantize", scope.makeOpName("QuantizedConv2DAndReluAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRequantize.java index 80a1ddf146a..5ed39bd2375 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DAndRequantize.java @@ -82,7 +82,7 @@ private Options() { * @return a new instance of QuantizedConv2DAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedConv2DAndRequantize create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DAndRequantize create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DAndRequantize", scope.makeOpName("QuantizedConv2DAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DPerChannel.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DPerChannel.java index f51143d15be..d8f5b063d73 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DPerChannel.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DPerChannel.java @@ -73,7 +73,7 @@ private Options() { * @return a new instance of QuantizedConv2DPerChannel */ @Endpoint(describeByClass = true) - public static QuantizedConv2DPerChannel create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DPerChannel create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DPerChannel", scope.makeOpName("QuantizedConv2DPerChannel")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBias.java index c579e306102..4effcf06f22 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBias.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBias.java @@ -81,7 +81,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBias */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBias create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBias create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBias", scope.makeOpName("QuantizedConv2DWithBias")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRelu.java index ac9672e9f94..39764e1f273 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRelu.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRelu.java @@ -81,7 +81,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBiasAndRelu */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBiasAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBiasAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasAndRelu", scope.makeOpName("QuantizedConv2DWithBiasAndRelu")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndReluAndRequantize.java index 084f211be2c..de31b007153 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndReluAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndReluAndRequantize.java @@ -83,7 +83,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBiasAndReluAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBiasAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBiasAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasAndReluAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasAndReluAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRequantize.java index 9a31f82454b..59d1f4cbfaf 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasAndRequantize.java @@ -83,7 +83,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBiasAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBiasAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBiasAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java index 5d005ac1f9e..e9a27a0679f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSignedSumAndReluAndRequantize.java @@ -86,7 +86,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBiasSignedSumAndReluAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBiasSignedSumAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Operand summand, Operand minSummand, Operand maxSummand, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBiasSignedSumAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Operand summand, Operand minSummand, Operand maxSummand, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasSignedSumAndReluAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasSignedSumAndReluAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndRelu.java index dffeac89c25..7bcd90b13fd 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndRelu.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndRelu.java @@ -82,7 +82,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBiasSumAndRelu */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBiasSumAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand summand, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBiasSumAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand summand, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasSumAndRelu", scope.makeOpName("QuantizedConv2DWithBiasSumAndRelu")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndReluAndRequantize.java index 68052783adb..5a6d223be7c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndReluAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2DWithBiasSumAndReluAndRequantize.java @@ -86,7 +86,7 @@ private Options() { * @return a new instance of QuantizedConv2DWithBiasSumAndReluAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedConv2DWithBiasSumAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Operand summand, Operand minSummand, Operand maxSummand, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2DWithBiasSumAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Operand summand, Operand minSummand, Operand maxSummand, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2DWithBiasSumAndReluAndRequantize", scope.makeOpName("QuantizedConv2DWithBiasSumAndReluAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java index 6e6788db7aa..58a1a2a36e6 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedConv2d.java @@ -84,7 +84,7 @@ private Options() { * @return a new instance of QuantizedConv2d */ @Endpoint(describeByClass = true) - public static QuantizedConv2d create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedConv2d create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedConv2D", scope.makeOpName("QuantizedConv2d")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2D.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2D.java index 7dae76d87bc..17695f4fb77 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2D.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2D.java @@ -73,7 +73,7 @@ private Options() { * @return a new instance of QuantizedDepthwiseConv2D */ @Endpoint(describeByClass = true) - public static QuantizedDepthwiseConv2D create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedDepthwiseConv2D create(Scope scope, Operand input, Operand filter, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2D", scope.makeOpName("QuantizedDepthwiseConv2D")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBias.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBias.java index fc7f07525af..7f37dff79d1 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBias.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBias.java @@ -74,7 +74,7 @@ private Options() { * @return a new instance of QuantizedDepthwiseConv2DWithBias */ @Endpoint(describeByClass = true) - public static QuantizedDepthwiseConv2DWithBias create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedDepthwiseConv2DWithBias create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2DWithBias", scope.makeOpName("QuantizedDepthwiseConv2DWithBias")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndRelu.java index c16b3c91a0e..46c8ded50f0 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndRelu.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndRelu.java @@ -83,7 +83,7 @@ private Options() { * @return a new instance of QuantizedDepthwiseConv2DWithBiasAndRelu */ @Endpoint(describeByClass = true) - public static QuantizedDepthwiseConv2DWithBiasAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { + public static QuantizedDepthwiseConv2DWithBiasAndRelu create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2DWithBiasAndRelu", scope.makeOpName("QuantizedDepthwiseConv2DWithBiasAndRelu")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java index 02dccc28354..ee9b29129bc 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize.java @@ -85,7 +85,7 @@ private Options() { * @return a new instance of QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { + public static QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize create(Scope scope, Operand input, Operand filter, Operand bias, Operand minInput, Operand maxInput, Operand minFilter, Operand maxFilter, Operand minFreezedOutput, Operand maxFreezedOutput, Class outType, List strides, String padding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize", scope.makeOpName("QuantizedDepthwiseConv2DWithBiasAndReluAndRequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(filter.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java index 56b755f2a71..578b994a3d4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu.java @@ -48,7 +48,7 @@ public final class QuantizedRelu extends RawOp { * @return a new instance of QuantizedRelu */ @Endpoint(describeByClass = true) - public static QuantizedRelu create(Scope scope, Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { + public static QuantizedRelu create(Scope scope, Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedRelu", scope.makeOpName("QuantizedRelu")); opBuilder.addInput(features.asOutput()); opBuilder.addInput(minFeatures.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java index 2f99d1ab861..4ee22f51238 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedRelu6.java @@ -48,7 +48,7 @@ public final class QuantizedRelu6 extends RawOp { * @return a new instance of QuantizedRelu6 */ @Endpoint(describeByClass = true) - public static QuantizedRelu6 create(Scope scope, Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { + public static QuantizedRelu6 create(Scope scope, Operand features, Operand minFeatures, Operand maxFeatures, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedRelu6", scope.makeOpName("QuantizedRelu6")); opBuilder.addInput(features.asOutput()); opBuilder.addInput(minFeatures.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java index afd943b7595..cf9bdc3134e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/QuantizedReluX.java @@ -49,7 +49,7 @@ public final class QuantizedReluX extends RawOp { * @return a new instance of QuantizedReluX */ @Endpoint(describeByClass = true) - public static QuantizedReluX create(Scope scope, Operand features, Operand maxValue, Operand minFeatures, Operand maxFeatures, Class outType) { + public static QuantizedReluX create(Scope scope, Operand features, Operand maxValue, Operand minFeatures, Operand maxFeatures, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedReluX", scope.makeOpName("QuantizedReluX")); opBuilder.addInput(features.asOutput()); opBuilder.addInput(maxValue.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java index edc741c19ac..90afda30fe4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/SpaceToBatch.java @@ -122,7 +122,7 @@ public final class SpaceToBatch extends RawOp implements Operan * @return a new instance of SpaceToBatch */ @Endpoint(describeByClass = true) - public static SpaceToBatch create(Scope scope, Operand input, Operand paddings, Long blockSize) { + public static SpaceToBatch create(Scope scope, Operand input, Operand paddings, Long blockSize) { OperationBuilder opBuilder = scope.env().opBuilder("SpaceToBatch", scope.makeOpName("SpaceToBatch")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(paddings.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/raw/SparseSoftmaxCrossEntropyWithLogits.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/raw/SparseSoftmaxCrossEntropyWithLogits.java index 6cbd4fddeb1..67650760b1c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/raw/SparseSoftmaxCrossEntropyWithLogits.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/nn/raw/SparseSoftmaxCrossEntropyWithLogits.java @@ -52,7 +52,7 @@ public final class SparseSoftmaxCrossEntropyWithLogits extend * @return a new instance of SparseSoftmaxCrossEntropyWithLogits */ @Endpoint(describeByClass = true) - public static SparseSoftmaxCrossEntropyWithLogits create(Scope scope, Operand features, Operand labels) { + public static SparseSoftmaxCrossEntropyWithLogits create(Scope scope, Operand features, Operand labels) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSoftmaxCrossEntropyWithLogits", scope.makeOpName("SparseSoftmaxCrossEntropyWithLogits")); opBuilder.addInput(features.asOutput()); opBuilder.addInput(labels.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java index 19c738bc721..ff6b734970b 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Dequantize.java @@ -137,7 +137,7 @@ private Options() { * @return a new instance of Dequantize */ @Endpoint(describeByClass = true) - public static Dequantize create(Scope scope, Operand input, Operand minRange, Operand maxRange, Class dtype, Options... options) { + public static Dequantize create(Scope scope, Operand input, Operand minRange, Operand maxRange, Class dtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Dequantize", scope.makeOpName("Dequantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(minRange.asOutput()); @@ -171,7 +171,7 @@ public static Dequantize create(Scope sc * @return a new instance of Dequantize */ @Endpoint(describeByClass = true) - public static Dequantize create(Scope scope, Operand input, Operand minRange, Operand maxRange, Options... options) { + public static Dequantize create(Scope scope, Operand input, Operand minRange, Operand maxRange, Options... options) { return create(scope, input, minRange, maxRange, TFloat32.class, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java index 5430dbc69ca..73f23d05195 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizeDownAndShrinkRange.java @@ -71,7 +71,7 @@ public final class QuantizeDownAndShrinkRange extends RawOp { * @return a new instance of QuantizeDownAndShrinkRange */ @Endpoint(describeByClass = true) - public static QuantizeDownAndShrinkRange create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Class outType) { + public static QuantizeDownAndShrinkRange create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizeDownAndShrinkRange", scope.makeOpName("QuantizeDownAndShrinkRange")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(inputMin.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndDequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndDequantize.java index e925c15546b..d603f188f71 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndDequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndDequantize.java @@ -90,7 +90,7 @@ private Options() { * @return a new instance of QuantizedMatMulWithBiasAndDequantize */ @Endpoint(describeByClass = true) - public static QuantizedMatMulWithBiasAndDequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { + public static QuantizedMatMulWithBiasAndDequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBiasAndDequantize", scope.makeOpName("QuantizedMatMulWithBiasAndDequantize")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndRequantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndRequantize.java index d971f1a41cf..a4326a3618a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndRequantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/QuantizedMatMulWithBiasAndRequantize.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of QuantizedMatMulWithBiasAndRequantize */ @Endpoint(describeByClass = true) - public static QuantizedMatMulWithBiasAndRequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { + public static QuantizedMatMulWithBiasAndRequantize create(Scope scope, Operand a, Operand b, Operand bias, Operand minA, Operand maxA, Operand minB, Operand maxB, Operand minFreezedOutput, Operand maxFreezedOutput, Class Toutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("QuantizedMatMulWithBiasAndRequantize", scope.makeOpName("QuantizedMatMulWithBiasAndRequantize")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java index 52af93f6383..a38b54f2916 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/RequantizationRange.java @@ -49,7 +49,7 @@ public final class RequantizationRange extends RawOp { * @return a new instance of RequantizationRange */ @Endpoint(describeByClass = true) - public static RequantizationRange create(Scope scope, Operand input, Operand inputMin, Operand inputMax) { + public static RequantizationRange create(Scope scope, Operand input, Operand inputMin, Operand inputMax) { OperationBuilder opBuilder = scope.env().opBuilder("RequantizationRange", scope.makeOpName("RequantizationRange")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(inputMin.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java index cec1e8823e4..6a18daf69ca 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/quantization/Requantize.java @@ -58,7 +58,7 @@ public final class Requantize extends RawOp { * @return a new instance of Requantize */ @Endpoint(describeByClass = true) - public static Requantize create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { + public static Requantize create(Scope scope, Operand input, Operand inputMin, Operand inputMax, Operand requestedOutputMin, Operand requestedOutputMax, Class outType) { OperationBuilder opBuilder = scope.env().opBuilder("Requantize", scope.makeOpName("Requantize")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(inputMin.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedCountSparseOutput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedCountSparseOutput.java index 857d412129f..f9701def261 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedCountSparseOutput.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedCountSparseOutput.java @@ -78,7 +78,7 @@ private Options() { * @return a new instance of RaggedCountSparseOutput */ @Endpoint(describeByClass = true) - public static RaggedCountSparseOutput create(Scope scope, Operand splits, Operand values, Operand weights, Boolean binaryOutput, Options... options) { + public static RaggedCountSparseOutput create(Scope scope, Operand splits, Operand values, Operand weights, Boolean binaryOutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("RaggedCountSparseOutput", scope.makeOpName("RaggedCountSparseOutput")); opBuilder.addInput(splits.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedGather.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedGather.java index bd027000139..8cfbba1894d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedGather.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedGather.java @@ -84,7 +84,7 @@ public final class RaggedGather extends RawO * @return a new instance of RaggedGather */ @Endpoint(describeByClass = true) - public static RaggedGather create(Scope scope, Iterable> paramsNestedSplits, Operand paramsDenseValues, Operand indices, Long OUTPUTRAGGEDRANK) { + public static RaggedGather create(Scope scope, Iterable> paramsNestedSplits, Operand paramsDenseValues, Operand indices, Long OUTPUTRAGGEDRANK) { OperationBuilder opBuilder = scope.env().opBuilder("RaggedGather", scope.makeOpName("RaggedGather")); opBuilder.addInputList(Operands.asOutputs(paramsNestedSplits)); opBuilder.addInput(paramsDenseValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToTensor.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToTensor.java index 6849b77593f..5fdddc476b7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToTensor.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToTensor.java @@ -106,7 +106,7 @@ public final class RaggedTensorToTensor extends RawOp implement * @return a new instance of RaggedTensorToTensor */ @Endpoint(describeByClass = true) - public static RaggedTensorToTensor create(Scope scope, Operand shape, Operand values, Operand defaultValue, Iterable> rowPartitionTensors, List rowPartitionTypes) { + public static RaggedTensorToTensor create(Scope scope, Operand shape, Operand values, Operand defaultValue, Iterable> rowPartitionTensors, List rowPartitionTypes) { OperationBuilder opBuilder = scope.env().opBuilder("RaggedTensorToTensor", scope.makeOpName("RaggedTensorToTensor")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToVariant.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToVariant.java index d2f890dbefb..fa4799f3513 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToVariant.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/ragged/RaggedTensorToVariant.java @@ -58,7 +58,7 @@ public final class RaggedTensorToVariant extends RawOp implements Operand * @return a new instance of RaggedTensorToVariant */ @Endpoint(describeByClass = true) - public static RaggedTensorToVariant create(Scope scope, Iterable> rtNestedSplits, Operand rtDenseValues, Boolean batchedInput) { + public static RaggedTensorToVariant create(Scope scope, Iterable> rtNestedSplits, Operand rtDenseValues, Boolean batchedInput) { OperationBuilder opBuilder = scope.env().opBuilder("RaggedTensorToVariant", scope.makeOpName("RaggedTensorToVariant")); opBuilder.addInputList(Operands.asOutputs(rtNestedSplits)); opBuilder.addInput(rtDenseValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java index 5dc566feb29..2122358b803 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/Multinomial.java @@ -79,7 +79,7 @@ private Options() { * @return a new instance of Multinomial */ @Endpoint(describeByClass = true) - public static Multinomial create(Scope scope, Operand logits, Operand numSamples, Class outputDtype, Options... options) { + public static Multinomial create(Scope scope, Operand logits, Operand numSamples, Class outputDtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Multinomial", scope.makeOpName("Multinomial")); opBuilder.addInput(logits.asOutput()); opBuilder.addInput(numSamples.asOutput()); @@ -109,7 +109,7 @@ public static Multinomial create(Scope * @return a new instance of Multinomial */ @Endpoint(describeByClass = true) - public static Multinomial create(Scope scope, Operand logits, Operand numSamples, Options... options) { + public static Multinomial create(Scope scope, Operand logits, Operand numSamples, Options... options) { return create(scope, logits, numSamples, TInt64.class, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/NonDeterministicInts.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/NonDeterministicInts.java index 2f9aad878b3..ea189d9d7aa 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/NonDeterministicInts.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/NonDeterministicInts.java @@ -47,7 +47,7 @@ public final class NonDeterministicInts extends RawOp implement * @return a new instance of NonDeterministicInts */ @Endpoint(describeByClass = true) - public static NonDeterministicInts create(Scope scope, Operand shape, Class dtype) { + public static NonDeterministicInts create(Scope scope, Operand shape, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("NonDeterministicInts", scope.makeOpName("NonDeterministicInts")); opBuilder.addInput(shape.asOutput()); opBuilder = scope.apply(opBuilder); @@ -63,7 +63,7 @@ public static NonDeterministicInts create( * @return a new instance of NonDeterministicInts */ @Endpoint(describeByClass = true) - public static NonDeterministicInts create(Scope scope, Operand shape) { + public static NonDeterministicInts create(Scope scope, Operand shape) { return create(scope, shape, TInt64.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java index f4300ebaa75..1daadb4a445 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/ParameterizedTruncatedNormal.java @@ -82,7 +82,7 @@ private Options() { * @return a new instance of ParameterizedTruncatedNormal */ @Endpoint(describeByClass = true) - public static ParameterizedTruncatedNormal create(Scope scope, Operand shape, Operand means, Operand stdevs, Operand minvals, Operand maxvals, Options... options) { + public static ParameterizedTruncatedNormal create(Scope scope, Operand shape, Operand means, Operand stdevs, Operand minvals, Operand maxvals, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ParameterizedTruncatedNormal", scope.makeOpName("ParameterizedTruncatedNormal")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(means.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java index ddf132eacb8..7457dd6b1c8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomGamma.java @@ -81,7 +81,7 @@ private Options() { * @return a new instance of RandomGamma */ @Endpoint(describeByClass = true) - public static RandomGamma create(Scope scope, Operand shape, Operand alpha, Options... options) { + public static RandomGamma create(Scope scope, Operand shape, Operand alpha, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("RandomGamma", scope.makeOpName("RandomGamma")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(alpha.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java index 8b3c70059e0..6d9632c1b73 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomPoisson.java @@ -90,7 +90,7 @@ private Options() { * @return a new instance of RandomPoisson */ @Endpoint(describeByClass = true) - public static RandomPoisson create(Scope scope, Operand shape, Operand rate, Class dtype, Options... options) { + public static RandomPoisson create(Scope scope, Operand shape, Operand rate, Class dtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("RandomPoissonV2", scope.makeOpName("RandomPoisson")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(rate.asOutput()); @@ -121,7 +121,7 @@ public static RandomPo * @return a new instance of RandomPoisson */ @Endpoint(describeByClass = true) - public static RandomPoisson create(Scope scope, Operand shape, Operand rate, Options... options) { + public static RandomPoisson create(Scope scope, Operand shape, Operand rate, Options... options) { return create(scope, shape, rate, TInt64.class, options); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java index c699ec4509c..5590f39e462 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomStandardNormal.java @@ -78,7 +78,7 @@ private Options() { * @return a new instance of RandomStandardNormal */ @Endpoint(describeByClass = true) - public static RandomStandardNormal create(Scope scope, Operand shape, Class dtype, Options... options) { + public static RandomStandardNormal create(Scope scope, Operand shape, Class dtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("RandomStandardNormal", scope.makeOpName("RandomStandardNormal")); opBuilder.addInput(shape.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java index d3bbe991d60..ee3d57fe528 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniform.java @@ -79,7 +79,7 @@ private Options() { * @return a new instance of RandomUniform */ @Endpoint(describeByClass = true) - public static RandomUniform create(Scope scope, Operand shape, Class dtype, Options... options) { + public static RandomUniform create(Scope scope, Operand shape, Class dtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("RandomUniform", scope.makeOpName("RandomUniform")); opBuilder.addInput(shape.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java index f6ab24df811..fa63412d74a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/RandomUniformInt.java @@ -84,7 +84,7 @@ private Options() { * @return a new instance of RandomUniformInt */ @Endpoint(describeByClass = true) - public static RandomUniformInt create(Scope scope, Operand shape, Operand minval, Operand maxval, Options... options) { + public static RandomUniformInt create(Scope scope, Operand shape, Operand minval, Operand maxval, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("RandomUniformInt", scope.makeOpName("RandomUniformInt")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(minval.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulRandomBinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulRandomBinomial.java index 67264028253..f0ca988f977 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulRandomBinomial.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulRandomBinomial.java @@ -48,7 +48,7 @@ public final class StatefulRandomBinomial extends RawOp imple * @return a new instance of StatefulRandomBinomial */ @Endpoint(describeByClass = true) - public static StatefulRandomBinomial create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand counts, Operand probs, Class dtype) { + public static StatefulRandomBinomial create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand counts, Operand probs, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatefulRandomBinomial", scope.makeOpName("StatefulRandomBinomial")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(algorithm.asOutput()); @@ -72,7 +72,7 @@ public static Stateful * @return a new instance of StatefulRandomBinomial */ @Endpoint(describeByClass = true) - public static StatefulRandomBinomial create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand counts, Operand probs) { + public static StatefulRandomBinomial create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand counts, Operand probs) { return create(scope, resource, algorithm, shape, counts, probs, TInt64.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulStandardNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulStandardNormal.java index 340703444ef..f2bac599e30 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulStandardNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulStandardNormal.java @@ -51,7 +51,7 @@ public final class StatefulStandardNormal extends RawOp impleme * @return a new instance of StatefulStandardNormal */ @Endpoint(describeByClass = true) - public static StatefulStandardNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + public static StatefulStandardNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatefulStandardNormalV2", scope.makeOpName("StatefulStandardNormal")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(algorithm.asOutput()); @@ -71,7 +71,7 @@ public static StatefulStandardNormal creat * @return a new instance of StatefulStandardNormal */ @Endpoint(describeByClass = true) - public static StatefulStandardNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape) { + public static StatefulStandardNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape) { return create(scope, resource, algorithm, shape, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulTruncatedNormal.java index 850473f7662..8674dbfd845 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulTruncatedNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulTruncatedNormal.java @@ -52,7 +52,7 @@ public final class StatefulTruncatedNormal extends RawOp implem * @return a new instance of StatefulTruncatedNormal */ @Endpoint(describeByClass = true) - public static StatefulTruncatedNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + public static StatefulTruncatedNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatefulTruncatedNormal", scope.makeOpName("StatefulTruncatedNormal")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(algorithm.asOutput()); @@ -72,7 +72,7 @@ public static StatefulTruncatedNormal crea * @return a new instance of StatefulTruncatedNormal */ @Endpoint(describeByClass = true) - public static StatefulTruncatedNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape) { + public static StatefulTruncatedNormal create(Scope scope, Operand resource, Operand algorithm, Operand shape) { return create(scope, resource, algorithm, shape, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniform.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniform.java index b33ced6beec..b7e5f2b461d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniform.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniform.java @@ -51,7 +51,7 @@ public final class StatefulUniform extends RawOp implements Ope * @return a new instance of StatefulUniform */ @Endpoint(describeByClass = true) - public static StatefulUniform create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + public static StatefulUniform create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatefulUniform", scope.makeOpName("StatefulUniform")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(algorithm.asOutput()); @@ -71,7 +71,7 @@ public static StatefulUniform create(Scope * @return a new instance of StatefulUniform */ @Endpoint(describeByClass = true) - public static StatefulUniform create(Scope scope, Operand resource, Operand algorithm, Operand shape) { + public static StatefulUniform create(Scope scope, Operand resource, Operand algorithm, Operand shape) { return create(scope, resource, algorithm, shape, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformFullInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformFullInt.java index 6a06923808a..00cd668c7e5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformFullInt.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformFullInt.java @@ -49,7 +49,7 @@ public final class StatefulUniformFullInt extends RawOp impleme * @return a new instance of StatefulUniformFullInt */ @Endpoint(describeByClass = true) - public static StatefulUniformFullInt create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { + public static StatefulUniformFullInt create(Scope scope, Operand resource, Operand algorithm, Operand shape, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatefulUniformFullInt", scope.makeOpName("StatefulUniformFullInt")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(algorithm.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformInt.java index b8212de6e03..880b414d875 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformInt.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatefulUniformInt.java @@ -55,7 +55,7 @@ public final class StatefulUniformInt extends RawOp implements * @return a new instance of StatefulUniformInt */ @Endpoint(describeByClass = true) - public static StatefulUniformInt create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand minval, Operand maxval) { + public static StatefulUniformInt create(Scope scope, Operand resource, Operand algorithm, Operand shape, Operand minval, Operand maxval) { OperationBuilder opBuilder = scope.env().opBuilder("StatefulUniformInt", scope.makeOpName("StatefulUniformInt")); opBuilder.addInput(resource.asOutput()); opBuilder.addInput(algorithm.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java index 93f7a9254de..aa8a31e7f38 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessMultinomial.java @@ -50,7 +50,7 @@ public final class StatelessMultinomial extends RawOp impleme * @return a new instance of StatelessMultinomial */ @Endpoint(describeByClass = true) - public static StatelessMultinomial create(Scope scope, Operand logits, Operand numSamples, Operand seed, Class outputDtype) { + public static StatelessMultinomial create(Scope scope, Operand logits, Operand numSamples, Operand seed, Class outputDtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessMultinomial", scope.makeOpName("StatelessMultinomial")); opBuilder.addInput(logits.asOutput()); opBuilder.addInput(numSamples.asOutput()); @@ -71,7 +71,7 @@ public static Stateles * @return a new instance of StatelessMultinomial */ @Endpoint(describeByClass = true) - public static StatelessMultinomial create(Scope scope, Operand logits, Operand numSamples, Operand seed) { + public static StatelessMultinomial create(Scope scope, Operand logits, Operand numSamples, Operand seed) { return create(scope, logits, numSamples, seed, TInt64.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessParameterizedTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessParameterizedTruncatedNormal.java index f6d5deadabf..8c740f16994 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessParameterizedTruncatedNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessParameterizedTruncatedNormal.java @@ -46,7 +46,7 @@ public final class StatelessParameterizedTruncatedNormal exte * @return a new instance of StatelessParameterizedTruncatedNormal */ @Endpoint(describeByClass = true) - public static StatelessParameterizedTruncatedNormal create(Scope scope, Operand shape, Operand seed, Operand means, Operand stddevs, Operand minvals, Operand maxvals) { + public static StatelessParameterizedTruncatedNormal create(Scope scope, Operand shape, Operand seed, Operand means, Operand stddevs, Operand minvals, Operand maxvals) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessParameterizedTruncatedNormal", scope.makeOpName("StatelessParameterizedTruncatedNormal")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomBinomial.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomBinomial.java index 6da606468d1..0b1e081e551 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomBinomial.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomBinomial.java @@ -54,7 +54,7 @@ public final class StatelessRandomBinomial extends RawOp impl * @return a new instance of StatelessRandomBinomial */ @Endpoint(describeByClass = true) - public static StatelessRandomBinomial create(Scope scope, Operand shape, Operand seed, Operand counts, Operand probs, Class dtype) { + public static StatelessRandomBinomial create(Scope scope, Operand shape, Operand seed, Operand counts, Operand probs, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomBinomial", scope.makeOpName("StatelessRandomBinomial")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); @@ -78,7 +78,7 @@ public static StatelessRandomBinomial create(Scope scope, Operand shape, Operand seed, Operand counts, Operand probs) { + public static StatelessRandomBinomial create(Scope scope, Operand shape, Operand seed, Operand counts, Operand probs) { return create(scope, shape, seed, counts, probs, TInt64.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomGamma.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomGamma.java index 2b4ca37dee9..3665612e654 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomGamma.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomGamma.java @@ -49,7 +49,7 @@ public final class StatelessRandomGamma extends RawOp impleme * @return a new instance of StatelessRandomGamma */ @Endpoint(describeByClass = true) - public static StatelessRandomGamma create(Scope scope, Operand shape, Operand seed, Operand alpha) { + public static StatelessRandomGamma create(Scope scope, Operand shape, Operand seed, Operand alpha) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomGammaV2", scope.makeOpName("StatelessRandomGamma")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java index 6438b29ec4c..21587fa0ff0 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomNormal.java @@ -51,7 +51,7 @@ public final class StatelessRandomNormal extends RawOp implem * @return a new instance of StatelessRandomNormal */ @Endpoint(describeByClass = true) - public static StatelessRandomNormal create(Scope scope, Operand shape, Operand seed, Class dtype) { + public static StatelessRandomNormal create(Scope scope, Operand shape, Operand seed, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomNormal", scope.makeOpName("StatelessRandomNormal")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); @@ -69,7 +69,7 @@ public static Stateles * @return a new instance of StatelessRandomNormal */ @Endpoint(describeByClass = true) - public static StatelessRandomNormal create(Scope scope, Operand shape, Operand seed) { + public static StatelessRandomNormal create(Scope scope, Operand shape, Operand seed) { return create(scope, shape, seed, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomPoisson.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomPoisson.java index c44af6a5e72..2c0f4b988bc 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomPoisson.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomPoisson.java @@ -51,7 +51,7 @@ public final class StatelessRandomPoisson extends RawOp imple * @return a new instance of StatelessRandomPoisson */ @Endpoint(describeByClass = true) - public static StatelessRandomPoisson create(Scope scope, Operand shape, Operand seed, Operand lam, Class dtype) { + public static StatelessRandomPoisson create(Scope scope, Operand shape, Operand seed, Operand lam, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomPoisson", scope.makeOpName("StatelessRandomPoisson")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java index 814b89ba69c..06a468bb84f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniform.java @@ -52,7 +52,7 @@ public final class StatelessRandomUniform extends RawOp imple * @return a new instance of StatelessRandomUniform */ @Endpoint(describeByClass = true) - public static StatelessRandomUniform create(Scope scope, Operand shape, Operand seed, Class dtype) { + public static StatelessRandomUniform create(Scope scope, Operand shape, Operand seed, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomUniform", scope.makeOpName("StatelessRandomUniform")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); @@ -70,7 +70,7 @@ public static Stateles * @return a new instance of StatelessRandomUniform */ @Endpoint(describeByClass = true) - public static StatelessRandomUniform create(Scope scope, Operand shape, Operand seed) { + public static StatelessRandomUniform create(Scope scope, Operand shape, Operand seed) { return create(scope, shape, seed, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformFullInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformFullInt.java index d90112620a5..87c2d18b556 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformFullInt.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformFullInt.java @@ -49,7 +49,7 @@ public final class StatelessRandomUniformFullInt extends RawO * @return a new instance of StatelessRandomUniformFullInt */ @Endpoint(describeByClass = true) - public static StatelessRandomUniformFullInt create(Scope scope, Operand shape, Operand seed, Class dtype) { + public static StatelessRandomUniformFullInt create(Scope scope, Operand shape, Operand seed, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomUniformFullInt", scope.makeOpName("StatelessRandomUniformFullInt")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java index fb88cc4f69d..37b882c8c39 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessRandomUniformInt.java @@ -49,7 +49,7 @@ public final class StatelessRandomUniformInt extends RawOp im * @return a new instance of StatelessRandomUniformInt */ @Endpoint(describeByClass = true) - public static StatelessRandomUniformInt create(Scope scope, Operand shape, Operand seed, Operand minval, Operand maxval) { + public static StatelessRandomUniformInt create(Scope scope, Operand shape, Operand seed, Operand minval, Operand maxval) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessRandomUniformInt", scope.makeOpName("StatelessRandomUniformInt")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java index e38cd931564..6550b77b3a9 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/StatelessTruncatedNormal.java @@ -53,7 +53,7 @@ public final class StatelessTruncatedNormal extends RawOp imp * @return a new instance of StatelessTruncatedNormal */ @Endpoint(describeByClass = true) - public static StatelessTruncatedNormal create(Scope scope, Operand shape, Operand seed, Class dtype) { + public static StatelessTruncatedNormal create(Scope scope, Operand shape, Operand seed, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("StatelessTruncatedNormal", scope.makeOpName("StatelessTruncatedNormal")); opBuilder.addInput(shape.asOutput()); opBuilder.addInput(seed.asOutput()); @@ -71,7 +71,7 @@ public static Stateles * @return a new instance of StatelessTruncatedNormal */ @Endpoint(describeByClass = true) - public static StatelessTruncatedNormal create(Scope scope, Operand shape, Operand seed) { + public static StatelessTruncatedNormal create(Scope scope, Operand shape, Operand seed) { return create(scope, shape, seed, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java index ff111c2e8d1..aa2be6ce8ea 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/random/TruncatedNormal.java @@ -80,7 +80,7 @@ private Options() { * @return a new instance of TruncatedNormal */ @Endpoint(describeByClass = true) - public static TruncatedNormal create(Scope scope, Operand shape, Class dtype, Options... options) { + public static TruncatedNormal create(Scope scope, Operand shape, Class dtype, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("TruncatedNormal", scope.makeOpName("TruncatedNormal")); opBuilder.addInput(shape.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java index bd0d2a330ee..f823a9be60c 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft.java @@ -63,7 +63,7 @@ public final class Irfft extends RawOp implements Operand * @return a new instance of Irfft */ @Endpoint(describeByClass = true) - public static Irfft create(Scope scope, Operand input, Operand fftLength, Class Treal) { + public static Irfft create(Scope scope, Operand input, Operand fftLength, Class Treal) { OperationBuilder opBuilder = scope.env().opBuilder("IRFFT", scope.makeOpName("Irfft")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(fftLength.asOutput()); @@ -81,7 +81,7 @@ public static Irfft create(Scope scope, * @return a new instance of Irfft */ @Endpoint(describeByClass = true) - public static Irfft create(Scope scope, Operand input, Operand fftLength) { + public static Irfft create(Scope scope, Operand input, Operand fftLength) { return create(scope, input, fftLength, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java index 861e7aaf62e..709297f6afe 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft2d.java @@ -64,7 +64,7 @@ public final class Irfft2d extends RawOp implements Operand Irfft2d create(Scope scope, Operand input, Operand fftLength, Class Treal) { + public static Irfft2d create(Scope scope, Operand input, Operand fftLength, Class Treal) { OperationBuilder opBuilder = scope.env().opBuilder("IRFFT2D", scope.makeOpName("Irfft2d")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(fftLength.asOutput()); @@ -82,7 +82,7 @@ public static Irfft2d create(Scope scope * @return a new instance of Irfft2d */ @Endpoint(describeByClass = true) - public static Irfft2d create(Scope scope, Operand input, Operand fftLength) { + public static Irfft2d create(Scope scope, Operand input, Operand fftLength) { return create(scope, input, fftLength, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java index d68a0904eff..c30315d1e7b 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Irfft3d.java @@ -64,7 +64,7 @@ public final class Irfft3d extends RawOp implements Operand Irfft3d create(Scope scope, Operand input, Operand fftLength, Class Treal) { + public static Irfft3d create(Scope scope, Operand input, Operand fftLength, Class Treal) { OperationBuilder opBuilder = scope.env().opBuilder("IRFFT3D", scope.makeOpName("Irfft3d")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(fftLength.asOutput()); @@ -82,7 +82,7 @@ public static Irfft3d create(Scope scope * @return a new instance of Irfft3d */ @Endpoint(describeByClass = true) - public static Irfft3d create(Scope scope, Operand input, Operand fftLength) { + public static Irfft3d create(Scope scope, Operand input, Operand fftLength) { return create(scope, input, fftLength, TFloat32.class); } diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java index 3b8e54a361e..5ca4fe1c4d5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft.java @@ -59,7 +59,7 @@ public final class Rfft extends RawOp implements Operand { * @return a new instance of Rfft */ @Endpoint(describeByClass = true) - public static Rfft create(Scope scope, Operand input, Operand fftLength, Class Tcomplex) { + public static Rfft create(Scope scope, Operand input, Operand fftLength, Class Tcomplex) { OperationBuilder opBuilder = scope.env().opBuilder("RFFT", scope.makeOpName("Rfft")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(fftLength.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java index cf00ae1b33b..483d26a898f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft2d.java @@ -60,7 +60,7 @@ public final class Rfft2d extends RawOp implements Operand { * @return a new instance of Rfft2d */ @Endpoint(describeByClass = true) - public static Rfft2d create(Scope scope, Operand input, Operand fftLength, Class Tcomplex) { + public static Rfft2d create(Scope scope, Operand input, Operand fftLength, Class Tcomplex) { OperationBuilder opBuilder = scope.env().opBuilder("RFFT2D", scope.makeOpName("Rfft2d")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(fftLength.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java index c01d979d7cb..cf64fceea54 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/signal/Rfft3d.java @@ -60,7 +60,7 @@ public final class Rfft3d extends RawOp implements Operand { * @return a new instance of Rfft3d */ @Endpoint(describeByClass = true) - public static Rfft3d create(Scope scope, Operand input, Operand fftLength, Class Tcomplex) { + public static Rfft3d create(Scope scope, Operand input, Operand fftLength, Class Tcomplex) { OperationBuilder opBuilder = scope.env().opBuilder("RFFT3D", scope.makeOpName("Rfft3d")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(fftLength.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java index 57dd04bb693..b1c834f44f1 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddManySparseToTensorsMap.java @@ -98,7 +98,7 @@ private Options() { * @return a new instance of AddManySparseToTensorsMap */ @Endpoint(describeByClass = true) - public static AddManySparseToTensorsMap create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Options... options) { + public static AddManySparseToTensorsMap create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("AddManySparseToTensorsMap", scope.makeOpName("AddManySparseToTensorsMap")); opBuilder.addInput(sparseIndices.asOutput()); opBuilder.addInput(sparseValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java index 9f6fd118a0d..c8313d66e85 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/AddSparseToTensorsMap.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of AddSparseToTensorsMap */ @Endpoint(describeByClass = true) - public static AddSparseToTensorsMap create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Options... options) { + public static AddSparseToTensorsMap create(Scope scope, Operand sparseIndices, Operand sparseValues, Operand sparseShape, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("AddSparseToTensorsMap", scope.makeOpName("AddSparseToTensorsMap")); opBuilder.addInput(sparseIndices.asOutput()); opBuilder.addInput(sparseValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseCountSparseOutput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseCountSparseOutput.java index c06191594a3..fa956a4032f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseCountSparseOutput.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DenseCountSparseOutput.java @@ -77,7 +77,7 @@ private Options() { * @return a new instance of DenseCountSparseOutput */ @Endpoint(describeByClass = true) - public static DenseCountSparseOutput create(Scope scope, Operand values, Operand weights, Boolean binaryOutput, Options... options) { + public static DenseCountSparseOutput create(Scope scope, Operand values, Operand weights, Boolean binaryOutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("DenseCountSparseOutput", scope.makeOpName("DenseCountSparseOutput")); opBuilder.addInput(values.asOutput()); opBuilder.addInput(weights.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java index f229dd2ad98..82afc01ea47 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/DeserializeSparse.java @@ -89,7 +89,7 @@ public final class DeserializeSparse extends RawOp { * @return a new instance of DeserializeSparse */ @Endpoint(describeByClass = true) - public static DeserializeSparse create(Scope scope, Operand serializedSparse, Class dtype) { + public static DeserializeSparse create(Scope scope, Operand serializedSparse, Class dtype) { OperationBuilder opBuilder = scope.env().opBuilder("DeserializeSparse", scope.makeOpName("DeserializeSparse")); opBuilder.addInput(serializedSparse.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java index 9fbf6a1efdf..94e912c38f8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAccumulatorApplyGradient.java @@ -54,7 +54,7 @@ public final class SparseAccumulatorApplyGradient extends RawOp { * @return a new instance of SparseAccumulatorApplyGradient */ @Endpoint(describeByClass = true) - public static SparseAccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradientIndices, Operand gradientValues, Operand gradientShape, Boolean hasKnownShape) { + public static SparseAccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradientIndices, Operand gradientValues, Operand gradientShape, Boolean hasKnownShape) { OperationBuilder opBuilder = scope.env().opBuilder("SparseAccumulatorApplyGradient", scope.makeOpName("SparseAccumulatorApplyGradient")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(localStep.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java index 9153c575162..7ced04729a4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseAdd.java @@ -66,7 +66,7 @@ public final class SparseAdd extends RawOp { * @return a new instance of SparseAdd */ @Endpoint(describeByClass = true) - public static SparseAdd create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand bIndices, Operand bValues, Operand bShape, Operand thresh) { + public static SparseAdd create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand bIndices, Operand bValues, Operand bShape, Operand thresh) { OperationBuilder opBuilder = scope.env().opBuilder("SparseAdd", scope.makeOpName("SparseAdd")); opBuilder.addInput(aIndices.asOutput()); opBuilder.addInput(aValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCountSparseOutput.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCountSparseOutput.java index 85e6707f0c0..3133f02292a 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCountSparseOutput.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseCountSparseOutput.java @@ -79,7 +79,7 @@ private Options() { * @return a new instance of SparseCountSparseOutput */ @Endpoint(describeByClass = true) - public static SparseCountSparseOutput create(Scope scope, Operand indices, Operand values, Operand denseShape, Operand weights, Boolean binaryOutput, Options... options) { + public static SparseCountSparseOutput create(Scope scope, Operand indices, Operand values, Operand denseShape, Operand weights, Boolean binaryOutput, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseCountSparseOutput", scope.makeOpName("SparseCountSparseOutput")); opBuilder.addInput(indices.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java index d254cb3224c..ce1216ea5e1 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseMatMul.java @@ -100,7 +100,7 @@ private Options() { * @return a new instance of SparseMatMul */ @Endpoint(describeByClass = true) - public static SparseMatMul create(Scope scope, Operand a, Operand b, Options... options) { + public static SparseMatMul create(Scope scope, Operand a, Operand b, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseMatMul", scope.makeOpName("SparseMatMul")); opBuilder.addInput(a.asOutput()); opBuilder.addInput(b.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java index a373bd33f03..496dfc994de 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMean.java @@ -50,7 +50,7 @@ public final class SparseSegmentMean extends RawOp implements * @return a new instance of SparseSegmentMean */ @Endpoint(describeByClass = true) - public static SparseSegmentMean create(Scope scope, Operand data, Operand indices, Operand segmentIds) { + public static SparseSegmentMean create(Scope scope, Operand data, Operand indices, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentMean", scope.makeOpName("SparseSegmentMean")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java index 8e558afbe9e..2b9aa410096 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanGrad.java @@ -50,7 +50,7 @@ public final class SparseSegmentMeanGrad extends RawOp implem * @return a new instance of SparseSegmentMeanGrad */ @Endpoint(describeByClass = true) - public static SparseSegmentMeanGrad create(Scope scope, Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { + public static SparseSegmentMeanGrad create(Scope scope, Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentMeanGrad", scope.makeOpName("SparseSegmentMeanGrad")); opBuilder.addInput(grad.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java index d62b956b096..e2d79025981 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentMeanWithNumSegments.java @@ -53,7 +53,7 @@ public final class SparseSegmentMeanWithNumSegments extends R * @return a new instance of SparseSegmentMeanWithNumSegments */ @Endpoint(describeByClass = true) - public static SparseSegmentMeanWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + public static SparseSegmentMeanWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentMeanWithNumSegments", scope.makeOpName("SparseSegmentMeanWithNumSegments")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java index 50fe5cc8068..f9768aa67bd 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtN.java @@ -50,7 +50,7 @@ public final class SparseSegmentSqrtN extends RawOp implement * @return a new instance of SparseSegmentSqrtN */ @Endpoint(describeByClass = true) - public static SparseSegmentSqrtN create(Scope scope, Operand data, Operand indices, Operand segmentIds) { + public static SparseSegmentSqrtN create(Scope scope, Operand data, Operand indices, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSqrtN", scope.makeOpName("SparseSegmentSqrtN")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java index 9faa31633c0..8d43bc92976 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNGrad.java @@ -50,7 +50,7 @@ public final class SparseSegmentSqrtNGrad extends RawOp imple * @return a new instance of SparseSegmentSqrtNGrad */ @Endpoint(describeByClass = true) - public static SparseSegmentSqrtNGrad create(Scope scope, Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { + public static SparseSegmentSqrtNGrad create(Scope scope, Operand grad, Operand indices, Operand segmentIds, Operand outputDim0) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSqrtNGrad", scope.makeOpName("SparseSegmentSqrtNGrad")); opBuilder.addInput(grad.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java index f962af5be0f..569c2d40534 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSqrtNWithNumSegments.java @@ -55,7 +55,7 @@ public final class SparseSegmentSqrtNWithNumSegments extends * @return a new instance of SparseSegmentSqrtNWithNumSegments */ @Endpoint(describeByClass = true) - public static SparseSegmentSqrtNWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + public static SparseSegmentSqrtNWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSqrtNWithNumSegments", scope.makeOpName("SparseSegmentSqrtNWithNumSegments")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java index add00c19798..04e00d71648 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSum.java @@ -75,7 +75,7 @@ public final class SparseSegmentSum extends RawOp implements * @return a new instance of SparseSegmentSum */ @Endpoint(describeByClass = true) - public static SparseSegmentSum create(Scope scope, Operand data, Operand indices, Operand segmentIds) { + public static SparseSegmentSum create(Scope scope, Operand data, Operand indices, Operand segmentIds) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSum", scope.makeOpName("SparseSegmentSum")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java index b956d005069..0dca626c528 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseSegmentSumWithNumSegments.java @@ -74,7 +74,7 @@ public final class SparseSegmentSumWithNumSegments extends Ra * @return a new instance of SparseSegmentSumWithNumSegments */ @Endpoint(describeByClass = true) - public static SparseSegmentSumWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { + public static SparseSegmentSumWithNumSegments create(Scope scope, Operand data, Operand indices, Operand segmentIds, Operand numSegments) { OperationBuilder opBuilder = scope.env().opBuilder("SparseSegmentSumWithNumSegments", scope.makeOpName("SparseSegmentSumWithNumSegments")); opBuilder.addInput(data.asOutput()); opBuilder.addInput(indices.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java index cadce484f8f..076dd63a78d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/sparse/SparseTensorDenseMatMul.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of SparseTensorDenseMatMul */ @Endpoint(describeByClass = true) - public static SparseTensorDenseMatMul create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand b, Options... options) { + public static SparseTensorDenseMatMul create(Scope scope, Operand aIndices, Operand aValues, Operand aShape, Operand b, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseTensorDenseMatMul", scope.makeOpName("SparseTensorDenseMatMul")); opBuilder.addInput(aIndices.asOutput()); opBuilder.addInput(aValues.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeEncode.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeEncode.java index d24d09a67ef..091d598a2e8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeEncode.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnicodeEncode.java @@ -101,7 +101,7 @@ private Options() { * @return a new instance of UnicodeEncode */ @Endpoint(describeByClass = true) - public static UnicodeEncode create(Scope scope, Operand inputValues, Operand inputSplits, String outputEncoding, Options... options) { + public static UnicodeEncode create(Scope scope, Operand inputValues, Operand inputSplits, String outputEncoding, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("UnicodeEncode", scope.makeOpName("UnicodeEncode")); opBuilder.addInput(inputValues.asOutput()); opBuilder.addInput(inputSplits.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnsortedSegmentJoin.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnsortedSegmentJoin.java index 075d21d219e..790196f34e3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnsortedSegmentJoin.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/strings/UnsortedSegmentJoin.java @@ -92,7 +92,7 @@ private Options() { * @return a new instance of UnsortedSegmentJoin */ @Endpoint(describeByClass = true) - public static UnsortedSegmentJoin create(Scope scope, Operand inputs, Operand segmentIds, Operand numSegments, Options... options) { + public static UnsortedSegmentJoin create(Scope scope, Operand inputs, Operand segmentIds, Operand numSegments, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("UnsortedSegmentJoin", scope.makeOpName("UnsortedSegmentJoin")); opBuilder.addInput(inputs.asOutput()); opBuilder.addInput(segmentIds.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java index 0acfec7cac1..34ed418e986 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/HistogramSummary.java @@ -49,7 +49,7 @@ public final class HistogramSummary extends RawOp implements Operand { * @return a new instance of HistogramSummary */ @Endpoint(describeByClass = true) - public static HistogramSummary create(Scope scope, Operand tag, Operand values) { + public static HistogramSummary create(Scope scope, Operand tag, Operand values) { OperationBuilder opBuilder = scope.env().opBuilder("HistogramSummary", scope.makeOpName("HistogramSummary")); opBuilder.addInput(tag.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java index 7217055142b..c5c4a9b30a7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ImageSummary.java @@ -121,7 +121,7 @@ private Options() { * @return a new instance of ImageSummary */ @Endpoint(describeByClass = true) - public static ImageSummary create(Scope scope, Operand tag, Operand tensor, Options... options) { + public static ImageSummary create(Scope scope, Operand tag, Operand tensor, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ImageSummary", scope.makeOpName("ImageSummary")); opBuilder.addInput(tag.asOutput()); opBuilder.addInput(tensor.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java index 37740dc7ef3..27989bc1fed 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/ScalarSummary.java @@ -46,7 +46,7 @@ public final class ScalarSummary extends RawOp implements Operand { * @return a new instance of ScalarSummary */ @Endpoint(describeByClass = true) - public static ScalarSummary create(Scope scope, Operand tags, Operand values) { + public static ScalarSummary create(Scope scope, Operand tags, Operand values) { OperationBuilder opBuilder = scope.env().opBuilder("ScalarSummary", scope.makeOpName("ScalarSummary")); opBuilder.addInput(tags.asOutput()); opBuilder.addInput(values.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java index 4b0d0fb1c4d..be4ceff4fb4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/TensorSummary.java @@ -45,7 +45,7 @@ public final class TensorSummary extends RawOp implements Operand { * @return a new instance of TensorSummary */ @Endpoint(describeByClass = true) - public static TensorSummary create(Scope scope, Operand tag, Operand tensor, Operand serializedSummaryMetadata) { + public static TensorSummary create(Scope scope, Operand tag, Operand tensor, Operand serializedSummaryMetadata) { OperationBuilder opBuilder = scope.env().opBuilder("TensorSummaryV2", scope.makeOpName("TensorSummary")); opBuilder.addInput(tag.asOutput()); opBuilder.addInput(tensor.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java index 7daeb5ccbd0..11b2b4e942d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteHistogramSummary.java @@ -43,7 +43,7 @@ public final class WriteHistogramSummary extends RawOp { * @return a new instance of WriteHistogramSummary */ @Endpoint(describeByClass = true) - public static WriteHistogramSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand values) { + public static WriteHistogramSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand values) { OperationBuilder opBuilder = scope.env().opBuilder("WriteHistogramSummary", scope.makeOpName("WriteHistogramSummary")); opBuilder.addInput(writer.asOutput()); opBuilder.addInput(step.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java index 70eed3c13a1..51436c8e07e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteImageSummary.java @@ -65,7 +65,7 @@ private Options() { * @return a new instance of WriteImageSummary */ @Endpoint(describeByClass = true) - public static WriteImageSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand tensor, Operand badColor, Options... options) { + public static WriteImageSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand tensor, Operand badColor, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("WriteImageSummary", scope.makeOpName("WriteImageSummary")); opBuilder.addInput(writer.asOutput()); opBuilder.addInput(step.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java index ce5a91db59b..9f68f48e4bb 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteScalarSummary.java @@ -43,7 +43,7 @@ public final class WriteScalarSummary extends RawOp { * @return a new instance of WriteScalarSummary */ @Endpoint(describeByClass = true) - public static WriteScalarSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand value) { + public static WriteScalarSummary create(Scope scope, Operand writer, Operand step, Operand tag, Operand value) { OperationBuilder opBuilder = scope.env().opBuilder("WriteScalarSummary", scope.makeOpName("WriteScalarSummary")); opBuilder.addInput(writer.asOutput()); opBuilder.addInput(step.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java index 9555f1add0b..a27ceff133e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/summary/WriteSummary.java @@ -44,7 +44,7 @@ public final class WriteSummary extends RawOp { * @return a new instance of WriteSummary */ @Endpoint(describeByClass = true) - public static WriteSummary create(Scope scope, Operand writer, Operand step, Operand tensor, Operand tag, Operand summaryMetadata) { + public static WriteSummary create(Scope scope, Operand writer, Operand step, Operand tensor, Operand tag, Operand summaryMetadata) { OperationBuilder opBuilder = scope.env().opBuilder("WriteSummary", scope.makeOpName("WriteSummary")); opBuilder.addInput(writer.asOutput()); opBuilder.addInput(step.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/InfeedEnqueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/InfeedEnqueue.java index f0a9ee049b3..f5964ccbde5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/InfeedEnqueue.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/InfeedEnqueue.java @@ -83,7 +83,7 @@ private Options() { * @return a new instance of InfeedEnqueue */ @Endpoint(describeByClass = true) - public static InfeedEnqueue create(Scope scope, Operand input, Options... options) { + public static InfeedEnqueue create(Scope scope, Operand input, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("InfeedEnqueue", scope.makeOpName("InfeedEnqueue")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/OutfeedEnqueue.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/OutfeedEnqueue.java index f7c3c08f967..27b13bcae61 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/OutfeedEnqueue.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/OutfeedEnqueue.java @@ -39,7 +39,7 @@ public final class OutfeedEnqueue extends RawOp { * @return a new instance of OutfeedEnqueue */ @Endpoint(describeByClass = true) - public static OutfeedEnqueue create(Scope scope, Operand input) { + public static OutfeedEnqueue create(Scope scope, Operand input) { OperationBuilder opBuilder = scope.env().opBuilder("OutfeedEnqueue", scope.makeOpName("OutfeedEnqueue")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/Prelinearize.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/Prelinearize.java index 6e3e451c61f..5cce51a5bf2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/Prelinearize.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/tpu/Prelinearize.java @@ -73,7 +73,7 @@ private Options() { * @return a new instance of Prelinearize */ @Endpoint(describeByClass = true) - public static Prelinearize create(Scope scope, Operand input, Options... options) { + public static Prelinearize create(Scope scope, Operand input, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("Prelinearize", scope.makeOpName("Prelinearize")); opBuilder.addInput(input.asOutput()); opBuilder = scope.apply(opBuilder); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java index 925916e8954..ee5fe7db4b5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/AccumulatorApplyGradient.java @@ -46,7 +46,7 @@ public final class AccumulatorApplyGradient extends RawOp { * @return a new instance of AccumulatorApplyGradient */ @Endpoint(describeByClass = true) - public static AccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradient) { + public static AccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradient) { OperationBuilder opBuilder = scope.env().opBuilder("AccumulatorApplyGradient", scope.makeOpName("AccumulatorApplyGradient")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(localStep.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceAccumulatorApplyGradient.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceAccumulatorApplyGradient.java index 363a80b95a9..373d5efe501 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceAccumulatorApplyGradient.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceAccumulatorApplyGradient.java @@ -44,7 +44,7 @@ public final class ResourceAccumulatorApplyGradient extends RawOp { * @return a new instance of ResourceAccumulatorApplyGradient */ @Endpoint(describeByClass = true) - public static ResourceAccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradient) { + public static ResourceAccumulatorApplyGradient create(Scope scope, Operand handle, Operand localStep, Operand gradient) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceAccumulatorApplyGradient", scope.makeOpName("ResourceAccumulatorApplyGradient")); opBuilder.addInput(handle.asOutput()); opBuilder.addInput(localStep.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java index 018921b0a5e..29a2a993245 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdadelta.java @@ -69,7 +69,7 @@ private Options() { * @return a new instance of ResourceSparseApplyAdadelta */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdadelta", scope.makeOpName("ResourceSparseApplyAdadelta")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java index 3376b099eba..ac0fd69675e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagrad.java @@ -80,7 +80,7 @@ private Options() { * @return a new instance of ResourceSparseApplyAdagrad */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdagrad", scope.makeOpName("ResourceSparseApplyAdagrad")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java index 467f96c0b0f..cf3c20f69d6 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradDa.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of ResourceSparseApplyAdagradDa */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { + public static ResourceSparseApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdagradDA", scope.makeOpName("ResourceSparseApplyAdagradDa")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(gradientAccumulator.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradV2.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradV2.java index a4d61d2cdf6..0cd880c76d8 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradV2.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyAdagradV2.java @@ -80,7 +80,7 @@ private Options() { * @return a new instance of ResourceSparseApplyAdagradV2 */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyAdagradV2 create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyAdagradV2 create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyAdagradV2", scope.makeOpName("ResourceSparseApplyAdagradV2")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java index d94e88f06dc..aa0cdb54cb5 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyCenteredRmsProp.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of ResourceSparseApplyCenteredRmsProp */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyCenteredRMSProp", scope.makeOpName("ResourceSparseApplyCenteredRmsProp")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(mg.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java index 2e302d18037..802a1d86d5e 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyFtrl.java @@ -90,7 +90,7 @@ private Options() { * @return a new instance of ResourceSparseApplyFtrl */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { + public static ResourceSparseApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyFtrlV2", scope.makeOpName("ResourceSparseApplyFtrl")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyKerasMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyKerasMomentum.java index 7a914ea54d4..e0a6eac37e3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyKerasMomentum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyKerasMomentum.java @@ -86,7 +86,7 @@ private Options() { * @return a new instance of ResourceSparseApplyKerasMomentum */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyKerasMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { + public static ResourceSparseApplyKerasMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyKerasMomentum", scope.makeOpName("ResourceSparseApplyKerasMomentum")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java index 2ee7d166cbe..60ca59ace25 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyMomentum.java @@ -86,7 +86,7 @@ private Options() { * @return a new instance of ResourceSparseApplyMomentum */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { + public static ResourceSparseApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyMomentum", scope.makeOpName("ResourceSparseApplyMomentum")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java index afb578d6519..9fff6b866ff 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalAdagrad.java @@ -74,7 +74,7 @@ private Options() { * @return a new instance of ResourceSparseApplyProximalAdagrad */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyProximalAdagrad", scope.makeOpName("ResourceSparseApplyProximalAdagrad")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java index 840290696ff..bb6cab1e2d3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyProximalGradientDescent.java @@ -71,7 +71,7 @@ private Options() { * @return a new instance of ResourceSparseApplyProximalGradientDescent */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyProximalGradientDescent", scope.makeOpName("ResourceSparseApplyProximalGradientDescent")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(alpha.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java index 233b0db5f2b..05581cb35c9 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/ResourceSparseApplyRmsProp.java @@ -82,7 +82,7 @@ private Options() { * @return a new instance of ResourceSparseApplyRmsProp */ @Endpoint(describeByClass = true) - public static ResourceSparseApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static ResourceSparseApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("ResourceSparseApplyRMSProp", scope.makeOpName("ResourceSparseApplyRmsProp")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(ms.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java index 4a0ad5e6a4f..174f3bfecd4 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdadelta.java @@ -72,7 +72,7 @@ private Options() { * @return a new instance of SparseApplyAdadelta */ @Endpoint(describeByClass = true) - public static SparseApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static SparseApplyAdadelta create(Scope scope, Operand var, Operand accum, Operand accumUpdate, Operand lr, Operand rho, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdadelta", scope.makeOpName("SparseApplyAdadelta")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java index 7c925080bc1..8df06b5e426 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagrad.java @@ -83,7 +83,7 @@ private Options() { * @return a new instance of SparseApplyAdagrad */ @Endpoint(describeByClass = true) - public static SparseApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static SparseApplyAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdagradV2", scope.makeOpName("SparseApplyAdagrad")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java index 971525a877b..2e8aede1551 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyAdagradDa.java @@ -74,7 +74,7 @@ private Options() { * @return a new instance of SparseApplyAdagradDa */ @Endpoint(describeByClass = true) - public static SparseApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { + public static SparseApplyAdagradDa create(Scope scope, Operand var, Operand gradientAccumulator, Operand gradientSquaredAccumulator, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand globalStep, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyAdagradDA", scope.makeOpName("SparseApplyAdagradDa")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(gradientAccumulator.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java index 6d7e47cb235..88ea8cf91f3 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyCenteredRmsProp.java @@ -92,7 +92,7 @@ private Options() { * @return a new instance of SparseApplyCenteredRmsProp */ @Endpoint(describeByClass = true) - public static SparseApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static SparseApplyCenteredRmsProp create(Scope scope, Operand var, Operand mg, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyCenteredRMSProp", scope.makeOpName("SparseApplyCenteredRmsProp")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(mg.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java index f5add81d0fe..f720183d7e7 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyFtrl.java @@ -93,7 +93,7 @@ private Options() { * @return a new instance of SparseApplyFtrl */ @Endpoint(describeByClass = true) - public static SparseApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { + public static SparseApplyFtrl create(Scope scope, Operand var, Operand accum, Operand linear, Operand grad, Operand indices, Operand lr, Operand l1, Operand l2, Operand l2Shrinkage, Operand lrPower, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyFtrlV2", scope.makeOpName("SparseApplyFtrl")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java index bb0417ad8d4..577ea1ac28b 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyMomentum.java @@ -89,7 +89,7 @@ private Options() { * @return a new instance of SparseApplyMomentum */ @Endpoint(describeByClass = true) - public static SparseApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { + public static SparseApplyMomentum create(Scope scope, Operand var, Operand accum, Operand lr, Operand grad, Operand indices, Operand momentum, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyMomentum", scope.makeOpName("SparseApplyMomentum")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java index 780fe1e4b84..f38f42737ef 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalAdagrad.java @@ -77,7 +77,7 @@ private Options() { * @return a new instance of SparseApplyProximalAdagrad */ @Endpoint(describeByClass = true) - public static SparseApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + public static SparseApplyProximalAdagrad create(Scope scope, Operand var, Operand accum, Operand lr, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyProximalAdagrad", scope.makeOpName("SparseApplyProximalAdagrad")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(accum.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java index e9c62c888d5..169b8d4f0c2 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyProximalGradientDescent.java @@ -74,7 +74,7 @@ private Options() { * @return a new instance of SparseApplyProximalGradientDescent */ @Endpoint(describeByClass = true) - public static SparseApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { + public static SparseApplyProximalGradientDescent create(Scope scope, Operand var, Operand alpha, Operand l1, Operand l2, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyProximalGradientDescent", scope.makeOpName("SparseApplyProximalGradientDescent")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(alpha.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java index 19a36d1a1fb..6de8f3be05d 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/train/SparseApplyRmsProp.java @@ -85,7 +85,7 @@ private Options() { * @return a new instance of SparseApplyRmsProp */ @Endpoint(describeByClass = true) - public static SparseApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { + public static SparseApplyRmsProp create(Scope scope, Operand var, Operand ms, Operand mom, Operand lr, Operand rho, Operand momentum, Operand epsilon, Operand grad, Operand indices, Options... options) { OperationBuilder opBuilder = scope.env().opBuilder("SparseApplyRMSProp", scope.makeOpName("SparseApplyRmsProp")); opBuilder.addInput(var.asOutput()); opBuilder.addInput(ms.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/BroadcastHelper.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/BroadcastHelper.java index 0bb729b45ae..0813440fa03 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/BroadcastHelper.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/BroadcastHelper.java @@ -50,7 +50,7 @@ public final class BroadcastHelper extends RawOp { * @return a new instance of BroadcastHelper */ @Endpoint(describeByClass = true) - public static BroadcastHelper create(Scope scope, Operand lhs, Operand rhs, Operand broadcastDims) { + public static BroadcastHelper create(Scope scope, Operand lhs, Operand rhs, Operand broadcastDims) { OperationBuilder opBuilder = scope.env().opBuilder("XlaBroadcastHelper", scope.makeOpName("BroadcastHelper")); opBuilder.addInput(lhs.asOutput()); opBuilder.addInput(rhs.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/DynamicUpdateSlice.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/DynamicUpdateSlice.java index adcc4a1ec69..32653d46869 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/DynamicUpdateSlice.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/DynamicUpdateSlice.java @@ -57,7 +57,7 @@ public final class DynamicUpdateSlice extends RawOp implements * @return a new instance of DynamicUpdateSlice */ @Endpoint(describeByClass = true) - public static DynamicUpdateSlice create(Scope scope, Operand input, Operand update, Operand indices) { + public static DynamicUpdateSlice create(Scope scope, Operand input, Operand update, Operand indices) { OperationBuilder opBuilder = scope.env().opBuilder("XlaDynamicUpdateSlice", scope.makeOpName("DynamicUpdateSlice")); opBuilder.addInput(input.asOutput()); opBuilder.addInput(update.asOutput()); diff --git a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/Send.java b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/Send.java index f1806a79b10..948cdee567f 100644 --- a/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/Send.java +++ b/tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/xla/Send.java @@ -44,7 +44,7 @@ public final class Send extends RawOp { * @return a new instance of Send */ @Endpoint(describeByClass = true) - public static Send create(Scope scope, Operand tensor, String tensorName) { + public static Send create(Scope scope, Operand tensor, String tensorName) { OperationBuilder opBuilder = scope.env().opBuilder("XlaSend", scope.makeOpName("Send")); opBuilder.addInput(tensor.asOutput()); opBuilder = scope.apply(opBuilder); From 22cb5b2af4982f4dc2af611d4300c1a3024977f8 Mon Sep 17 00:00:00 2001 From: Jim Clarke Date: Mon, 25 Jan 2021 19:53:29 -0500 Subject: [PATCH 30/60] Add Java 11 support - Initial Phase (#185) * Add profile for JDK11 and Automatic-Module-Name to jars * add maven.compiler.release=11 --- ndarray/pom.xml | 15 +++++++++++++++ pom.xml | 9 +++++++++ tensorflow-core/tensorflow-core-api/pom.xml | 8 ++++++++ .../tensorflow-core-generator/pom.xml | 19 +++++++++++++++---- .../tensorflow-core-platform-gpu/pom.xml | 2 ++ .../tensorflow-core-platform-mkl-gpu/pom.xml | 2 ++ .../tensorflow-core-platform-mkl/pom.xml | 2 ++ .../tensorflow-core-platform/pom.xml | 2 ++ tensorflow-framework/pom.xml | 12 ++++++++++++ 9 files changed, 67 insertions(+), 4 deletions(-) diff --git a/ndarray/pom.xml b/ndarray/pom.xml index bedf291731c..d228fbdb32a 100644 --- a/ndarray/pom.xml +++ b/ndarray/pom.xml @@ -32,6 +32,10 @@ Utility library for N-dimensional data I/O operations. + + org.tensorflow.ndarray + + org.junit.jupiter @@ -57,6 +61,17 @@ + + maven-jar-plugin + 3.2.0 + + + + ${java.module.name} + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/pom.xml b/pom.xml index eb6f943919d..4e79a6ca61c 100644 --- a/pom.xml +++ b/pom.xml @@ -165,6 +165,15 @@ + + + jdk11 + + 11 + 11 + 11 + + diff --git a/tensorflow-core/tensorflow-core-api/pom.xml b/tensorflow-core/tensorflow-core-api/pom.xml index f0953383920..8e303f1f235 100644 --- a/tensorflow-core/tensorflow-core-api/pom.xml +++ b/tensorflow-core/tensorflow-core-api/pom.xml @@ -21,6 +21,7 @@ ${native.build.skip} ${native.build.skip} ${native.build.skip} + org.tensorflow.core.api @@ -330,6 +331,13 @@ maven-jar-plugin 3.1.0 + + + + ${java.module.name} + + +