官术网_书友最值得收藏!

The order of execution and lazy loading

The nodes in a computation graph are executed in their order of dependency. If node x depends on node y, then x is executed before when the execution of y is requested. A node is only executed if either the node itself or another node depending on it is invoked for execution. This execution philosophy is known as lazy loading. As the name implies, the node objects are not instantiated and initialized until they are actually required.

Often, it is necessary to control the order of the execution of the nodes in a computation graph. This can be done with the tf.Graph.control_dependencies() function. For example, if the graph has the nodes l, m, n, and o, and we want to execute n and o before l and m, then we would use the following code:

with graph_variable.control_dependencies([n,o]):
# other statements here

This makes sure that any node in the preceding with block is executed after nodes n and o have been executed.

主站蜘蛛池模板: 庆云县| 昆山市| 太仓市| 青州市| 即墨市| 中卫市| 三亚市| 荥阳市| 南皮县| 皮山县| 民权县| 南和县| 汤阴县| 乌兰县| 嘉祥县| 尖扎县| 芮城县| 新乡县| 嘉鱼县| 九寨沟县| 襄垣县| 婺源县| 南木林县| 渑池县| 敦煌市| 宜川县| 大兴区| 南京市| 汤原县| 会昌县| 广德县| 东至县| 铁岭市| 鹿泉市| 卢龙县| 莆田市| 灯塔市| 大洼县| 延庆县| 盐边县| 溆浦县|