gpt4 book ai didi

tensorflow - slim.arg_scope 中的outputs_collections 是什么意思?

转载 作者:行者123 更新时间:2023-12-03 11:13:25 25 4
gpt4 key购买 nike

在slim的alexne.py中看到了这个,找不到相关的文档。想知道什么是集合?我猜它是一种容器,在这种情况下它将用于输出节点?并且想知道这样做的目的是什么,而不是使用输出的名称。

    with tf.variable_scope(scope, 'alexnet_v2', [inputs]) as sc:

end_points_collection = sc.name + '_end_points'
with slim.arg_scope([slim.conv2d, slim.fully_connected, slim.max_pool2d],
outputs_collections=[end_points_collection]):
net = slim.conv2d(inputs, 64, [11,11], 4, padding = 'VALID', scope ='conv1')

最佳答案

集合只是对具有相似含义的图节点进行分组的容器。

说,任何新的可训练 Variable被放入名为 trainable_variables 的集合中,可以使用 tf.get_collection('trainable_variables') 访问.

同样,您可以为图层的输出传递一个集合。

关于tensorflow - slim.arg_scope 中的outputs_collections 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44300641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com