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

  • 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.

主站蜘蛛池模板: 油尖旺区| 绥棱县| 唐海县| 慈溪市| 定边县| 土默特左旗| 泾源县| 东阳市| 郁南县| 大理市| 大兴区| 关岭| 和龙市| 北海市| 富顺县| 寿光市| 湘阴县| 菏泽市| 日照市| 兴城市| 伊通| 长顺县| 舞阳县| 宿松县| 宁津县| 广平县| 泸溪县| 枣强县| 宁晋县| 漯河市| 积石山| 太白县| 濮阳市| 碌曲县| 宜昌市| 察哈| 红原县| 河津市| 新津县| 武山县| 肃北|