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 the tensor.
|
T |
asTensor()
Returns the tensor at this output.
|
DataType |
dataType()
Returns the DataType of the tensor referred to by this Output.
|
boolean |
equals(Object o)
|
<U extends TType> Output<U> |
expect(Class<U> type)
Returns this Output object with the type
Output<U> . |
int |
hashCode()
|
int |
index()
Returns the index into the outputs of the Operation.
|
String |
name()
Returns the full name of this Output (a.k.a.
|
Operation | |
Shape |
shape()
Returns the (possibly partially known) shape of the tensor referred to by this output.
|
String |
toString()
|
Class<T> |
type()
Returns the type of the tensor referred to by this Output.
|
Inherited Methods
Public Methods
public Output<T> asOutput ()
Returns the symbolic handle of the 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 T asTensor ()
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 fetch(Output)
.
It is recommended to close explicitly the returned tensor as soon as possible, since the garbage collector is not aware of the amount of memory it consumes, which can be significant.
Returns
- tensor
Throws
IllegalStateException | if this output results from a graph |
---|---|
ClassCastException | if the type of the tensor and this output are unexpectedly incompatible |
See Also
public boolean equals (Object o)
public Output<U> expect (Class<U> type)
Returns this Output object with the type Output<U>
. This method is useful when given a
value of type Output<?>
.
Parameters
type | any supported tensor type |
---|
Throws
IllegalArgumentException | if the actual data type of this object does not match the type
U .
|
---|
public int hashCode ()
public int index ()
Returns the index into the outputs of the Operation.
public String name ()
Returns the full name of this Output (a.k.a. tensor name)
public Operation op ()
Return this unit of computation as a single Operation
.
For a raw
op, the returned value correspond to the TensorFlow operation
wrapped by this op.
For a composite op, the returned value usually correspond to the last operation invoked in a
chain or to a NoOp
grouping one or more operations as a
single unit of computation.
Returns
- an
Operation
public Shape shape ()
Returns the (possibly partially known) shape of the tensor referred to by this output.
public String toString ()
public Class<T> type ()
Returns the type of the tensor referred to by this Output.