public final class OperationBuilder extends Object
Operation
s in a Graph
.
Instances of an OperationBuilder are not thread-safe.
A builder for adding Operation
s to a Graph
. For example, the following uses
the builder to create an operation that produces the constant "3" as its output:
// g is a Graph instance.
try (Tensor c1 = Tensor.create(3.0f)) {
g.opBuilder("Const", "MyConst")
.setAttr("dtype", c1.dataType())
.setAttr("value", c1)
.build();
}
public Operation build()
public OperationBuilder addInput(Output<?> input)
Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is
used to add a input to a OperationBuilder
.
input
- Output
supposed to be the input of the OperationBuilder.public 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.public OperationBuilder addInputList(Output<?>[] inputs)
public OperationBuilder setDevice(String device)
public OperationBuilder setAttr(String name, String value)
public OperationBuilder setAttr(String name, byte[] value)
public OperationBuilder setAttr(String name, long value)
public OperationBuilder setAttr(String name, long[] value)
public OperationBuilder setAttr(String name, float value)
public OperationBuilder setAttr(String name, float[] value)
public OperationBuilder setAttr(String name, boolean value)
public OperationBuilder setAttr(String name, boolean[] value)
public OperationBuilder setAttr(String name, DataType value)
public OperationBuilder setAttr(String name, DataType[] value)
public OperationBuilder setAttr(String name, Tensor<?> value)
public OperationBuilder setAttr(String name, Tensor<?>[] value)
public OperationBuilder setAttr(String name, Shape value)
public OperationBuilder setAttr(String name, Shape[] value)
public OperationBuilder setAttr(String name, String[] value)
Copyright © 2015–2018. All rights reserved.