我有一个模型自动编码器,我想获取y_预测值,然后在丢失前返回;优化器步骤
with tf.device('/gpu:'+GPU0):
################################ ae loss
Y_ = tf.reshape(self.Y, shape=[-1, 64 ** 3])
Y_pred_modi_ = tf.reshape(self.D_1_Y, shape=[-1, 64 ** 3])
w = 0.85
self.aeu_loss = tf.reduce_mean(
-tf.reduce_mean(w * Y_ * tf.log(Y_pred_modi_ + 1e-8), reduction_indices=[1]) -
tf.reduce_mean((1 - w) * (1 - Y_) * tf.log(1 - Y_pred_modi_ + 1e-8),
reduction_indices=[1]))
self.total_loss=self.aeu_loss
################################# optimizer
with tf.device('/gpu:'+GPU0):
aeu_var = [var for var in tf.trainable_variables() if var.name.startswith('aeu_2')]
print(aeu_var)
#dis_var = [var for var in tf.trainable_variables() if var.name.startswith('dis')]
self.aeu_g_optim = tf.train.AdamOptimizer(learning_rate=0.0001, beta1=0.9, beta2=0.999,
epsilon=1e-8).minimize(self.total_loss, var_list=aeu_var)
在丢失之前,我想取Y_pred_modi_
值处理它,然后返回它
目前没有回答
相关问题 更多 >
编程相关推荐