我希望通过在模型函数中传递一个参数,在训练阶段将重用变量值从False动态更改为True
我试过了
def model_func(reuse=True):
with tf.variable_scope('batch_norm',reuse = reuse):
#...some batch normalization layer...
这是我的原始代码:
def model_architecture(self, X, keep_prob,reuse=True,is_training=True):
with tf.variable_scope("model_architecture", reuse=reuse):
# Reshape input picture
X = tf.reshape(X, shape=[-1, self.height, self.width, 1])
# --{1st BLOCK}--
# 1st layer
shape = [3,3,1,4] # first layer
with tf.variable_scope("convolution_layer1",reuse=reuse):
conv_l1 = mf.conv_layer(X,shape,"conv_l1")
with tf.variable_scope("batch_norm_layer1",reuse=reuse):
conv_l1 = mf.batch_n(conv_l1,'batch_norm_l1')
值错误8:重用必须为真、假或无
所以我需要调用model\u架构(…,reuse=False,…) 并更改所有变量的作用域重用变量的值。有办法吗
我需要这个,因为我将我的训练集划分为较小的训练集,因为输入数据较大,所以我在一个集中训练我的模型保存/恢复,并使用新输入从最后一点继续训练。有办法吗
目前没有回答
相关问题 更多 >
编程相关推荐