tensorflow优化器_TensorFlow-优化器

本文介绍了TensorFlow中的优化器概念及其重要性,并列举了多种优化器类型,如随机梯度下降、动量优化等。此外,还提供了一个随机梯度下降优化器的实现示例。
tensorflow优化器

tensorflow优化器

TensorFlow-优化器 (TensorFlow - Optimizers)

Optimizers are the extended class, which include added information to train a specific model. The optimizer class is initialized with given parameters but it is important to remember that no Tensor is needed. The optimizers are used for improving speed and performance for training a specific model.

优化器是扩展类,其中包括用于训练特定模型的附加信息。 优化器类使用给定的参数初始化,但是请记住,不需要Tensor是很重要的。 优化器用于提高速度和性能,以训练特定模型。

The basic optimizer of TensorFlow is −

TensorFlow的基本优化器是-


tf.train.Optimizer

This class is defined in the specified path of tensorflow/python/training/optimizer.py.

此类在tensorflow / python / training / optimizer.py的指定路径中定义。

Following are some optimizers in Tensorflow −

以下是Tensorflow中的一些优化器-

  • Stochastic Gradient descent

    随机梯度下降
  • Stochastic Gradient descent with gradient clipping

    带有梯度剪切的随机梯度下降
  • Momentum

    动量
  • Nesterov momentum

    内斯特罗夫的势头
  • Adagrad

    阿达格勒
  • Adadelta

    阿达达
  • RMSProp

    RMSProp
  • Adam

    亚当
  • Adamax

    阿达玛克斯
  • SMORMS3

    SMORMS3

We will focus on the Stochastic Gradient descent. The illustration for creating optimizer for the same is mentioned below −

我们将专注于随机梯度下降。 下面提到用于创建优化器的图示-


def sgd(cost, params, lr = np.float32(0.01)):
   g_params = tf.gradients(cost, params)
   updates = []
   
   for param, g_param in zip(params, g_params):
      updates.append(param.assign(param - lr*g_param))
   return updates

The basic parameters are defined within the specific function. In our subsequent chapter, we will focus on Gradient Descent Optimization with implementation of optimizers.

基本参数在特定功能内定义。 在接下来的章节中,我们将重点介绍实现优化器的梯度下降优化。

翻译自: https://www.tutorialspoint.com/tensorflow/tensorflow_optimizers.htm

tensorflow优化器

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值