Overview
The Session class is used to manage graph execution sessions.
The following is an example of invoking a session:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from ge.session import Session from ge.graph import Tensor # Create a session. session = Session() # Add a graph. session.add_graph(0, graph) # Prepare the input. input_tensor = Tensor(data=[1.0, 2.0, 3.0, 4.0], data_type=DataType.DT_FLOAT, format=Format.FORMAT_ND, shape=[2, 2]) # Run diagram outputs = session.run_graph(0, [input_tensor]) |
Parent topic: Session