public interface OperationBuilder
Operation
s.
For example, the following uses the builder to create an operation that produces the constant "3" as its output:
// env is an ExecutionEnvironment, such as a Graph instance.
try (Tensor c1 = Tensor.create(3.0f)) {
env.opBuilder("Const", "MyConst")
.setAttr("dtype", c1.dataType())
.setAttr("value", c1)
.build();
}
Modifier and Type | Method and Description |
---|---|
OperationBuilder |
addControlInput(Operation control)
Ensure that the operation does not execute before the control operation does.
|
OperationBuilder |
addInput(Output<?> input)
Add the output of another operation as the next input of the operation being built.
|
OperationBuilder |
addInputList(Output<?>[] inputs)
Add the outputs of another operation as the next inputs of the operation being built.
|
Operation |
build()
Build the
Operation . |
OperationBuilder |
setAttr(String name,
boolean value)
Set the boolean value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
boolean[] value)
Set the boolean values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
byte[] value)
Set the byte values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
DataType value)
Set the type value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
DataType[] value)
Set the type values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
float value)
Set the float value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
float[] value)
Set the float values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
long value)
Set the long value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
long[] value)
Set the long values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
Shape value)
Set the shape value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
Shape[] value)
Set the shape values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
String value)
Set the string value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
String[] value)
Set the string values of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
Tensor<?> value)
Set the tensor value of an attribute of the operation being built.
|
OperationBuilder |
setAttr(String name,
Tensor<?>[] value)
Set the tensor values of an attribute of the operation being built.
|
OperationBuilder |
setDevice(String device)
Set the device requested for computing the operation being built.
|
Operation build()
Operation
.
The following action will also be performed depending on the current execution environment.
Session
.
The OperationBuilder is not usable after build() returns.
OperationBuilder addInput(Output<?> input)
input
- Output
supposed to be the input of the operation being built.OperationBuilder addInputList(Output<?>[] inputs)
inputs
- list of Output
supposed to be the inputs of the operation being built.OperationBuilder addControlInput(Operation control)
A control input is an Operation that must be executed before running the operation currently being built.
For example, an Assert operation may be added as a control input for this operation. The Assert now behaves as a pre-condition that will always verify itself before running the operation.
control
- operation that must be executed before running this operation.OperationBuilder setDevice(String device)
device
- the requested device, as a stringOperationBuilder setAttr(String name, String[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, String value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, byte[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, long value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, long[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, float value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, float[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, boolean value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, boolean[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, DataType value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, DataType[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, Tensor<?> value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, Tensor<?>[] value)
name
- attribute namevalue
- attribute valuesOperationBuilder setAttr(String name, Shape value)
name
- attribute namevalue
- attribute valueOperationBuilder setAttr(String name, Shape[] value)
name
- attribute namevalue
- attribute valuesCopyright © 2022. All rights reserved.