OperationBuilder

public final class OperationBuilder

A builder for Operations in a Graph.

Instances of an OperationBuilder are not thread-safe.

A builder for adding Operations 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("Constant", "MyConst")
       .setAttr("dtype", c1.dataType())
       .setAttr("value", c1)
       .build();
 }
 

Public Methods

OperationBuilder
addInput(Output input)
OperationBuilder
Operation
build()
Add the Operation being built to the Graph.
OperationBuilder
setAttr(String name, boolean[] value)
OperationBuilder
setAttr(String name, DataType[] value)
OperationBuilder
setAttr(String name, String value)
OperationBuilder
setAttr(String name, float[] value)
OperationBuilder
setAttr(String name, long value)
OperationBuilder
setAttr(String name, long[] value)
OperationBuilder
setAttr(String name, Tensor value)
OperationBuilder
setAttr(String name, boolean value)
OperationBuilder
setAttr(String name, float value)
OperationBuilder
setAttr(String name, DataType value)
OperationBuilder
setAttr(String name, Tensor[] value)
OperationBuilder
setAttr(String name, byte[] value)
OperationBuilder
setAttr(String name, Shape value)
OperationBuilder
setDevice(String device)

Inherited Methods

Public Methods

public OperationBuilder addInput (Output input)

Parameters
input

public OperationBuilder addInputList (Output[] inputs)

Parameters
inputs

public Operation build ()

Add the Operation being built to the Graph.

The OperationBuilder is not usable after build() returns.

public OperationBuilder setAttr (String name, boolean[] value)

Parameters
name
value

public OperationBuilder setAttr (String name, DataType[] value)

Parameters
name
value

public OperationBuilder setAttr (String name, String value)

Parameters
name
value

public OperationBuilder setAttr (String name, float[] value)

Parameters
name
value

public OperationBuilder setAttr (String name, long value)

Parameters
name
value

public OperationBuilder setAttr (String name, long[] value)

Parameters
name
value

public OperationBuilder setAttr (String name, Tensor value)

Parameters
name
value

public OperationBuilder setAttr (String name, boolean value)

Parameters
name
value

public OperationBuilder setAttr (String name, float value)

Parameters
name
value

public OperationBuilder setAttr (String name, DataType value)

Parameters
name
value

public OperationBuilder setAttr (String name, Tensor[] value)

Parameters
name
value

public OperationBuilder setAttr (String name, byte[] value)

Parameters
name
value

public OperationBuilder setAttr (String name, Shape value)

Parameters
name
value

public OperationBuilder setDevice (String device)

Parameters
device