Known Indirect Subclasses |
A builder for 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();
}
Public Methods
abstract OperationBuilder |
addControlInput(Operation control)
Ensure that the operation does not execute before the control operation does.
|
abstract OperationBuilder | |
abstract OperationBuilder |
addInputList(Output[]<?> inputs)
Add the outputs of another operation as the next inputs of the operation being built.
|
abstract Operation | |
abstract OperationBuilder | |
abstract OperationBuilder | |
abstract OperationBuilder |
setAttr(String name, String[] value)
Set the string values of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, boolean[] value)
Set the boolean values of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, DataType[] value)
Set the type values of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, String value)
Set the string value of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, float[] value)
Set the float values of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, long value)
Set the long value of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, long[] value)
Set the long values of an attribute of the operation being built.
|
abstract OperationBuilder |
setAttr(String name, boolean value)
Set the boolean value of an attribute of the operation being built.
|
abstract OperationBuilder | |
abstract OperationBuilder |
setAttr(String name, float value)
Set the float value of an attribute of the operation being built.
|
abstract OperationBuilder | |
abstract OperationBuilder |
setAttr(String name, byte[] value)
Set the byte values of an attribute of the operation being built.
|
abstract OperationBuilder | |
abstract OperationBuilder |
setDevice(String device)
Set the device requested for computing the operation being built.
|
Public Methods
public abstract OperationBuilder addControlInput (Operation control)
Ensure that the operation does not execute before the control operation does.
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.
Parameters
control | operation that must be executed before running this operation. |
---|
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder addInput (Output<?> input)
Add the output of another operation as the next input of the operation being built.
Parameters
input | Output supposed to be the input of the operation being built. |
---|
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder addInputList (Output[]<?> inputs)
Add the outputs of another operation as the next inputs of the operation being built.
Parameters
inputs | list of Output supposed to be the inputs of the operation being built. |
---|
Returns
- the OperationBuilder instance for chaining.
public abstract Operation build ()
Build the Operation
.
The following action will also be performed depending on the current execution environment.
- In eager mode, the result of the operation will be computed immediately.
- In graph mode, the operation will be added as a node to the graph to be executed later,
when running a
Session
.
The OperationBuilder is not usable after build() returns.
public abstract OperationBuilder setAttr (String name, Tensor<?> value)
Set the tensor value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, Tensor[]<?> value)
Set the tensor values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, String[] value)
Set the string values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, boolean[] value)
Set the boolean values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, DataType[] value)
Set the type values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, String value)
Set the string value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, float[] value)
Set the float values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, long value)
Set the long value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, long[] value)
Set the long values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, boolean value)
Set the boolean value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, Shape[] value)
Set the shape values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, float value)
Set the float value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, DataType value)
Set the type value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, byte[] value)
Set the byte values of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute values |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setAttr (String name, Shape value)
Set the shape value of an attribute of the operation being built.
Parameters
name | attribute name |
---|---|
value | attribute value |
Returns
- the OperationBuilder instance for chaining.
public abstract OperationBuilder setDevice (String device)
Set the device requested for computing the operation being built.
Parameters
device | the requested device, as a string |
---|
Returns
- the OperationBuilder instance for chaining.