aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/java/src/main/java/org/tensorflow/Operation.java
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/java/src/main/java/org/tensorflow/Operation.java')
-rw-r--r--tensorflow/java/src/main/java/org/tensorflow/Operation.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/tensorflow/java/src/main/java/org/tensorflow/Operation.java b/tensorflow/java/src/main/java/org/tensorflow/Operation.java
index 48db554e07..43dbaf125c 100644
--- a/tensorflow/java/src/main/java/org/tensorflow/Operation.java
+++ b/tensorflow/java/src/main/java/org/tensorflow/Operation.java
@@ -70,6 +70,28 @@ public final class Operation {
}
}
+ /**
+ * Returns the size of the list of Tensors produced by this operation.
+ *
+ * <p>An Operation has multiple named outputs, each of which produces either
+ * a single tensor or a list of tensors. This method returns the size of
+ * the list of tensors for a specific named output of the operation.
+ *
+ * @param name identifier of the list of tensors (of which there may
+ * be many) produced by this operation.
+ * @returns the size of the list of Tensors produced by this named output.
+ * @throws IllegalArgumentException if this operation has no output
+ * with the provided name.
+ */
+ public int outputListLength(final String name) {
+ Graph.Reference r = graph.ref();
+ try {
+ return outputListLength(unsafeNativeHandle, name);
+ } finally {
+ r.close();
+ }
+ }
+
/** Returns a symbolic handle to one of the tensors produced by this operation. */
public Output output(int idx) {
return new Output(this, idx);
@@ -108,6 +130,8 @@ public final class Operation {
private static native int numOutputs(long handle);
+ private static native int outputListLength(long handle, String name);
+
private static native long[] shape(long graphHandle, long opHandle, int output);
private static native int dtype(long graphHandle, long opHandle, int output);