public final class Operation extends Object
An Operation is a node in a Graph
that takes zero or more Tensor
s (produced by
other Operations in the Graph) as input, and produces zero or more Tensor
s as output.
Operation instances are valid only as long as the Graph they are a part of is valid. Thus, if
Graph.close()
has been invoked, then methods on the Operation instance may fail with an
IllegalStateException
.
Operation instances are immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
int |
inputListLength(String name)
Returns the size of the given inputs list of Tensors for this operation.
|
String |
name()
Returns the full name of the Operation.
|
int |
numOutputs()
Returns the number of tensors produced by this operation.
|
<T> Output<T> |
output(int idx)
Returns a symbolic handle to one of the tensors produced by this operation.
|
Output<?>[] |
outputList(int idx,
int length)
Returns symbolic handles to a list of tensors produced by this operation.
|
int |
outputListLength(String name)
Returns the size of the list of Tensors produced by this operation.
|
String |
toString() |
String |
type()
Returns the type of the operation, i.e., the name of the computation performed by the
operation.
|
public String name()
public String type()
public int numOutputs()
public int outputListLength(String name)
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.
name
- identifier of the list of tensors (of which there may be many) produced by this
operation.IllegalArgumentException
- if this operation has no output with the provided name.public Output<?>[] outputList(int idx, int length)
idx
- index of the first tensor of the listlength
- number of tensors in the listOutput
public <T> Output<T> output(int idx)
Warning: Does not check that the type of the tensor matches T. It is recommended to call
this method with an explicit type parameter rather than letting it be inferred, e.g. operation.<Integer>output(0)
T
- The expected element type of the tensors produced by this output.idx
- The index of the output among the outputs produced by this operation.public int inputListLength(String name)
An Operation has multiple named inputs, each of which contains either a single tensor or a list of tensors. This method returns the size of the list of tensors for a specific named input of the operation.
name
- identifier of the list of tensors (of which there may be many) inputs to this
operation.IllegalArgumentException
- if this operation has no input with the provided name.Copyright © 2015–2018. All rights reserved.