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

  • Mastering TensorFlow 1.x
  • Armando Fandango
  • 165字
  • 2021-06-25 22:50:56

Order of execution and lazy loading

The nodes are executed in the order of dependency. If node a depends on node b, then a will be executed before b when the execution of b is requested. A node is not executed unless either the node itself or another node depending on it is not requested for execution. This is also known as lazy loading; namely, the node objects are not created and initialized until they are needed.

Sometimes, you may want to control the order in which the nodes are executed in a graph. This can be achieved with the tf.Graph.control_dependencies() function. For example, if the graph has nodes a, b, c, and d and you want to execute c and d before a and b, then use the following statement:

with graph_variable.control_dependencies([c,d]):
# other statements here

This makes sure that any node in the preceding with block is executed only after nodes c and d have been executed.

主站蜘蛛池模板: 永年县| 新巴尔虎左旗| 玛纳斯县| 自治县| 罗江县| 金门县| 忻州市| 孟津县| 江孜县| 东明县| 兰坪| 商河县| 楚雄市| 宿迁市| 霍城县| 文成县| 永平县| 金华市| 临湘市| 萨嘎县| 麟游县| 盱眙县| 阳城县| 宁安市| 罗源县| 建阳市| 蓝山县| 海盐县| 萝北县| 准格尔旗| 明水县| 太谷县| 临泽县| 皮山县| 葵青区| 嘉黎县| 南靖县| 巩义市| 偏关县| 兴宁市| 云和县|