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

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.

主站蜘蛛池模板: 宁安市| 浙江省| 咸丰县| 麻江县| 封开县| 绥中县| 镇江市| 淳化县| 宜黄县| 张北县| 高安市| 海原县| 灵璧县| 裕民县| 嘉荫县| 唐河县| 望谟县| 钦州市| 敦煌市| 诏安县| 蒙山县| 乌鲁木齐县| 兰考县| 名山县| 阳曲县| 峡江县| 蓬安县| 固原市| 柯坪县| 治多县| 综艺| 司法| 德安县| 沙洋县| 利辛县| 兴城市| 乌鲁木齐县| 广德县| 溧水县| 寿阳县| 保德县|