gpt4 book ai didi

tensorflow - 如何在 Tensorflow 中将变量重用设置回 False?

转载 作者:行者123 更新时间:2023-12-01 10:34:38 25 4
gpt4 key购买 nike

在 Tensorflow 中,我们可以使用 tf.get_variable scope().reuse variables() 将变量重用设置为 True,有什么办法可以将其设置回不离开作用域就为假?

最佳答案

这是不可能的。在关于共享变量的教程中,他们明确指出:

Note that you cannot set the reuse flag to False. The reason behind this is to allow to compose functions that create models. Imagine you write a function my_image_filter(inputs) as before. Someone calling the function in a variable scope with reuse=True would expect all inner variables to be reused as well. Allowing to force reuse=False inside the function would break this contract and make it hard to share parameters in this way

你必须离开你的范围并打开另一个具有相同名称和 reuse=False

关于tensorflow - 如何在 Tensorflow 中将变量重用设置回 False?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37913047/

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