损失函数:
loss = tf.reduce_sum(tf.select(tf.greater(y,y_), (y-y_) * loss_more, (y-y_) * loss_less))
优化器:
train_step = tf.train.AdamOptimizier(0.001).minimize(loss)
本文介绍了一种自定义的损失函数实现方法,并使用 TensorFlow 中的 Adam 优化器进行参数更新。损失函数通过 tf.select 来区分不同的误差处理方式,以实现更灵活的训练效果。
损失函数:
loss = tf.reduce_sum(tf.select(tf.greater(y,y_), (y-y_) * loss_more, (y-y_) * loss_less))
优化器:
train_step = tf.train.AdamOptimizier(0.001).minimize(loss)
876

被折叠的 条评论
为什么被折叠?
