def _create_optimizer(self,
loss: tf.Tensor,
learning_rate: Union[tf.Tensor, float],
momentum: Union[tf.Tensor, float],
threshold: float) -> tf.Operation:
if threshold is not None:
return self._create_optimizer_sparse(loss=loss,
threshold=threshold,
learning_rate=learning_rate,
momentum=momentum)
with tf.variable_scope('optimizer'):
optimizer = tf.train.MomentumOptimizer(learning_rate=learning_rate,
momentum=momentum,
name='optimizer')
self.global_step = tf.Variable(0)
train_op = optimizer.minimize(loss,
global_step=self.global_step,
name='train_op')
return train_op
network_dense.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录