tensorflow学习笔记:tf.control_dependencies,tf.GraphKeys.UPDATE_OPS,tf.get_collection
生活随笔
收集整理的這篇文章主要介紹了
tensorflow学习笔记:tf.control_dependencies,tf.GraphKeys.UPDATE_OPS,tf.get_collection
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
tf.control_dependencies(control_inputs):
control_dependencies(control_inputs)
ARGS:
- control_inputs:在運行上下文中定義的操作之前必須執(zhí)行或計算的 Operation 列表或 Tensor 對象.也可以是不清除控件依賴項.
返回:
指定上下文中構建的所有操作的控制依賴關系的上下文管理器.
這個上下文就是with里邊的內容
Use with the?with?keyword to specify that all operations constructed within the context should have control dependencies on?control_inputs. For example:
with g.control_dependencies([a, b, c]):# `d` and `e` will only run after `a`, `b`, and `c` have executed.d = ...e = ...關于tf.GraphKeys.UPDATE_OPS,這是一個tensorflow的計算圖中內置的一個集合,其中會保存一些需要在訓練操作之前完成的操作,并配合tf.control_dependencies函數(shù)使用。
tf.get_collection():
get_collection(name,scope=None )Args:
- name: The key for the collection. For example, the?GraphKeys?class contains many standard names for collections.
- scope: (Optional.) A string. If supplied, the resulting list is filtered to include only items whose?nameattribute matches?scope?using?re.match. Items without a?name?attribute are never returned if a scope is supplied. The choice of?re.match?means that a?scope?without special tokens filters by prefix.
?
總結
以上是生活随笔為你收集整理的tensorflow学习笔记:tf.control_dependencies,tf.GraphKeys.UPDATE_OPS,tf.get_collection的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tensorflow学习笔记:tf.da
- 下一篇: 算法设计:动态规划问题