深度学习中遇到的Python问题(三)

1.tf.train.piecewise_constant
走到一定步长更改学习率。

 initial_learning_rate = 0.1 * params['batch_size'] / 128
 batches_per_epoch = _NUM_IMAGES['train'] / params['batch_size']

 global_step = tf.train.get_or_create_global_step()

   boundaries = [int(batches_per_epoch * epoch) for epoch in [100, 150, 200]]
   values = [initial_learning_rate * decay for decay in [1, 0.1, 0.01, 0.001]]
   learning_rate = tf.train.piecewise_constant(
           tf.cast(global_step, tf.int32), boundaries, values)

2.tf.identity
https://blog.csdn.net/hu_guan_jie/article/details/78495297
没看懂。
tf.identity是返回了一个一模一样新的tensor,再control_dependencies的作用块下,需要增加一个新节点到gragh中。

3.tf.summary.scalar
对标量数据汇总和记录

一些高级的API
https://zhuanlan.zhihu.com/p/29073452

猜你喜欢

转载自blog.csdn.net/weixin_41376658/article/details/79727487