Class GraphOperation
- All Implemented Interfaces:
Operation
Operation added as a node to a Graph.
GraphOperation 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 GraphOperation
instance may fail with an IllegalStateException.
GraphOperation instances are immutable and thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionGet an inspector for the graph operation's attributes.Get the ops that use any of this op's outputs as an input, not including control dependencies.consumers(int index) Get the ops that use this op's designated output as an input, not including control dependencies.Get the ops with this op as a control dependency.Get the control inputs of this op.device()Get the op's device.env()Returns the execution environment this operation was created in.booleanGet the native handle of this operation.inthashCode()Output<?> input(int idx) Gets the input at the given indexOutput<?>[]inputList(int idx, int length) Get the input list that starts atidxand has lengthlengthintinputListLength(String name) Returns the size of the given inputs list of Tensors for this operation.inputs()Get the op's inputs, not including control inputs.name()Returns the full name of the Operation.intGet the number of ops that use any of this op's outputs as an input, not including control dependencies.intnumConsumers(int index) Get the number of ops that use this op's designated output as an input, not including control dependencies.intGet the number of ops with this op as a control dependency.intGet the number of control inputs for this op.intGet the number of inputs to the op, not including control inputs.intReturns the number of tensors produced by this operation.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.intoutputListLength(String name) Returns the size of the list of Tensors produced by this operation.toString()type()Returns the type of the operation, i.e., the name of the computation performed by the operation.
-
Method Details
-
name
-
type
-
env
-
numOutputs
public int numOutputs()Description copied from interface:OperationReturns the number of tensors produced by this operation. -
outputListLength
Description copied from interface:OperationReturns the size of the list of Tensors produced by this operation.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.
- Parameters:
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.
-
hashCode
-
equals
-
inputListLength
Description copied from interface:OperationReturns the size of the given inputs list of Tensors for this operation.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.
- Parameters:
name- identifier of the list of tensors (of which there may be many) inputs to this operation.- Returns:
- the size of the list of Tensors produced by this named input.
-
device
Get the op's device. -
numInputs
public int numInputs()Get the number of inputs to the op, not including control inputs. -
input
Gets the input at the given index -
attributes
Get an inspector for the graph operation's attributes. -
inputList
Get the input list that starts atidxand has lengthlength- Parameters:
idx- the starting index of the listlength- the length of the list- Returns:
- the input list
- See Also:
-
inputs
-
numConsumers
public int numConsumers(int index) Get the number of ops that use this op's designated output as an input, not including control dependencies.- Parameters:
index- the output to look for usages of
-
consumers
Get the ops that use this op's designated output as an input, not including control dependencies.- Parameters:
index- the output to look for usages of
-
numConsumers
public int numConsumers()Get the number of ops that use any of this op's outputs as an input, not including control dependencies. -
consumers
Get the ops that use any of this op's outputs as an input, not including control dependencies. -
numControlInputs
public int numControlInputs()Get the number of control inputs for this op. -
controlInputs
Get the control inputs of this op. -
numControlConsumers
public int numControlConsumers()Get the number of ops with this op as a control dependency. -
controlConsumers
Get the ops with this op as a control dependency. -
getUnsafeNativeHandle
Get the native handle of this operation.No liveness or non-null checking is done, the operation may have been deallocated.
-
outputList
Description copied from interface:OperationReturns symbolic handles to a list of tensors produced by this operation.- Specified by:
outputListin interfaceOperation- Parameters:
idx- index of the first tensor of the listlength- number of tensors in the list- Returns:
- array of
Output
-
output
Description copied from interface:OperationReturns a symbolic handle to one of the tensors produced by this operation.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) -
toString
-