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

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.

主站蜘蛛池模板: 和硕县| 华宁县| 涿州市| 乡城县| 铜鼓县| 沛县| 扬中市| 西乌珠穆沁旗| 杂多县| 韶山市| 南康市| 苍南县| 浙江省| 日土县| 延津县| 唐海县| 崇阳县| 大厂| 中方县| 集安市| 宜宾市| 常州市| 和平县| 丰宁| 富阳市| 玉龙| 平泉县| 临沭县| 囊谦县| 三门县| 桃源县| 甘谷县| 潞城市| 敖汉旗| 闽清县| 西昌市| 犍为县| 格尔木市| 赞皇县| 石林| 鸡西市|