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

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.

主站蜘蛛池模板: 中方县| 浦城县| 同心县| 四会市| 凌海市| 德化县| 蒙自县| 泸定县| 长宁县| 三亚市| 莆田市| 绥棱县| 高阳县| 陆良县| 嘉祥县| 大英县| 临颍县| 庄浪县| 诏安县| 合山市| 新河县| 雷山县| 乌拉特前旗| 桂东县| 依安县| 虎林市| 清新县| 水富县| 巨野县| 麻阳| 嵊州市| 綦江县| 孟村| 芜湖市| 道孚县| 军事| 乾安县| 盖州市| 扎赉特旗| 长阳| 驻马店市|