@songying
2018-05-18T13:41:56.000000Z
字数 1130
阅读 1454
TensorFlow
tensorflow的collection提供一个全局的存储机制,不会受到变量名生存空间的影响。一处保存,到处可取。
tf.GraphKeys.GLOBAL_VARIABLES--- variables that can be shared across multiple devices,tf.GraphKeys.TRAINABLE_VARIABLES--- variables for which TensorFlow will calculate gradients.tf.GraphKeys.LOCAL_VARIABLES: If you don't want a variable to be trainable, add it to this
tf.add_to_collection细节可参见:tf.Graph.add_to_collection
tf.add_to_collection(name,value)
- **name: **The key for the collection. For example, the
GraphKeysclass contains many standard names for collections.- value: The value to add to the collection.
tf.get_collectionSee tf.Graph.get_collection for more details.
- 返回值: The list of values in the collection with the given
name, or an empty list if no value has been added to that collection. The list contains the values in the order under which they were collected.
tf.get_collection(key,scope=None)
- key: The key for the collection. For example, the
GraphKeysclass contains many standard names for collections.- scope: 可选参数, If supplied, the resulting list is filtered to include only items whose
nameattribute matches usingre.match. Items without anameattribute are never returned if a scope is supplied and the choice orre.matchmeans that ascopewithout special tokens filters by prefix.
