我想连接两个网络,但没有为任何变量提供渐变

时间:2019-07-11 02:04:42

标签: tensorflow

我训练了一个网络,我想在训练后的网络之前添加另一个网络

with tf.name_scope('inNN'):
T_lamb = tf.placeholder(tf.float32, [None, 2], name='inNN_inputs')
Ts = tf.placeholder(tf.float32, [None, 1], name='T_labels')
Ds = tf.placeholder(tf.float32, [None, 4], name='D_labels')
DLs = tf.placeholder(tf.float32, [None, 5], name='D_lamb')

weight, bias = get_w_b()
D_logits_op = inNN(T_lamb, None)
prediction = fwNN(DLs, None, weight, bias)
with tf.variable_scope('T_loss'):
T_loss_op = losses(prediction, Ts)
with tf.variable_scope('D_loss'):
D_loss_op = losses(D_logits_op, Ds)
global_step = tf.Variable(0, trainable=0)

valid_op = evaluation(prediction, Ts)
with tf.variable_scope('train_step'):
train_step_op = training(T_loss_op, LEARNING_RATE, global_step) # error: No gradients provided for any variable, check your graph for ops that do not support gradients

0 个答案:

没有答案