tensorflow学习笔记:tf.control_dependencies,tf.GraphKeys.UPDATE_OPS,tf.get_collection
生活随笔
收集整理的這篇文章主要介紹了
tensorflow学习笔记:tf.control_dependencies,tf.GraphKeys.UPDATE_OPS,tf.get_collection
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
tf.control_dependencies(control_inputs):
control_dependencies(control_inputs)
ARGS:
- control_inputs:在運(yùn)行上下文中定義的操作之前必須執(zhí)行或計(jì)算的 Operation 列表或 Tensor 對(duì)象.也可以是不清除控件依賴項(xiàng).
返回:
指定上下文中構(gòu)建的所有操作的控制依賴關(guān)系的上下文管理器.
這個(gè)上下文就是with里邊的內(nèi)容
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 = ...關(guān)于tf.GraphKeys.UPDATE_OPS,這是一個(gè)tensorflow的計(jì)算圖中內(nèi)置的一個(gè)集合,其中會(huì)保存一些需要在訓(xùn)練操作之前完成的操作,并配合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.
?
總結(jié)
以上是生活随笔為你收集整理的tensorflow学习笔记:tf.control_dependencies,tf.GraphKeys.UPDATE_OPS,tf.get_collection的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: tensorflow学习笔记:tf.da
- 下一篇: 算法设计:动态规划问题