gpt4 book ai didi

tensorflow - 如何在 TensorFlow 中获取当前事件的 tf.variable_scope?

转载 作者:行者123 更新时间:2023-12-04 17:07:58 25 4
gpt4 key购买 nike

我编写了一个方便的 API 来在 TensorFlow 中定义我的模型,该 API 公开了一个范围对象。现在我想在添加操作之前验证用户是否实际进入了范围。如何在 TensorFlow 中获取当前事件的 tf.variable_scope 的名称?

最佳答案

您可以使用 tf.get_variable_scope() 获取当前事件的范围:

using tensorflow as tf
with tf.variable_scope("my_scope"):
print(tf.get_variable_scope().name)

这将打印“my_scope”

关于tensorflow - 如何在 TensorFlow 中获取当前事件的 tf.variable_scope?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38422427/

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