Overview

The GraphBuilder class is used to build a computational graph in Eager Style mode.

The following is an example of calling the Eager Style graph:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from ge.es import GraphBuilder

# Create a builder.
builder = GraphBuilder("my_graph")

# Create an input.
input1 = builder.create_input(0, shape=[2, 2])
input2 = builder.create_input(1, shape=[2, 2])

# Create a constant.
const1 = builder.create_const_float(1.0)

# Tensor operation
result = input1 + input2

# Set the output.
builder.set_graph_output(result, 0)

# Build a graph.
graph = builder.build_and_reset()