MindSpore

设计

  • MindSpore设计概览
  • 函数式微分编程
  • 中间表示MindIR
  • 全场景统一
  • 动静态图结合
  • 分布式并行
  • 图算融合加速引擎
  • 高性能数据处理引擎
  • 术语

规格

  • 基准性能
  • 网络支持↗
  • API支持
  • 语法支持

API

  • mindspore
  • mindspore.nn
  • mindspore.ops
  • mindspore.ops.primitive
  • mindspore.amp
  • mindspore.train
  • mindspore.communication
  • mindspore.common.initializer
  • mindspore.dataset
  • mindspore.dataset.transforms
  • mindspore.mindrecord
  • mindspore.nn.probability
  • mindspore.nn.transformer
  • mindspore.rewrite
  • mindspore.boost
  • mindspore.numpy
  • mindspore.scipy
    • mindspore.scipy.linalg
    • mindspore.scipy.optimize
      • mindspore.scipy.optimize.line_search
      • mindspore.scipy.optimize.minimize
    • mindspore.scipy.sparse.linalg
  • C++ API↗

API映射

  • PyTorch与MindSpore API映射表
  • TensorFlow与MindSpore API映射表

迁移指南

  • 迁移指南概述
  • 环境准备与资料获取
  • 模型分析与准备
  • MindSpore网络搭建
  • 调试调优
  • 网络迁移调试实例
  • 常见问题
  • 与PyTorch典型区别
  • 基于自定义算子接口调用第三方算子库

FAQ

  • 安装
  • 数据处理
  • 执行问题
  • 网络编译
  • 算子编译
  • 第三方框架迁移使用
  • 性能调优
  • 精度调优
  • 分布式配置
  • 推理
  • 特性咨询

RELEASE NOTES

  • Release Notes
MindSpore
  • »
  • mindspore.scipy »
  • mindspore.scipy.optimize.line_search
  • 查看页面源码

mindspore.scipy.optimize.line_search

mindspore.scipy.optimize.line_search(f, xk, pk, jac=None, gfk=None, old_fval=None, old_old_fval=None, c1=0.0001, c2=0.9, maxiter=20)[源代码]

Inexact line search that satisfies strong Wolfe conditions.

Algorithm 3.5 from Wright and Nocedal, ‘Numerical Optimization’, 1999, pg. 59-61

说明

line_search is not supported on Windows platform yet.

参数
  • f (function) – function of the form f(x) where x is a flat Tensor and returns a real scalar. The function should be composed of operations with vjp defined.

  • gf (function) – the gradient function at x where x is a flat Tensor and returns a Tensor. The function can be None if you want to use automatic credits.

  • xk (Tensor) – initial guess.

  • pk (Tensor) – direction to search in. Assumes the direction is a descent direction.

  • gfk (Tensor) – initial value of value_and_gradient as position. Default: None.

  • old_fval (Tensor) – The same as gfk. Default: None.

  • old_old_fval (Tensor) – unused argument, only for scipy API compliance. Default: None.

  • c1 (float) – Wolfe criteria constant, see ref. Default: 1e-4.

  • c2 (float) – The same as c1. Default: 0.9.

  • maxiter (int) – maximum number of iterations to search. Default: 20.

返回

LineSearchResults, results of line search results.

Supported Platforms:

CPU GPU

样例

>>> import numpy as onp
>>> from mindspore.scipy.optimize import line_search
>>> from mindspore.common import Tensor
>>> x0 = Tensor(onp.ones(2).astype(onp.float32))
>>> p0 = Tensor(onp.array([-1, -1]).astype(onp.float32))
>>> def func(x):
>>>     return x[0] ** 2 - x[1] ** 3
>>> res = line_search(func, x0, p0)
>>> print(res.a_k)
1.0
上一页 下一页

© 版权所有 MindSpore.

利用 Sphinx 构建,使用了 主题 由 Read the Docs开发.