Define and train the graph for synchronous updates