Warning: This API is deprecated and will be removed in a future
version of TensorFlow after
the replacement is stable.
Output
Stay organized with collections
Save and categorize content based on your preferences.
A symbolic handle to a tensor produced by an Operation
.
An Output<T>
is a symbolic handle to a Tensor<T>
. The value of the tensor is
computed by executing the Operation
in a Session
.
By implementing the Operand
interface, instances of this class also act as operands to
Op
instances.
Public Methods
Output<T>
|
asOutput()
Returns the symbolic handle of a tensor.
|
DataType
|
dataType()
Returns the DataType of the tensor referred to by this Output.
|
boolean
|
|
int
|
|
int
|
index()
Returns the index into the outputs of the Operation.
|
Operation
|
op()
Returns the Operation that will produce the tensor referred to by this Output.
|
Shape
|
shape()
Returns the (possibly partially known) shape of the tensor referred to by this Output.
|
Tensor<T>
|
tensor()
Returns the tensor at this output.
|
String
|
|
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Methods
public
Output<T>
asOutput
()
Returns the symbolic handle of a tensor.
Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is
used to obtain a symbolic handle that represents the computation of the input.
public
DataType
dataType
()
Returns the DataType of the tensor referred to by this Output.
public
boolean
equals
(Object o)
public
int
index
()
Returns the index into the outputs of the Operation.
Returns the Operation that will produce the tensor referred to by this Output.
public
Shape
shape
()
Returns the (possibly partially known) shape of the tensor referred to by this Output.
public
Tensor<T>
tensor
()
Returns the tensor at this output.
This operation is only supported on the outputs of an operation executed eagerly. For graph
environments, output tensors must be fetched by running a session, using Session.Runner.fetch(Output)
.
Throws
IllegalStateException |
if this output results from a graph |
public
String
toString
()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-02-12 UTC.
[null,null,["Last updated 2022-02-12 UTC."],[],[],null,["# Output\n\npublic final class **Output** \nA symbolic handle to a tensor produced by an [Operation](/api_docs/java/org/tensorflow/Operation).\n\nAn `Output<T>` is a symbolic handle to a `Tensor<T>`. The value of the tensor is\ncomputed by executing the [Operation](/api_docs/java/org/tensorflow/Operation) in a [Session](/api_docs/java/org/tensorflow/Session).\n\nBy implementing the [Operand](/api_docs/java/org/tensorflow/Operand) interface, instances of this class also act as operands to\n[Op](/api_docs/java/org/tensorflow/op/Op) instances.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [asOutput](/api_docs/java/org/tensorflow/Output#asOutput())() Returns the symbolic handle of a tensor. |\n| [DataType](/api_docs/java/org/tensorflow/DataType) | [dataType](/api_docs/java/org/tensorflow/Output#dataType())() Returns the DataType of the tensor referred to by this Output. |\n| boolean | [equals](/api_docs/java/org/tensorflow/Output#equals(java.lang.Object))(Object o) |\n| int | [hashCode](/api_docs/java/org/tensorflow/Output#hashCode())() |\n| int | [index](/api_docs/java/org/tensorflow/Output#index())() Returns the index into the outputs of the Operation. |\n| [Operation](/api_docs/java/org/tensorflow/Operation) | [op](/api_docs/java/org/tensorflow/Output#op())() Returns the Operation that will produce the tensor referred to by this Output. |\n| [Shape](/api_docs/java/org/tensorflow/Shape) | [shape](/api_docs/java/org/tensorflow/Output#shape())() Returns the (possibly partially known) shape of the tensor referred to by this Output. |\n| [Tensor](/api_docs/java/org/tensorflow/Tensor)\\\u003cT\\\u003e | [tensor](/api_docs/java/org/tensorflow/Output#tensor())() Returns the tensor at this output. |\n| String | [toString](/api_docs/java/org/tensorflow/Output#toString())() |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [org.tensorflow.Operand](/api_docs/java/org/tensorflow/Operand) \n\n|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| abstract [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e | [asOutput](/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |\n\nPublic Methods\n--------------\n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cT\\\u003e\n**asOutput**\n()\n\nReturns the symbolic handle of a tensor.\n\nInputs to TensorFlow operations are outputs of another TensorFlow operation. This method is\nused to obtain a symbolic handle that represents the computation of the input.\n\n\u003cbr /\u003e\n\n#### public [DataType](/api_docs/java/org/tensorflow/DataType)\n**dataType**\n()\n\nReturns the DataType of the tensor referred to by this Output. \n\n#### public boolean\n**equals**\n(Object o)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| o | |\n|---|---|\n\n#### public int\n**hashCode**\n()\n\n\u003cbr /\u003e\n\n#### public int\n**index**\n()\n\nReturns the index into the outputs of the Operation. \n\n#### public [Operation](/api_docs/java/org/tensorflow/Operation)\n**op**\n()\n\nReturns the Operation that will produce the tensor referred to by this Output. \n\n#### public [Shape](/api_docs/java/org/tensorflow/Shape)\n**shape**\n()\n\nReturns the (possibly partially known) shape of the tensor referred to by this Output. \n\n#### public [Tensor](/api_docs/java/org/tensorflow/Tensor)\\\u003cT\\\u003e\n**tensor**\n()\n\nReturns the tensor at this output.\n\nThis operation is only supported on the outputs of an operation executed eagerly. For graph\nenvironments, output tensors must be fetched by running a session, using [Session.Runner.fetch(Output)](/api_docs/java/org/tensorflow/Session.Runner#fetch(org.tensorflow.Output\u003c?\u003e)).\n\n\u003cbr /\u003e\n\n##### Returns\n\n- tensor \n\n##### Throws\n\n| IllegalStateException | if this output results from a graph |\n|-----------------------|-------------------------------------|\n\n##### See Also\n\n- [EagerSession](/api_docs/java/org/tensorflow/EagerSession) \n\n#### public String\n**toString**\n()\n\n\u003cbr /\u003e"]]