## 1. Project Overview & Quickstart (PaddlePaddle/KeyPointAnnoTools)

# KeyPointAnnoTools

Open-source repository PaddlePaddle/KeyPointAnnoTools

### Repository Details
- **Repository:** [PaddlePaddle/KeyPointAnnoTools](https://github.com/PaddlePaddle/KeyPointAnnoTools)
- **Primary Language:** Code

*Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.*

## 2. Official Technical Reference & Guides (PaddlePaddle/docs)

## File: README.md

# PaddlePaddle docs

English | [简体中文](./README_cn.md) | [日本語](./README_ja.md)


Source files for contents presented at [PaddlePaddle documentation](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/index_cn.html).

Note: English version API docs are generally docstrings in [PaddlePaddle/Paddle](https://github.com/PaddlePaddle/Paddle), documents for [other PaddlePaddle projects](https://www.paddlepaddle.org.cn/overview) are being managed in their respective ways.

## Codebase structure

- [docs](docs): PaddlePaddle 2.0 & above docs source file.
- [docs/api](docs/api): PaddlePaddle API docs.
- [docs/guides](docs/guides): PaddlePaddle guides docs.
- [docs/tutorial](docs/tutorial): PaddlePaddle tutorial docs.
- [ci_scripts](ci_scripts): docs CI scripts.

## How to build

- pre-requirements
  - docker
- Instructions
  - step1: clone docs
    ```
    git clone https://github.com/PaddlePaddle/docs
    ```
  - step2: build docs
    ```
    cd docs
    mkdir output
    bash docs-build.sh -f absolute_path_docs
    ```
  - step3: preview docs
  The output of docs will be generated in docs/output.

## How to contribute

PaddlePaddle welcomes documentation contributions, please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details.

## License



[Apache License 2.0](LICENSE)

---

## File: CONTRIBUTING.md

# Contributing

Since the open source of PaddlePaddle, we have provided high-quality Chinese and English documents. There are also many developers who have made important contributions to the improvement of the quality of the documentation. Thanks very much for every developer's support for PaddlePaddle documentation.

## Introduction

We very much welcome you to participate in the construction of PaddlePaddle documentation and work with us to improve the quality of PaddlePaddle documentation. At present, PaddlePaddle document is divided into the following parts, you can choose any part of your interest to participate:

- Guides
- Practice
- API Documentation

### Guides

This part of the content is mainly a guide to the use of PaddlePaddle. You can correct or improve the existing content, or you can add documents that you think are important. We very much welcome your suggestions and modifications regarding the use of the guides document.

### Practice

The Practice is mainly to use PaddlePaddle for specific case implementation. At present, many developers have contributed very good cases, such as OCR recognition, face key-point detection, etc. We welcome you to submit your project to our repo, and finally show it on the official website of PaddlePaddle.

### API Documentation

PaddlePaddle's API documentation contains an introduction to the API. We welcome you to propose changes to API documentation, whether it is typo or modification instructions and examples, we are very grateful for any contributions you have made to the API documentation.

## Participation

### Guides

This part of the content is stored in the [docs/docs/guides](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides) directory, you can make your changes by submitting a PR. For more information, please refer to: [Document Contribution Guide](https://github.com/PaddlePaddle/docs/wiki/%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97).

### Practice

This part of the content is divided into two parts, the source code and the official website documentation. The source code is stored in the form of a notebook in [book/paddle2.0_docs](https://github.com/PaddlePaddle/book/tree/develop/paddle2.0_docs) directory; after your notebook file is merged, we will convert it into an md file and store it in [docs/docs/tutorial](https: //github.com/PaddlePaddle/docs/tree/develop/docs/tutorial), and then presented to the official website. For more information, please refer to: [[Call for Contribution] Tutorials for PaddlePaddle 2.0](https://github.com/PaddlePaddle/book/issues/905).

### API Documentation

PaddlePaddle provides API documentation in both Chinese and English. The English API documentation is stored in the [Paddle](https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle), you can modify English documents at this location; and Chinese API documents are stored in the [docs/docs/api](https://github.com/PaddlePaddle/docs/tree/develop/docs/api). You can fix and improve any errors and content in the document, or add content that you think is needed in the document. We are very grateful for all your contributions to the API document. For more information, please refer to: [English API Documentation Contribution Guide](https://github.com/PaddlePaddle/docs/wiki/%E8%8B%B1%E6%96%87API%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97), [Chinese API Documentation Contribution Guide](https://github.com/PaddlePaddle/docs/wiki/%E4%B8%AD%E6%96%87API%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97).

## Submit PR

Any modification of PaddlePaddle documentation should be completed by submitting a PR. For more information, please refer to [Submit PR](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/08_contribution/local_dev_guide.html).

---

## File: CONTRIBUTING_cn.md

# 贡献文档

飞桨框架自开源以来，就提供了高质量的中英文文档。也有许多开发者为文档质量的提升，做出了重要的贡献，非常感谢每一位开发者对飞桨文档的支持。

## 文档说明

飞桨框架非常欢迎你参与到飞桨文档的建设中，与我们一同提升飞桨文档的质量。目前，飞桨文档分为以下几个部分，你可以选择任意你感兴趣的部分来参与：

- 使用教程
- 应用实践
- API 文档

### 使用教程

这部分内容主要是对飞桨框架的使用指南的说明，你可以对现有的内容进行纠错或者是改进，也可以新增你认为重要的文档在这个栏目中。我们非常欢迎你提出任何关于使用教程文档的建议以及修改。

### 应用实践

应用实践主要是使用飞桨框架进行具体的案例实现。目前已经有许多开发者贡献了非常优秀的案例，如 OCR 识别、人脸关键点检测等，我们非常欢迎你提交你的项目到我们的 repo 中来，并最终呈现在飞桨的官网上。

### API 文档

API 文档是飞桨框架的 API 文档，包含了飞桨框架 API 的说明介绍。我们非常欢迎你对我们的 API 文档提出修改，不管是 typo 或者是修改说明与示例，我们都非常感谢你对于 API 文档所作出的任何贡献。

## 参与方式

### 使用教程

这部分内容存放在 [docs/docs/guides](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides) 目录下，你可以通过提交 PR 的方式，来作出你的修改。具体修改方式请参考：[文档贡献指南](https://github.com/PaddlePaddle/docs/wiki/%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97)。

### 应用实践

这部分内容存放于 [docs/practices](https://github.com/PaddlePaddle/docs/tree/develop/docs/practices) 目录下。我们非常欢迎你提交基于飞桨框架的实践案例（以 `.ipynb` notebook 格式），包括但不限于计算机视觉、自然语言处理、推荐系统等方向。提交后会呈现在官方文档的[应用实践](https://www.paddlepaddle.org.cn/documentation/docs/zh/practices/index_cn.html)中。具体贡献方式请参考[文档贡献指南](https://www.paddlepaddle.org.cn/documentation/docs/zh/dev_guides/docs_contributing_guides_cn.html)。

### API 文档

飞桨框架同时提供中英文 API 文档。其中，英文 API 文档存于 [Paddle](https://github.com/PaddlePaddle/Paddle/tree/develop/python/paddle) 源代码中，绝大部分通过官网文档的源代码即可链接到，你可以在此位置对英文文档进行修改；而中文 API 文档存放在 [docs/docs/api](https://github.com/PaddlePaddle/docs/tree/develop/docs/api) 目录下。你可以针对文档中的任何错误与内容进行修复与完善，或者是新增你认为该文档中所需要的内容，我们非常感谢你对于 API 文档所付出的一切。具体修改方式请参考：[英文 API 文档贡献指南](https://github.com/PaddlePaddle/docs/wiki/%E8%8B%B1%E6%96%87API%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97)、[中文 API 文档贡献指南](https://github.com/PaddlePaddle/docs/wiki/%E4%B8%AD%E6%96%87API%E6%96%87%E6%A1%A3%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97)。

## 提交 PR

你对于飞桨文档的任何修改，都应该通过提交 PR 的方式来完成，具体的方法可以参考[提交 PR](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/08_contribution/local_dev_guide.html)。

---

## File: README_cn.md

# PaddlePaddle docs

[English](./README.md) | 简体中文 | [日本語](./README_ja.md)

docs 是 [PaddlePaddle 官网文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/index_cn.html) 的源文件。

注意：英文版 API 文档直接从[PaddlePaddle/Paddle](https://github.com/PaddlePaddle/Paddle) 的 docstring 中生成，[飞桨其他项目](https://www.paddlepaddle.org.cn/overview)的文档分别在其对应的位置中管理。

## 仓库结构

- [docs](docs): 飞桨框架 2.0 以及之后版本文档的源文件。
- [docs/api](docs/api): 飞桨中文 API 文档的源文件。
- [docs/guides](docs/guides): 飞桨官方教程的源文件。
- [docs/tutorial](docs/tutorial): 飞桨相关案例的源文件。
- [ci_scripts](ci_scripts): docs CI 相关的文件。

## 如何构建文档

- 依赖
  - docker
- 构建过程
  - step1: clone docs
    ```
    git clone https://github.com/PaddlePaddle/docs
    ```
  - step2: build docs
    ```
    cd docs
    mkdir output
    bash docs-build.sh -f absolute_path_docs
    ```
  - step3: preview docs
  输出的文件会保存在 docs/output 路径下。

## 贡献

我们非常欢迎你贡献文档！你可以参考 [贡献指南](CONTRIBUTING_cn.md) 直接参与。

## License

[Apache License 2.0](LICENSE)

---

## File: README_ja.md

# PaddlePaddle docs

[English](./README.md) | [简体中文](./README_cn.md) | 日本語


[PaddlePaddle ドキュメント](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/index_cn.html)で紹介されている内容のソースファイルです。

注: 英語版 API ドキュメントは一般的に [PaddlePaddle/Paddle](https://github.com/PaddlePaddle/Paddle) のドキュメントです。[他の PaddlePaddle プロジェクト](https://www.paddlepaddle.org.cn/overview)のドキュメントはそれぞれの方法で管理されています。

## コードベースの構造

- [docs](docs): PaddlePaddle 2.0 以上のドキュメントソースファイル。
- [docs/api](docs/api): PaddlePaddle API ドキュメント。
- [docs/guides](docs/guides): PaddlePaddle のガイドドキュメント。
- [docs/tutorial](docs/tutorial): PaddlePaddle チュートリアルのドキュメント。
- [ci_scripts](ci_scripts): ドキュメント CI スクリプト。

## ビルド方法

- 事前条件
  - docker
- 使用方法
  - step1: clone docs
    ```
    git clone https://github.com/PaddlePaddle/docs
    ```
  - step2: build docs
    ```
    cd docs
    mkdir output
    bash docs-build.sh -f absolute_path_docs
    ```
  - step3: preview docs
  docs の出力は docs/output に生成されます。

## コントリビュート方法

詳細は [CONTRIBUTING.md](./CONTRIBUTING.md) をご覧ください。

## ライセンス



[Apache License 2.0](LICENSE)

---

## File: .pre-commit-config.yaml

repos:
  # Common hooks
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-merge-conflict
      - id: check-symlinks
      - id: detect-private-key
        files: (?!.*paddle)^.*$
      - id: end-of-file-fixer
        types: [text]
      - id: trailing-whitespace
        types: [text]
  - repo: https://github.com/Lucas-C/pre-commit-hooks
    rev: v1.5.1
    hooks:
      - id: remove-crlf
        types: [text]
      - id: remove-tabs
        types: [text]
  - repo: https://github.com/PFCCLab/typos-pre-commit-mirror.git
    rev: v1.48.0
    hooks:
      - id: typos
        args: [--force-exclude]
  # Document hooks
  - repo: https://github.com/PFCCLab/dochooks
    rev: v0.6.0
    hooks:
      - id: insert-whitespace-between-cn-and-en-char
        files: \.md$|\.rst$
      - id: check-case-conflict
  # For Python files
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.16.0
    hooks:
      - id: ruff-check
        args: [--fix, --exit-non-zero-on-fix, --no-cache]
        types_or: [python, pyi]
      - id: ruff-format
        types_or: [python, pyi, jupyter]
  # For YAML files
  - repo: https://github.com/PFCCLab/yamlfmt-pre-commit-mirror.git
    rev: v0.21.0
    hooks:
      - id: yamlfmt

---

## File: ci_scripts/api_white_list.txt

paddle/distributed/init_parallel_env_cn.rst
paddle/distributed/spawn_cn.rst
paddle/distributed/ReduceOp_cn.rst
paddle/distributed/scatter_cn.rst
paddle/distributed/all_gather_cn.rst
paddle/distributed/all_reduce_cn.rst
paddle/distributed/reduce_cn.rst
paddle/distributed/barrier_cn.rst
paddle/distributed/broadcast_cn.rst
paddle/distributed/split_cn.rst
paddle/distributed/fleet/Fleet_cn.rst
paddle/distributed/fleet/utils/HDFSClient_cn.rst
paddle/distributed/fleet/utils/LocalFS_cn.rst
paddle/DataParallel_cn.rst
paddle/distributed/ParallelEnv_cn.rst
paddle/device/is_compiled_with_xpu_cn.rst
paddle/static/xpu_places_cn.rst
paddle/device/XPUPlace_cn.rst
paddle/utils/cpp_extension/load_cn.rst
paddle/utils/cpp_extension/setup_cn.rst
paddle/utils/cpp_extension/CppExtension_cn.rst
paddle/utils/cpp_extension/CUDAExtension_cn.rst
paddle/hub/Overview_cn.rst
paddle/incubate/autograd/Overview_cn.rst

---

## File: ci_scripts/CAPItools/README.md

# CAPI tools
CAPI tools 用于一键生成 C++ 的 rst 文档。

## 调用方式
```python
python main.py <source dir> <target dir>
```

若不设置`source dir`和`target dir`，则默认先查找已安装的`paddlepaddle`包环境。

其中：
- source dir 是安装后的 Paddle C++ API 声明路径。 例如`venv/Lib/site-packages/paddle/include/paddle`。
- target dir 目标文件保存路径。

最终生成结果如下所示：
```python
target dir
| -cn
    |- index.rst
    |- Paddle
        |- fluid
        |- phi
        |- ...
| -en
    |- index.rst
    |- Paddle
        |- fluid
        |- phi
        |- ...
```

## 获取最新 PaddlePaddle
pip install python -m pip install paddlepaddle==0.0.0 -f https://www.paddlepaddle.org.cn/whl/windows/cpu-mkl-avx/develop.html

## 代码结构

### `main.py`文件主要用于处理和筛选包文件, 并调用`utils_helper.py`中的函数进行文件生成
```python
def analysis_file() # 用于解析文件内容(多线程不安全)

def generate_docs() # 用于创建目录并传值给 utils_helper.py 中的函数进行文件生成

def cpp2py() # 用于筛选出 cpp api 和 py api 相对应的函数名称
```

### `utils_helper.py`文件主要存放函数生成、解析, 以及文件写入的工作
```python

class func_helper(object) # 用于生成和解析方法
    decode() # 用于解析输出输出参数、函数名称、返回值、函数注释信息
class class_helper(object) # 用于生成和解析类
    decode() # 同 func_helper()

def generate_overview() # 用于生成 overview.rst 文件
```

---

## File: ci_scripts/CAPItools/requirements.txt

robotpy-cppheaderparser==5.1.0
# paddle

---

## File: docs/index_cn.rst

.. PaddlePaddle documentation master file, created by
   sphinx-quickstart on Thu Jun  7 17:04:53 2018.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

###############
欢迎使用 Paddle
###############

..  toctree::
    :maxdepth: 1


    install/index_cn.rst
    guides/index_cn.rst
    hardware_support/index_cn.rst
    practices/index_cn.rst
    api/index_cn.rst
    dev_guides/index_cn.rst
    faq/index_cn.rst
    release_note_cn.md

---

## File: docs/index_en.rst

PaddlePaddle
==========================

..  toctree::
    :maxdepth: 1


    install/index_en.rst
    guides/index_en.rst
    api/index_en.rst
    dev_guides/index_en.rst
    release_note_en.md

---

## File: docs/release_note_cn.md

[Binary file]

---

## File: docs/release_note_en.md

# 3.1 Release Note

The PaddlePaddle framework version 3.2 has further enhanced its performance in large model training and inference, hardware adaptation, and support for mainstream large models and high-performance acceleration libraries.

- In terms of large model training, the PaddlePaddle framework has undergone upgrades in three aspects: computation, parallel strategy, and fault tolerance:
- From the perspective of basic computational performance, FlashMask V3, a sparse mask attention computation with overlapping storage and computation, is proposed to maximize the computational efficiency of Attention. Additionally, it also implements an efficient lossless training technique with FP8 mixed precision effect.
- At the level of distributed parallel strategy, a dynamically adaptive VRAM offloading strategy is proposed to achieve optimal balance between memory and computation. Combined with an innovatively designed VRAM-friendly pipeline parallel scheduling, it further reduces VRAM overhead.
- Enhanced the native fault tolerance capability of the framework, implemented a large-scale cluster training fault tolerance system, which can monitor online silent data corruption and other difficult-to-detect faults without affecting training efficiency, and implemented a highly available checkpoint disaster recovery method to reduce the loss of interruption recovery.
- In terms of hardware adaptation, we have comprehensively upgraded the plug-in adaptation solution for CUDA-like chips.
In terms of device resource management and scheduling, as well as high-performance collective communication libraries, management interface upgrades and communication capability enhancements have been made for CUDA-like chips, with a particular emphasis on enhancing distributed communication capabilities, aligning XCCL with the various structures and functions of NCCL.
- Added a registration mechanism for CUDA-like operators. Taking Muxi adaptation as an example, operator kernel registration can be completed with just one line of code based on the reuse of GPU operator kernels. According to statistical calculations, the reuse rate of operator kernels can reach up to 92%, significantly reducing hardware adaptation costs.
In terms of user experience, the focus has been placed on enhancing compatibility, encompassing the development of interfaces compatible with industry practices, compatibility with the SafeTensors model format, and compatibility with third-party high-performance acceleration libraries.
- The newly added and modified development interfaces are compatible with industry practices, with a series of new APIs and aliases introduced, along with new parameter aliases and both proprietary and generic parameters.
- Fully compatible with the Safetensors model format. The newly added FlexCheckpoint mechanism supports automatic parameter re-sharding across distributed strategies and model structures, significantly reducing the cost of weight conversion and thereby enhancing the end-to-end training and inference development efficiency of large models.
- The system has systematically enhanced its interface compatibility and operator registration capabilities, enabling one-click import of high-performance acceleration libraries. These libraries can be directly reused in PaddlePaddle's model training and inference acceleration processes without requiring code modifications.

## 1. user experience

### New features
- New APIs: `paddle.msort`, `paddle.ravel`, `paddle.nn.functional.dropout1d`, `paddle.Tensor.type_as`, `paddle.Tensor.requires_grad`, `paddle.view_as_complex`, `paddle.view_as_real`, `paddle.nn.Parameter`, `paddle.broadcast_shapes`, `paddle.range`, `paddle.as_tensor`, `paddle.scatter_reduce/scatter_reduce_`, `paddle.scatter_add`, `paddle.tensor`, `paddle.softmax`, `paddle.Tensor.softmax`, `paddle.rand_like`, `paddle.is_autocast_enabled`, `paddle.get_autocast_gpu_dtype`, `paddle.Tensor.repeat`, `paddle.permute`. [#74421]( https://github.com/PaddlePaddle/Paddle/pull/74421 ),[#74439]( https://github.com/PaddlePaddle/Paddle/pull/74439 ),[#74444]( https://github.com/PaddlePaddle/Paddle/pull/74444 ),[#74454]( https://github.com/PaddlePaddle/Paddle/pull/74454 ),[#74459]( https://github.com/PaddlePaddle/Paddle/pull/74459 ),[#74491]( https://github.com/PaddlePaddle/Paddle/pull/74491 ）[# 74466]（ https://github.com/PaddlePaddle/Paddle/pull/74466 ),[#74438]( https://github.com/PaddlePaddle/Paddle/pull/74438 ),[#74594]( https://github.com/PaddlePaddle/Paddle/pull/74594 ),[#74542]( https://github.com/PaddlePaddle/Paddle/pull/74542 ),[#74694]( https://github.com/PaddlePaddle/Paddle/pull/74694 ),[#74564]( https://github.com/PaddlePaddle/Paddle/pull/74564 ),[#74540]( https://github.com/PaddlePaddle/Paddle/pull/74540 ),[#74586]( https://github.com/PaddlePaddle/Paddle/pull/74586 ),[#74651]( https://github.com/PaddlePaddle/Paddle/pull/74651 ),[#74807]( https://github.com/PaddlePaddle/Paddle/pull/74807 ),[#74632]( https://github.com/PaddlePaddle/Paddle/pull/74632 ),[#74834]( https://github.com/PaddlePaddle/Paddle/pull/74834 ),[#74952]( https://github.com/PaddlePaddle/Paddle/pull/74952 ),[#74772]( https://github.com/PaddlePaddle/Paddle/pull/74772 ),[#74441]( https://github.com/PaddlePaddle/Paddle/pull/74441 ),[#74561]( https://github.com/PaddlePaddle/Paddle/pull/74561 ),[#74525]( https://github.com/PaddlePaddle/Paddle/pull/74525 )
- Added a series of APIs under `paddle.compat.*` to support common usage in the industry and facilitate code migration, including `paddle.compat.median`, `paddle.compat.nanmedian`, `paddle.compat.softmax`, `paddle.compat.sort`, `paddle.compat.split`, `paddle.compat.min/max`, and `paddle.compat.Unfold`. [#74865](https://github.com/PaddlePaddle/Paddle/pull/74865), [#74874](https://github.com/PaddlePaddle/Paddle/pull/74874)
- Added a series of initialization APIs to support commonly used parameter initialization methods in the industry, including `paddle.nn.init.kaiming_uniform_`, `paddle.nn.init.xavier_uniform_`, `paddle.nn.init.uniform_`, `paddle.nn.init.kaiming_normal_`, `paddle.nn.init.xavier_normal_`, `paddle.nn.init.normal_`, `paddle.nn.init.calculate_gain`, `paddle.nn.init.constant_`, `paddle.nn.init.dirac_`, `paddle.nn.init.eye_`, `paddle.nn.init.ones_`, `paddle.nn.init.orthogonal_`, `paddle.nn.init.trunc_normal_`, and `paddle.nn.init.zeros_`. [#74478](https://github.com/PaddlePaddle/Paddle/pull/74478)
- Added usage of parameter aliases in API, allowing for more flexible input options such as `x` or `input`. This includes functions like `paddle.maximum`, `paddle.minimum`, `paddle.sqrt`, `paddle.topk`, `paddle.polar`, `paddle.stack`, `paddle.cos`, `paddle.floor`, `paddle.log`, `paddle.pow`, `paddle.rsqrt`, `paddle.sign`, `paddle.sin`, `paddle.multiply`, and `paddle.where`. [#74683](https://github.com/PaddlePaddle/Paddle/pull/74683), [#74795](https://github.com/PaddlePaddle/Paddle/pull/74795), [#74887](https://github.com/PaddlePaddle/Paddle/pull/74887), [#74592](https://github.com/PaddlePaddle/Paddle/pull/74592)
- `paddle.Tensor` now supports multiple initialization methods, enabling flexible Tensor creation. [#74619](https://github.com/PaddlePaddle/Paddle/pull/74619), [#75022](https://github.com/PaddlePaddle/Paddle/pull/75022), [#75065](https://github.com/PaddlePaddle/Paddle/pull/75065)
- The API has added some proprietary parameters to enhance existing functions, including `paddle.nn.functional.gelu`, `paddle.divide/div/div_`, `paddle.add`, `paddle.Tensor.copy_`, `paddle.norm`, `paddle.linalg.norm`, `paddle.nn.functional.silu`, and `paddle.repeat_interleave`. [#74485](https://github.com/PaddlePaddle/Paddle/pull/74485), [#74562](https://github.com/PaddlePaddle/Paddle/pull/74562), [#74420](https://github.com/PaddlePaddle/Paddle/pull/74420), [#74768](https://github.com/PaddlePaddle/Paddle/pull/74768), [#74855](https://github.com/PaddlePaddle/Paddle/pull/74855), [#74903](https://github.com/PaddlePaddle/Paddle/pull/74903), [#74788](https://github.com/PaddlePaddle/Paddle/pull/74788), [#74631](https://github.com/PaddlePaddle/Paddle/pull/74631), [#74947](https://github.com/PaddlePaddle/Paddle/pull/74947)
- The API has added some common parameters: `out`, `device`, `dtype`, `requires_grad`, `pin_memory`, and `bias`, enhancing the existing functionality. These include `paddle.zeros`, `paddle.zeros_like`, `paddle.ones`, `paddle.ones_like`, `paddle.arange`, `paddle.eye`, `paddle.empty`, `paddle.empty_like`, `paddle.full`, `paddle.full_like`, `paddle.randn`, `paddle.Tensor.new_full`, `paddle.Tensor.new_empty`, `paddle.Tensor.new_ones`, `paddle.Tensor.new_zeros`, `paddle.tril/triu`, `paddle.bmm`, `paddle.nn.Conv1D/Conv2D/Conv3D/Embedding`, `paddle.diff`, `paddle.cumsum`, `paddle.var`, `paddle.multinomial`, and `paddle.mean`. [#74477](https://github.com/PaddlePaddle/Paddle/pull/74477),[#74526](https://github.com/PaddlePaddle/Paddle/pull/74526),[#74711](https://github.com/PaddlePaddle/Paddle/pull/74711),[#74582](https://github.com/PaddlePaddle/Paddle/pull/74582),[#74624](https://github.com/PaddlePaddle/Paddle/pull/74624),[#74849](https://github.com/PaddlePaddle/Paddle/pull/74849),[#74612](https://github.com/PaddlePaddle/Paddle/pull/74612),[#74875](https://github.com/PaddlePaddle/Paddle/pull/74875),[#74641](https://github.com/PaddlePaddle/Paddle/pull/74641),[#74949](https://github.com/PaddlePaddle/Paddle/pull/74949),[#74918](https://github.com/PaddlePaddle/Paddle/pull/74918),[#74914](https://github.com/PaddlePaddle/Paddle/pull/74914),[#74934](https://github.com/PaddlePaddle/Paddle/pull/74934),[#74920](https://github.com/PaddlePaddle/Paddle/pull/74920),[#74955](https://github.com/PaddlePaddle/Paddle/pull/74955),[#74226](https://github.com/PaddlePaddle/Paddle/pull/74226),[#74946](https://github.com/PaddlePaddle/Paddle/pull/74946)
- Added aliases to APIs to support more calling methods. These include `paddle.Tensor.mul_/mul`, `paddle.autograd.Function`, `paddle.argwhere`, `paddle.cat`, `paddle.clamp`, `paddle.ger`, `paddle.take_along_dim`, `paddle.linalg.matmul`, `paddle.special.logsumexp`, `paddle.concatenate`, `paddle.eq/gt`, `paddle.Tensor.take_along_dim`, and `paddle.nn.Conv1d/Conv2d/Conv3d`, etc. [#74493](https://github.com/PaddlePaddle/Paddle/pull/74493), [#74569](https://github.com/PaddlePaddle/Paddle/pull/74569), [#74870](https://github.com/PaddlePaddle/Paddle/pull/74870)

### Bug fixes
- Fixed the precision issue of `paddle.nanmedian` in PaddlePaddle. [#74263](https://github.com/PaddlePaddle/Paddle/pull/74263)
- Fixed the issue of `paddle.distributed.fleet.utils.hybrid_parallel_util.fused_allreduce_gradients` in 0-D scenarios. [#74957](https://github.com/PaddlePaddle/Paddle/pull/74957)
- Fixed the issue of `paddle.matmul` in distributed mode. [#74989](https://github.com/PaddlePaddle/Paddle/pull/74989)

### Enhanced functionality
- For scenarios involving the return of multiple Tensor objects, the experience has been optimized through encapsulation using the Paddle data structure, including `paddle.topk`.[#74931](https://github.com/PaddlePaddle/Paddle/pull/74931)
- Create a class API to support the usage of variable-sized parameters. [#74494](https://github.com/PaddlePaddle/Paddle/pull/74494)

### Documents
- Added or fixed documentation. [#74453](https://github.com/PaddlePaddle/Paddle/pull/74453), [#74846](https://github.com/PaddlePaddle/Paddle/pull/74846), [#74982](https://github.com/PaddlePaddle/Paddle/pull/74982)

### Other
- Optimization related to code style. [#74654](https://github.com/PaddlePaddle/Paddle/pull/74654),[#74655](https://github.com/PaddlePaddle/Paddle/pull/74655),[#74665](https://github.com/PaddlePaddle/Paddle/pull/74665),[#74660](https://github.com/PaddlePaddle/Paddle/pull/74660),[#74667](https://github.com/PaddlePaddle/Paddle/pull/74667),[#74664](https://github.com/PaddlePaddle/Paddle/pull/74664),[#74662](https://github.com/PaddlePaddle/Paddle/pull/74662),[#74661](https://github.com/PaddlePaddle/Paddle/pull/74661),[#74658](https://github.com/PaddlePaddle/Paddle/pull/74658),[#74657](https://github.com/PaddlePaddle/Paddle/pull/74657),[#74666](https://github.com/PaddlePaddle/Paddle/pull/74666),[#74659](https://github.com/PaddlePaddle/Paddle/pull/74659),[#74663](https://github.com/PaddlePaddle/Paddle/pull/74663),[#74656](https://github.com/PaddlePaddle/Paddle/pull/74656),[#74673](https://github.com/PaddlePaddle/Paddle/pull/74673),[#74672](https://github.com/PaddlePaddle/Paddle/pull/74672),[#74671](https://github.com/PaddlePaddle/Paddle/pull/74671),[#74674](https://github.com/PaddlePaddle/Paddle/pull/74674),[#74675](https://github.com/PaddlePaddle/Paddle/pull/74675),[#74670](https://github.com/PaddlePaddle/Paddle/pull/74670),[#74669](https://github.com/PaddlePaddle/Paddle/pull/74669),[#74677](https://github.com/PaddlePaddle/Paddle/pull/74677),[#74709](https://github.com/PaddlePaddle/Paddle/pull/74709),[#74714](https://github.com/PaddlePaddle/Paddle/pull/74714),[#74712](https://github.com/PaddlePaddle/Paddle/pull/74712),[#74713](https://github.com/PaddlePaddle/Paddle/pull/74713),[#74704](https://github.com/PaddlePaddle/Paddle/pull/74704),[#74746](https://github.com/PaddlePaddle/Paddle/pull/74746),[#74748](https://github.com/PaddlePaddle/Paddle/pull/74748),[#74743](https://github.com/PaddlePaddle/Paddle/pull/74743),[#74742](https://github.com/PaddlePaddle/Paddle/pull/74742),[#74744](https://github.com/PaddlePaddle/Paddle/pull/74744),[#74745](https://github.com/PaddlePaddle/Paddle/pull/74745),[#74747](https://github.com/PaddlePaddle/Paddle/pull/74747),[#74794](https://github.com/PaddlePaddle/Paddle/pull/74794),[#74789](https://github.com/PaddlePaddle/Paddle/pull/74789),[#74793](https://github.com/PaddlePaddle/Paddle/pull/74793),[#74786](https://github.com/PaddlePaddle/Paddle/pull/74786),[#74791](https://github.com/PaddlePaddle/Paddle/pull/74791),[#74787](https://github.com/PaddlePaddle/Paddle/pull/74787),[#74827](https://github.com/PaddlePaddle/Paddle/pull/74827),[#74608](https://github.com/PaddlePaddle/Paddle/pull/74608),[#74288](https://github.com/PaddlePaddle/Paddle/pull/74288),[#74287](https://github.com/PaddlePaddle/Paddle/pull/74287),[#74385](https://github.com/PaddlePaddle/Paddle/pull/74385),[#74395](https://github.com/PaddlePaddle/Paddle/pull/74395),[#74475](https://github.com/PaddlePaddle/Paddle/pull/74475),[#74647](https://github.com/PaddlePaddle/Paddle/pull/74647)
- Optimization related to MKLDNN/ONEDNN. [#74299](https://github.com/PaddlePaddle/Paddle/pull/74299),[#74244](https://github.com/PaddlePaddle/Paddle/pull/74244),[#74230](https://github.com/PaddlePaddle/Paddle/pull/74230),[#74314](https://github.com/PaddlePaddle/Paddle/pull/74314),[#74327](https://github.com/PaddlePaddle/Paddle/pull/74327),[#74325](https://github.com/PaddlePaddle/Paddle/pull/74325),[#74326](https://github.com/PaddlePaddle/Paddle/pull/74326),[#74315](https://github.com/PaddlePaddle/Paddle/pull/74315),[#74399](https://github.com/PaddlePaddle/Paddle/pull/74399),[#74398](https://github.com/PaddlePaddle/Paddle/pull/74398),[#74393](https://github.com/PaddlePaddle/Paddle/pull/74393),[#74392](https://github.com/PaddlePaddle/Paddle/pull/74392),[#74367](https://github.com/PaddlePaddle/Paddle/pull/74367),[#74391](https://github.com/PaddlePaddle/Paddle/pull/74391),[#74423](https://github.com/PaddlePaddle/Paddle/pull/74423),[#74424](https://github.com/PaddlePaddle/Paddle/pull/74424),[#74436](https://github.com/PaddlePaddle/Paddle/pull/74436),[#74417](https://github.com/PaddlePaddle/Paddle/pull/74417),[#74410](https://github.com/PaddlePaddle/Paddle/pull/74410),[#74473](https://github.com/PaddlePaddle/Paddle/pull/74473),[#74458](https://github.com/PaddlePaddle/Paddle/pull/74458),[#74501](https://github.com/PaddlePaddle/Paddle/pull/74501),[#74487](https://github.com/PaddlePaddle/Paddle/pull/74487),[#74502](https://github.com/PaddlePaddle/Paddle/pull/74502),[#74513](https://github.com/PaddlePaddle/Paddle/pull/74513),[#74518](https://github.com/PaddlePaddle/Paddle/pull/74518),[#74516](https://github.com/PaddlePaddle/Paddle/pull/74516),[#74507](https://github.com/PaddlePaddle/Paddle/pull/74507),[#74504](https://github.com/PaddlePaddle/Paddle/pull/74504),[#74505](https://github.com/PaddlePaddle/Paddle/pull/74505),[#74509](https://github.com/PaddlePaddle/Paddle/pull/74509),[#74535](https://github.com/PaddlePaddle/Paddle/pull/74535),[#74536](https://github.com/PaddlePaddle/Paddle/pull/74536),[#74517](https://github.com/PaddlePaddle/Paddle/pull/74517),[#74503](https://github.com/PaddlePaddle/Paddle/pull/74503),[#74557](https://github.com/PaddlePaddle/Paddle/pull/74557),[#74550](https://github.com/PaddlePaddle/Paddle/pull/74550),[#74575](https://github.com/PaddlePaddle/Paddle/pull/74575),[#74587](https://github.com/PaddlePaddle/Paddle/pull/74587),[#74576](https://github.com/PaddlePaddle/Paddle/pull/74576),[#74588](https://github.com/PaddlePaddle/Paddle/pull/74588),[#74549](https://github.com/PaddlePaddle/Paddle/pull/74549),[#74581](https://github.com/PaddlePaddle/Paddle/pull/74581),[#74583](https://github.com/PaddlePaddle/Paddle/pull/74583),[#74628](https://github.com/PaddlePaddle/Paddle/pull/74628),[#74630](https://github.com/PaddlePaddle/Paddle/pull/74630),[#74635](https://github.com/PaddlePaddle/Paddle/pull/74635),[#74679](https://github.com/PaddlePaddle/Paddle/pull/74679),[#74648](https://github.com/PaddlePaddle/Paddle/pull/74648),[#74127](https://github.com/PaddlePaddle/Paddle/pull/74127),[#74636](https://github.com/PaddlePaddle/Paddle/pull/74636),[#74552](https://github.com/PaddlePaddle/Paddle/pull/74552),[#74551](https://github.com/PaddlePaddle/Paddle/pull/74551),[#74678](https://github.com/PaddlePaddle/Paddle/pull/74678),[#74680](https://github.com/PaddlePaddle/Paddle/pull/74680),[#74730](https://github.com/PaddlePaddle/Paddle/pull/74730),[#74751](https://github.com/PaddlePaddle/Paddle/pull/74751),[#74895](https://github.com/PaddlePaddle/Paddle/pull/74895),[#74821](https://github.com/PaddlePaddle/Paddle/pull/74821),[#74897](https://github.com/PaddlePaddle/Paddle/pull/74897),[#74734](https://github.com/PaddlePaddle/Paddle/pull/74734)
- Optimizations related to code implementation, variable and file renaming. [#74309](https://github.com/PaddlePaddle/Paddle/pull/74309), [#74597](https://github.com/PaddlePaddle/Paddle/pull/74597), [#74613](https://github.com/PaddlePaddle/Paddle/pull/74613), [#74376](https://github.com/PaddlePaddle/Paddle/pull/74376), [#74479](https://github.com/PaddlePaddle/Paddle/pull/74479), [#74960](https://github.com/PaddlePaddle/Paddle/pull/74960), [#74968](https://github.com/PaddlePaddle/Paddle/pull/74968), [#74977](https://github.com/PaddlePaddle/Paddle/pull/74977)
- Optimizations related to unit tests, and bug fixes for unit test issues. [#74595](https://github.com/PaddlePaddle/Paddle/pull/74595)
- Compilation-related optimizations and CI issue fixes. [#74356](https://github.com/PaddlePaddle/Paddle/pull/74356), [#74936](https://github.com/PaddlePaddle/Paddle/pull/74936)
- Optimize debugging and printing information, and optimize error reporting information. [#74765](https://github.com/PaddlePaddle/Paddle/pull/74765), [#74381](https://github.com/PaddlePaddle/Paddle/pull/74381), [#74384](https://github.com/PaddlePaddle/Paddle/pull/74384), [#74386](https://github.com/PaddlePaddle/Paddle/pull/74386), [#74387](https://github.com/PaddlePaddle/Paddle/pull/74387), [#74383](https://github.com/PaddlePaddle/Paddle/pull/74383), [#74519](https://github.com/PaddlePaddle/Paddle/pull/74519), [#74520](https://github.com/PaddlePaddle/Paddle/pull/74520), [#74468](https://github.com/PaddlePaddle/Paddle/pull/74468)
- Optimizations related to custom operators. [#74402](https://github.com/PaddlePaddle/Paddle/pull/74402)
- Distributed FlexCheckpoint support. [#74966](https://github.com/PaddlePaddle/Paddle/pull/74966), [#74593](https://github.com/PaddlePaddle/Paddle/pull/74593), [#74785](https://github.com/PaddlePaddle/Paddle/pull/74785), [#74814](https://github.com/PaddlePaddle/Paddle/pull/74814)

## 2.  Basic execution architecture

### New features
- Support for dynamic graphs. [#74484](https://github.com/PaddlePaddle/Paddle/pull/74484)
- Support for safetensors. [#74642](https://github.com/PaddlePaddle/Paddle/pull/74642), [#74609](https://github.com/PaddlePaddle/Paddle/pull/74609), [#75049](https://github.com/PaddlePaddle/Paddle/pull/75049)
- Added offloader to optimize computation efficiency. [#74837](https://github.com/PaddlePaddle/Paddle/pull/74837)
- Added API support for forward computation of conv_transpose. [#74431](https://github.com/PaddlePaddle/Paddle/pull/74431)
- Added offloader to optimize computation efficiency. [#74837](https://github.com/PaddlePaddle/Paddle/pull/74837)
- The inference deployment has added w4afp8 quantization inference, supporting w4afp8 quantization weight pure permutation and all2all communication [#74270](https://github.com/PaddlePaddle/Paddle/pull/74270)

### Bug fixes
- Core framework and infrastructure optimization. [#74336](https://github.com/PaddlePaddle/Paddle/pull/74336), [#74554](https://github.com/PaddlePaddle/Paddle/pull/74554), [#74634](https://github.com/PaddlePaddle/Paddle/pull/74634)
- Calculation accuracy and type handling. [#74278](https://github.com/PaddlePaddle/Paddle/pull/74278), [#74222](https://github.com/PaddlePaddle/Paddle/pull/74222), [#74830](https://github.com/PaddlePaddle/Paddle/pull/74830)
- Optimization of dynamic dimension check logic. [#74633](https://github.com/PaddlePaddle/Paddle/pull/74633), [#74650](https://github.com/PaddlePaddle/Paddle/pull/74650)
- Memory and illegal access fixes. [#74347](https://github.com/PaddlePaddle/Paddle/pull/74347), [#73443](https://github.com/PaddlePaddle/Paddle/pull/73443), [#74953](https://github.com/PaddlePaddle/Paddle/pull/74953)
- Fixed printing of error/warning messages. [#74474](https://github.com/PaddlePaddle/Paddle/pull/74474), [#74533](https://github.com/PaddlePaddle/Paddle/pull/74533), [#74685](https://github.com/PaddlePaddle/Paddle/pull/74685), [#74721](https://github.com/PaddlePaddle/Paddle/pull/74721), [#74754](https://github.com/PaddlePaddle/Paddle/pull/74754)
- Code quality and documentation correction. [#74378](https://github.com/PaddlePaddle/Paddle/pull/74378), [#74828](https://github.com/PaddlePaddle/Paddle/pull/74828)
- Fixed the processing logic of the flashmask API. [#74928](https://github.com/PaddlePaddle/Paddle/pull/74928)
- Fixed the issue where splitting CudaGraph subgraphs did not take effect in dynamic-to-static mode. ([#74749](https://github.com/PaddlePaddle/Paddle/pull/74749))

### Enhanced functionality
- C++ extension development. [#74338](https://github.com/PaddlePaddle/Paddle/pull/74338)
- Optimization of FlexCP function. [#74752](https://github.com/PaddlePaddle/Paddle/pull/74752), [#74981](https://github.com/PaddlePaddle/Paddle/pull/74981)
- Optimize memory allocation. [#74463](https://github.com/PaddlePaddle/Paddle/pull/74463)

### Deprecated
- Clean up old IR-related unit tests for dynamic, static, and transition scenarios. [#74698](https://github.com/PaddlePaddle/Paddle/pull/74698), [#74715](https://github.com/PaddlePaddle/Paddle/pull/74715), [#74718](https://github.com/PaddlePaddle/Paddle/pull/74718), [#74782](https://github.com/PaddlePaddle/Paddle/pull/74782), [#74962](https://github.com/PaddlePaddle/Paddle/pull/74962)

### Other
- Update patch version. [#74940](https://github.com/PaddlePaddle/Paddle/pull/74940)

## 3.  Distributed & automatic parallelism

### Parallel strategy
In version 3.2, we have made multiple enhancements to the pipeline parallelism feature, including implementing support for dictionary parameter passing and extending the compatibility of Pipeline Layer and SharedLayerDesc with non-pipeline parallelism. Additionally, we have fixed several critical issues, such as IPC API exceptions for large-sized tensors, evaluation batches and non-computational losses in pipeline parallelism, gradient release errors in MoE models, hang issues caused by NCCL communication reconstruction in PP scenarios, and event management errors in dual-pipeline parallelism. Furthermore, we have conducted various performance optimizations, improved the computation overlap efficiency of dual-pipeline parallelism to enhance training performance, and upgraded the clear_param_storage method to support the clearing and resetting operations of multiple color collections in sharding mode.

#### New Features
- Implement support for dictionary parameter passing in Pipeline Parallel. [#74574](https://github.com/PaddlePaddle/Paddle/pull/74574), [#74867](https://github.com/PaddlePaddle/Paddle/pull/74867)
- Pipeline Layer and SharedLayerDesc support non-pipeline parallelism (nonpp parallel). [#74573](https://github.com/PaddlePaddle/Paddle/pull/74573)

#### Bug fixes
- Fixed the IPC API issue with large-sized tensors. [#74472](https://github.com/PaddlePaddle/Paddle/pull/74472)
- Fixed issues related to evaluation batch and non-compute_loss in pipeline parallelism. [#74170](https://github.com/PaddlePaddle/Paddle/pull/74170)
- Fixed the gradient release issue on MoE model. [#74972](https://github.com/PaddlePaddle/Paddle/pull/74972)
- Fixed the hang issue when rebuilding NCCL comm in the pp scenario. [#73625](https://github.com/PaddlePaddle/Paddle/pull/73625)
- Fixed the event management error in dual pipeline parallelism (dual pp). [#74158](https://github.com/PaddlePaddle/Paddle/pull/74158)

#### Optimization and improvement
- Optimize the efficiency of computation overlap in parallel dual pipelines to enhance training performance. [#74527](https://github.com/PaddlePaddle/Paddle/pull/74527)
- Upgrade the clear_param_storage method to support the clearing and resetting of multiple color collections under sharding. [#74741](https://github.com/PaddlePaddle/Paddle/pull/74741)

### Automatic parallelism
#### Functional improvements
- Support the default splitting derivation rule for the same dimension of distributed tensors when it is split by multiple mesh dimensions. [#74396](https://github.com/PaddlePaddle/Paddle/pull/74396)
- Improved the slicing derivation rule of the `reshape` operator to support scenarios where the same dimension of a distributed tensor is sliced by multiple mesh dimensions. [#74352](https://github.com/PaddlePaddle/Paddle/pull/74352), [#74579](https://github.com/PaddlePaddle/Paddle/pull/74579), [#74565](https://github.com/PaddlePaddle/Paddle/pull/74565)
- Support changing the mesh of a tensor without altering the distributed tensor data. [#74248](https://github.com/PaddlePaddle/Paddle/pull/74248)

#### Bug fixes
- Fixed the bug of repeatedly creating communication groups when calling the `get_group` method of `ProcessMesh`. [#73099](https://github.com/PaddlePaddle/Paddle/pull/73099)
- Fixed the bug in the `get_local_slices` method in the MoE scenario. [#74705](https://github.com/PaddlePaddle/Paddle/pull/74705)
- Fixed the bug of gradient clipping in the MoE scenario. [#74916](https://github.com/PaddlePaddle/Paddle/pull/74916)
- Fixed the bug where the `stop_gradient` parameter could not be passed between different stages in the pipeline parallel scenario. [#73459](https://github.com/PaddlePaddle/Paddle/pull/73459)
- Fixed the accuracy bug of gradient clipping in parallel pipeline scenarios. [#74409](https://github.com/PaddlePaddle/Paddle/pull/74409)
- Fixed the bug of generating redundant outputs in the dynamic graph pipeline parallel scenario. [#74913](https://github.com/PaddlePaddle/Paddle/pull/74913)
- Fixed the bug that the operators `moe_combine` and `moe_gate_dispatch` did not work in the MoE scenario. [#74645](https://github.com/PaddlePaddle/Paddle/pull/74645)

#### Other
- Support accuracy alignment for manual and automatic parallelism of data loaders. [#73941](https://github.com/PaddlePaddle/Paddle/pull/73941)
- Optimize the dynamic graph pipeline parallel scheduling logic. [#74720](https://github.com/PaddlePaddle/Paddle/pull/74720)

### Communication Library
In version 3.2, we fixed an error in DeepEP's support for sm90 compilation, added a pre-allocation function to the video memory allocation requested by DeepEP, and upgraded its intranode and internode computation kernels, further optimizing performance and stability.

#### Bug fixes
- Fixed a bug in DeepEP support for sm90 compilation. [#74762](https://github.com/PaddlePaddle/Paddle/pull/74762)

#### Functional improvements
- Added pre-allocation function for the GPU memory allocation requested by DeepEP. [#74465](https://github.com/PaddlePaddle/Paddle/pull/74465)
- Upgraded the intranode and internode computation kernels of DeepEP. [#74284](https://github.com/PaddlePaddle/Paddle/pull/74284)

## 4. Operator mechanism
### New features
- API compatibility support.  [#74506](https://github.com/PaddlePaddle/Paddle/pull/74506), [#74676](https://github.com/PaddlePaddle/Paddle/pull/74676), [#74558](https://github.com/PaddlePaddle/Paddle/pull/74558), [#74572](https://github.com/PaddlePaddle/Paddle/pull/74572), [#74691](https://github.com/PaddlePaddle/Paddle/pull/74691), [#74703](https://github.com/PaddlePaddle/Paddle/pull/74703), [#74750](https://github.com/PaddlePaddle/Paddle/pull/74750), [#74757](https://github.com/PaddlePaddle/Paddle/pull/74757), [#74802](https://github.com/PaddlePaddle/Paddle/pull/74802), [#74546](https://github.com/PaddlePaddle/Paddle/pull/74546), [#74547](https://github.com/PaddlePaddle/Paddle/pull/74547), [#74802](https://github.com/PaddlePaddle/Paddle/pull/74802), [#74859](https://github.com/PaddlePaddle/Paddle/pull/74859), [#74910](https://github.com/PaddlePaddle/Paddle/pull/74910), [#74873](https://github.com/PaddlePaddle/Paddle/pull/74873), [#74882](https://github.com/PaddlePaddle/Paddle/pull/74882), [#74901](https://github.com/PaddlePaddle/Paddle/pull/74901), [#74899](https://github.com/PaddlePaddle/Paddle/pull/74899), [#74449](https://github.com/PaddlePaddle/Paddle/pull/74449)
- Added fused_partial_rope operator. [#74577](https://github.com/PaddlePaddle/Paddle/pull/74577)

### Bug fixes
- 0-size Tensor related fixes. [#74295](https://github.com/PaddlePaddle/Paddle/pull/74295), [#74305](https://github.com/PaddlePaddle/Paddle/pull/74305), [#74323](https://github.com/PaddlePaddle/Paddle/pull/74323), [#74354](https://github.com/PaddlePaddle/Paddle/pull/74354)
- Major Tensor-related fixes.  [#74242](https://github.com/PaddlePaddle/Paddle/pull/74242), [#74293](https://github.com/PaddlePaddle/Paddle/pull/74293), [#74289](https://github.com/PaddlePaddle/Paddle/pull/74289), [#74279](https://github.com/PaddlePaddle/Paddle/pull/74279), [#74330](https://github.com/PaddlePaddle/Paddle/pull/74330), [#74329](https://github.com/PaddlePaddle/Paddle/pull/74329), [#74342](https://github.com/PaddlePaddle/Paddle/pull/74342), [#74369](https://github.com/PaddlePaddle/Paddle/pull/74369), [#74370](https://github.com/PaddlePaddle/Paddle/pull/74370), [#74404](https://github.com/PaddlePaddle/Paddle/pull/74404), [#74537](https://github.com/PaddlePaddle/Paddle/pull/74537), [#74451](https://github.com/PaddlePaddle/Paddle/pull/74451), [#74172](https://github.com/PaddlePaddle/Paddle/pull/74172), [#74324](https://github.com/PaddlePaddle/Paddle/pull/74324), [#74964](https://github.com/PaddlePaddle/Paddle/pull/74964), [#74360](https://github.com/PaddlePaddle/Paddle/pull/74360), [#74379](https://github.com/PaddlePaddle/Paddle/pull/74379), [#74377](https://github.com/PaddlePaddle/Paddle/pull/74377), [#74380](https://github.com/PaddlePaddle/Paddle/pull/74380), [#74362](https://github.com/PaddlePaddle/Paddle/pull/74362), [#74197](https://github.com/PaddlePaddle/Paddle/pull/74197)
- API compatibility-related fixes. [#74764](https://github.com/PaddlePaddle/Paddle/pull/74764), [#74869](https://github.com/PaddlePaddle/Paddle/pull/74869), [#74935](https://github.com/PaddlePaddle/Paddle/pull/74935)
- [Open Source Task] Investigate and resolve precision issues in Paddle CPU/GPU Kernels. [#74149](https://github.com/PaddlePaddle/Paddle/pull/74149), [#74598](https://github.com/PaddlePaddle/Paddle/pull/74598), [#74719](https://github.com/PaddlePaddle/Paddle/pull/74719), [#74625](https://github.com/PaddlePaddle/Paddle/pull/74625), [#74555](https://github.com/PaddlePaddle/Paddle/pull/74555)
- Other important fixes.  [#74282](https://github.com/PaddlePaddle/Paddle/pull/74282), [#74313](https://github.com/PaddlePaddle/Paddle/pull/74313), [#74303](https://github.com/PaddlePaddle/Paddle/pull/74303), [#74306](https://github.com/PaddlePaddle/Paddle/pull/74306), [#74298](https://github.com/PaddlePaddle/Paddle/pull/74298), [#74044](https://github.com/PaddlePaddle/Paddle/pull/74044), [#74290](https://github.com/PaddlePaddle/Paddle/pull/74290), [#74348](https://github.com/PaddlePaddle/Paddle/pull/74348), [#74364](https://github.com/PaddlePaddle/Paddle/pull/74364), [#74332](https://github.com/PaddlePaddle/Paddle/pull/74332), [#74224](https://github.com/PaddlePaddle/Paddle/pull/74224), [#74382](https://github.com/PaddlePaddle/Paddle/pull/74382), [#74406](https://github.com/PaddlePaddle/Paddle/pull/74406), [#74434](https://github.com/PaddlePaddle/Paddle/pull/74434), [#74448](https://github.com/PaddlePaddle/Paddle/pull/74448), [#74457](https://github.com/PaddlePaddle/Paddle/pull/74457), [#74322](https://github.com/PaddlePaddle/Paddle/pull/74322), [#74530](https://github.com/PaddlePaddle/Paddle/pull/74530), [#74716](https://github.com/PaddlePaddle/Paddle/pull/74716), [#74839](https://github.com/PaddlePaddle/Paddle/pull/74839), [#74842](https://github.com/PaddlePaddle/Paddle/pull/74842), [#74854](https://github.com/PaddlePaddle/Paddle/pull/74854), [#74919](https://github.com/PaddlePaddle/Paddle/pull/74919), [#74767](https://github.com/PaddlePaddle/Paddle/pull/74767), [#75003](https://github.com/PaddlePaddle/Paddle/pull/75003)

### Enhanced functionality
- Improved API compatibility.  [#74456](https://github.com/PaddlePaddle/Paddle/pull/74456), [#74480](https://github.com/PaddlePaddle/Paddle/pull/74480), [#74523](https://github.com/PaddlePaddle/Paddle/pull/74523), [#74490](https://github.com/PaddlePaddle/Paddle/pull/74490), [#74548](https://github.com/PaddlePaddle/Paddle/pull/74548), [#74596](https://github.com/PaddlePaddle/Paddle/pull/74596), [#74568](https://github.com/PaddlePaddle/Paddle/pull/74568), [#74559](https://github.com/PaddlePaddle/Paddle/pull/74559), [#74629](https://github.com/PaddlePaddle/Paddle/pull/74629), [#74623](https://github.com/PaddlePaddle/Paddle/pull/74623), [#74700](https://github.com/PaddlePaddle/Paddle/pull/74700), [#74643](https://github.com/PaddlePaddle/Paddle/pull/74643), [#74602](https://github.com/PaddlePaddle/Paddle/pull/74602), [#74783](https://github.com/PaddlePaddle/Paddle/pull/74783), [#74781](https://github.com/PaddlePaddle/Paddle/pull/74781), [#74735](https://github.com/PaddlePaddle/Paddle/pull/74735), [#74725](https://github.com/PaddlePaddle/Paddle/pull/74725), [#74815](https://github.com/PaddlePaddle/Paddle/pull/74815), [#74856](https://github.com/PaddlePaddle/Paddle/pull/74856), [#74925](https://github.com/PaddlePaddle/Paddle/pull/74925), [#74545](https://github.com/PaddlePaddle/Paddle/pull/74545), [#74932](https://github.com/PaddlePaddle/Paddle/pull/74932), [#74784](https://github.com/PaddlePaddle/Paddle/pull/74784)
- Slice/stride related optimizations. [#74731](https://github.com/PaddlePaddle/Paddle/pull/74731), [#74740](https://github.com/PaddlePaddle/Paddle/pull/74740), [#74769](https://github.com/PaddlePaddle/Paddle/pull/74769), [#74810](https://github.com/PaddlePaddle/Paddle/pull/74810), [#74841](https://github.com/PaddlePaddle/Paddle/pull/74841), [#74954](https://github.com/PaddlePaddle/Paddle/pull/74954), [#74888](https://github.com/PaddlePaddle/Paddle/pull/74888), [#74944](https://github.com/PaddlePaddle/Paddle/pull/74944), [#74312](https://github.com/PaddlePaddle/Paddle/pull/74312), [#74291](https://github.com/PaddlePaddle/Paddle/pull/74291), [#74271](https://github.com/PaddlePaddle/Paddle/pull/74271), [#74320](https://github.com/PaddlePaddle/Paddle/pull/74320), [#74344](https://github.com/PaddlePaddle/Paddle/pull/74344), [#74727](https://github.com/PaddlePaddle/Paddle/pull/74727), [#74637](https://github.com/PaddlePaddle/Paddle/pull/74637)
- Operator optimization and CUDA support. [#74693](https://github.com/PaddlePaddle/Paddle/pull/74693), [#74922](https://github.com/PaddlePaddle/Paddle/pull/74922), [#74967](https://github.com/PaddlePaddle/Paddle/pull/74967)
- Improved debugging information and compatibility enhancements. [#74372](https://github.com/PaddlePaddle/Paddle/pull/74372), [#74622](https://github.com/PaddlePaddle/Paddle/pull/74622)
- Operator function expansion and optimization. [#74790](https://github.com/PaddlePaddle/Paddle/pull/74790), [#74979](https://github.com/PaddlePaddle/Paddle/pull/74979)

### Performance optimization
- FP8 computation optimization. [#74471](https://github.com/PaddlePaddle/Paddle/pull/74471), [#74684](https://github.com/PaddlePaddle/Paddle/pull/74684), [#74911](https://github.com/PaddlePaddle/Paddle/pull/74911)
- Basic operator performance optimization. [#74442](https://github.com/PaddlePaddle/Paddle/pull/74442), [#74638](https://github.com/PaddlePaddle/Paddle/pull/74638)
- Support fa3 variable-length sequence reverse computation and optimize forward API. [#73831](https://github.com/PaddlePaddle/Paddle/pull/73831)
- Added FlashMask V2 function. [#74729](https://github.com/PaddlePaddle/Paddle/pull/74729)

### Documents
- Fixed issues with English documentation and copyright year. [#74737](https://github.com/PaddlePaddle/Paddle/pull/74737)

### Other
- The WITH_XPU_FFT option is enabled by default on XPU hardware. [#74699](https://github.com/PaddlePaddle/Paddle/pull/74699)

## 5. Hardware adaptation
### Improved CUDA-like hardware integration solution
- The CUDA-like hardware access solution supports the reuse of cuBlas kernels [#74591](https://github.com/PaddlePaddle/Paddle/pull/74591),
- Fix known issues in the CUDA-like hardware access solution
[#74397](https://github.com/PaddlePaddle/Paddle/pull/74397), [#74411](https://github.com/PaddlePaddle/Paddle/pull/74411), [#74428](https://github.com/PaddlePaddle/Paddle/pull/74428), [#74877](https://github.com/PaddlePaddle/Paddle/pull/74877), [#74939](https://github.com/PaddlePaddle/Paddle/pull/74939)

### Main warehouse supports multiple hardware for single testing
- Single test supports multiple hardware [#74349](https://github.com/PaddlePaddle/Paddle/pull/74349), [#74363](https://github.com/PaddlePaddle/Paddle/pull/74363), [#74806](https://github.com/PaddlePaddle/Paddle/pull/74806), [#74868](https://github.com/PaddlePaddle/Paddle/pull/74868), [#74820](https://github.com/PaddlePaddle/Paddle/pull/74820), [#74927](https://github.com/PaddlePaddle/Paddle/pull/74927)

### New Custom Device API Support
- Added support for Custom Device API [#74308](https://github.com/PaddlePaddle/Paddle/pull/74308), [#74371](https://github.com/PaddlePaddle/Paddle/pull/74371), [#74539](https://github.com/PaddlePaddle/Paddle/pull/74539)

## 6. Installation environment
### Bug fixes

- Fixed the bug in flashattent compilation cache. [#74388](https://github.com/PaddlePaddle/Paddle/pull/74388)
- Fixed the bug where site.USER_SITE was None. [#74373](https://github.com/PaddlePaddle/Paddle/pull/74373)
- Fixed the compilation bug of gtest in multi-architecture Linux systems. [#74723](https://github.com/PaddlePaddle/Paddle/pull/74723)
- Fixed multiple compilation errors in DEBUG mode when WITH_GPU=ON. [#74401](https://github.com/PaddlePaddle/Paddle/pull/74401)
- Fixed the compilation bug of CUDA12.6 under Windows. [#74990](https://github.com/PaddlePaddle/Paddle/pull/74990)
- Fixed the bug in the api-benchmark baseline pipeline. [#74770](https://github.com/PaddlePaddle/Paddle/pull/74770)
- Fixed the bug in the api-benchmark baseline pipeline. [#74778](https://github.com/PaddlePaddle/Paddle/pull/74778)
- Fixed the bug in the api-benchmark baseline pipeline. [#74779](https://github.com/PaddlePaddle/Paddle/pull/74779)
- Fixed the bug in the api-benchmark baseline pipeline. [#74780](https://github.com/PaddlePaddle/Paddle/pull/74780)
- Fixed the bug in the api-benchmark baseline pipeline. [#74800](https://github.com/PaddlePaddle/Paddle/pull/74800)
- Fixed the bug in the api-benchmark baseline pipeline. [#74803](https://github.com/PaddlePaddle/Paddle/pull/74803)

### Other

- Disable the test_custom_contiguous unit test. [#74337](https://github.com/PaddlePaddle/Paddle/pull/74337)
- Support for timed triggering of baseline tasks in the slice pipeline. [#74419](https://github.com/PaddlePaddle/Paddle/pull/74419)
- Support manually specifying the pr for adding slice recording baselines. [#74445](https://github.com/PaddlePaddle/Paddle/pull/74445)
- Check if there are any issues in the code. [#74460](https://github.com/PaddlePaddle/Paddle/pull/74460)
- Support CI PaddleX tasks on XPU. [#74426](https://github.com/PaddlePaddle/Paddle/pull/74426)
- Support slice pipeline exemption mechanism. [#74482](https://github.com/PaddlePaddle/Paddle/pull/74482)
- Updated the Paddle base image. [#73423](https://github.com/PaddlePaddle/Paddle/pull/73423)
- Fixed Ninja version 1.11 for Windows. [#74590](https://github.com/PaddlePaddle/Paddle/pull/74590)
- Support adding the ability to close PRs and cancel CIs. [#74604](https://github.com/PaddlePaddle/Paddle/pull/74604)
- Support for quickly skipping all CI. [#74696](https://github.com/PaddlePaddle/Paddle/pull/74696)
- Add an api-benchmark baseline pipeline. [#74690](https://github.com/PaddlePaddle/Paddle/pull/74690)
- Update the nccl version. [#74809](https://github.com/PaddlePaddle/Paddle/pull/74809)
- Update the RD list for the approve pipeline. [#74838](https://github.com/PaddlePaddle/Paddle/pull/74838)
- Update the RD list for the approve pipeline. [#74902](https://github.com/PaddlePaddle/Paddle/pull/74902)
- Update safetensor to the mirror. [#74904](https://github.com/PaddlePaddle/Paddle/pull/74904)
- Added the compilation flag for flashatten. [#74959](https://github.com/PaddlePaddle/Paddle/pull/74959)
- Temporarily disable the win-inference pipeline. [#74980](https://github.com/PaddlePaddle/Paddle/pull/74980)
- Support for compiling phi dynamic libraries on Windows. [#74950](https://github.com/PaddlePaddle/Paddle/pull/74950)

## 7.  List of contributors
AIbin, Ayakouji, baiyue, baoqiwen, Chang Lu, Chen Zhiyang, co63oc, cyberslack_lee, cyy536, datutu-L, Deng Haodong, Difer, Eddie-Wang, enzodechine, fangfangssj, feri, fxyfxy777, ggggxm, GoldPancake, gouzil, Gu Shiwei, Haze188 灏喆, hohdiy, hong, HU Shenwei, huangjiyi, HydrogenSulfate, kjagsdq, LCStayingdullCircuit, Leo Guo, lightbrother, liufengwei0103, liuruyan, LiYuRio, LLSGYN, Lucas, Luckycheng222, lzy, Nana, Nyakku Shigure, ooo oo, Qianyue He, risemeup1, Ruibiao Chen, Ryan, Shuhao Liang, sneaxiy, Starrysea996, SUN Dong, Tao Luo, Tian, tianhaodongbd, tianshuo78520a, umiswing, waliwali777, wanghuancoder, Wenhao.Dai, wyw, XiaoguangHu, xiaoguoguo626807, xingmingyyj, Yichen Zhang, Yohanna, yongqiangma, Yuan Xiaolan, YUNSHEN XIE, Yuntao Nie, Yuqiang Ge, Yutian Rao, Zero Rains, Zhan Rongrui, Zhang Ting, zhanghonggeng, Zhaowu Pan, zhengshengning, ZhenxingLi, Zhou Xin, zhupengyang, zhwesky2010, Zichao, zty-king, Zx, zyfncg, zzm, 周周周, 正在学习, 苍天荒

---

## File: docs/api/index_cn.rst

==================
API 文档
==================

欢迎使用飞桨框架（PaddlePaddle），PaddlePaddle 是一个易用、高效、灵活、可扩展的深度学习框架，致力于让深度学习技术的创新与应用更简单。

在本版本中，飞桨框架对 API 做了许多优化，您可以参考下表来了解飞桨框架最新版的 API 目录结构与说明。更详细的说明，请参见 `版本说明 <../release_note_cn.html>`_ 。此外，您可参考 PaddlePaddle 的 `GitHub <https://github.com/PaddlePaddle/Paddle>`_ 了解详情。

**注: paddle.fluid.\*、paddle.dataset.\* 已废弃。**

+--------------------------+------------------------------------------------------------------------------------+
|           目录           |                                  功能和包含的 API                                  |
+==========================+====================================================================================+
| paddle.\*                | paddle                                                                             |
|                          | 根目录下保留了常用 API 的别名，包括：paddle.tensor、                               |
|                          | paddle.framework、paddle.device 目录下的所有 API。                                 |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.tensor            | Tensor 操作相关的 API，包括 创建 zeros，                                           |
|                          | 矩阵运算 matmul，变换 concat，计算 add，查找 argmax 等。                           |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.framework         | 框架通用 API 和动态图模式的 API，包括 no_grad、                                    |
|                          | save、load 等。                                                                    |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.amp               | 自动混合精度策略，包括 auto_cast、                                                 |
|                          | GradScaler 等。                                                                    |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.audio             | 语音领域 API， 包括特征提取、数据集操作等。                                        |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.autograd          | 自动求导相关 API，包括 backward、PyLayer 等。                                      |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.callbacks         | 日志回调类，包括 ModelCheckpoint、                                                 |
|                          | ProgBarLogger 等。                                                                 |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.compat            | PyTorch 兼容的函数与模块，                                                         |
|                          | 行为与 PyTorch 对应接口一致                                                        |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.cuda              | PyTorch 兼容的函数与模块，                                                         |
|                          | 包含与 CUDA 设备相关的函数和模块                                                   |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.device            | 设备管理相关 API，包括 set_device、get_device 等。                                 |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.distributed       | 分布式相关基础 API。                                                               |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.distributed.fleet | 分布式相关高层 API。                                                               |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.distribution      | 概率分布类 API，包括常用的各种概率分布操作。                                       |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.fft               | 快速傅里叶变换的相关 API，包括 fft、fft2 等。                                      |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.geometric         | 图学习领域 API，包括消息传递和图采样等操作。                                       |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.hub               | 模型拓展相关的 API，包括 list、load、help 等。                                     |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.incubate          | 飞桨新增功能的孵化目录，实验性 API。                                               |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.io                | 数据输入输出相关 API，包括 Dataset、DataLoader 等。                                |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.jit               | 动态图转静态图相关 API，包括 to_static、                                           |
|                          | not_to_static、save、load 等。                                                     |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.linalg            | 线性代数相关 API，包括 det、svd 等。                                               |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.metric            | 评估指标计算相关的 API，包括 Accuracy、Auc 等。                                    |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.nn                | 组网相关的 API，包括 Linear、卷积 Conv2D、                                         |
|                          | 循环神经网络 RNN、损失函数 CrossEntropyLoss、                                      |
|                          | 激活函数 ReLU 等。                                                                 |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.onnx              | paddle 转换为 onnx 协议相关 API，包括 export 等。                                  |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.optimizer         | 优化算法相关 API，包括 SGD，Adagrad、Adam 等。                                     |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.optimizer.lr      | 学习率衰减相关 API，包括 NoamDecay、StepDecay、                                    |
|                          | PiecewiseDecay 等。                                                                |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.profiler          | 飞桨框架的性能分析器，提供对模型训练和推理过程的性能数据进行展示和统计分析的功能。 |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.random            | 随机数生成相关 API，包括 initial_seed 等。                                         |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.regularizer       | 正则化相关 API，包括 L1Decay、L2Decay 等。                                         |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.signal            | 信号处理领域 API。                                                                 |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.special           | paddle.special 模块是模仿 SciPy 的 special 模块设计的，包含了许多特殊数学函数。    |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.static            | 静态图下基础框架相关 API，包括 Variable、Program、                                 |
|                          | Executor 等。                                                                      |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.static.nn         | 静态图下组网专用 API，包括 全连接层 fc、控制流                                     |
|                          | while_loop/cond。                                                                  |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.sysconfig         | Paddle 系统路径相关 API，包括 get_include、get_lib 等。                            |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.text              | NLP 领域 API，包括 NLP 领域相关的数据集，                                          |
|                          | 如 Imdb、Movielens。                                                               |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.utils             | 工具类相关 API，包括 CppExtension、CUDAExtension 等。                              |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.vision            | 视觉领域 API，包括 数据集 Cifar10、数据处理                                        |
|                          | ColorJitter、常用基础网络结构 ResNet 等。                                          |
+--------------------------+------------------------------------------------------------------------------------+
| paddle.sparse            | 稀疏领域的 API。                                                                   |
+--------------------------+------------------------------------------------------------------------------------+

---

## File: docs/api/index_en.rst

==================
API Reference
==================

PaddlePaddle (PArallel Distributed Deep LEarning) is an efficient, flexible, and extensible deep learning framework, commits to making the innovation and application of deep learning technology easier.

In this version, PaddlePaddle has made many optimizations to the APIs. You can refer to the following table to understand the API directory structure and description of the latest version of PaddlePaddle.In addition, you can refer to PaddlePaddle's `GitHub <https://github.com/PaddlePaddle/Paddle>`_ for details, or read `Release Notes <../release_note_en.html>`_ to learn about the features of the new version.

**The API directory structure of PaddlePaddle is as follows:**

+--------------------------+----------------------------------------------------------------+
|        Directory         |                  Functions and Included APIs                   |
+==========================+================================================================+
| paddle.*                 | The aliases of commonly used APIs are reserved in the          |
|                          | paddle root directory, which currently include all             |
|                          | the APIs in the paddle.tensor, paddle.framework and            |
|                          | paddle.device directories.                                     |
+--------------------------+----------------------------------------------------------------+
| paddle.tensor            | APIs related to tensor operations such as creating             |
|                          | zeros, matrix operation matmul, transforming concat,           |
|                          | computing add, and finding argmax.                             |
+--------------------------+----------------------------------------------------------------+
| paddle.framework         | PaddlePaddle universal APIs and dynamic graph APIs             |
|                          | such as no_grad, save and load.                                |
+--------------------------+----------------------------------------------------------------+
| paddle.amp               | Paddle automatic mixed precision strategy, including           |
|                          | auto_cast, GradScaler, etc.                                    |
+--------------------------+----------------------------------------------------------------+
| paddle.audio             | Audio API, including feature extraction and dataset            |
|                          | operations.                                                    |
+--------------------------+----------------------------------------------------------------+
| paddle.autograd          | Auto grad APIs, including backward, PyLayer, etc.              |
+--------------------------+----------------------------------------------------------------+
| paddle.callbacks         | Paddle log callback APIs, including ModelCheckpoint,           |
|                          | ProgBarLogger, etc.                                            |
+--------------------------+----------------------------------------------------------------+
| paddle.compat            | PyTorch-compatible APIs, with identical calling methods        |
|                          | and behaviors to their PyTorch counterparts.                   |
+--------------------------+----------------------------------------------------------------+
| paddle.cuda              | PyTorch-compatible APIs，                                      |
|                          | including CUDA-related utilities                               |
+--------------------------+----------------------------------------------------------------+
| paddle.device            | Device management related APIs, such as set_device,            |
|                          | get_device, etc.                                               |
+--------------------------+----------------------------------------------------------------+
| paddle.distributed       | Distributed related basic APIs.                                |
+--------------------------+----------------------------------------------------------------+
| paddle.distributed.fleet | Distributed related high-level APIs.                           |
+--------------------------+----------------------------------------------------------------+
| paddle.distribution      | Probability distribution class APIs, including various common  |
|                          | probability distribution.                                      |
+--------------------------+----------------------------------------------------------------+
| paddle.fft               | Fast Fourier Transform related APIs, such as                   |
|                          | fft, fft2, etc.                                                |
+--------------------------+----------------------------------------------------------------+
| paddle.geometric         | APIs for Graph Learning, including message passing,            |
|                          | graph sampling, etc.                                           |
+--------------------------+----------------------------------------------------------------+
| paddle.hub               | Model extension API, including list, load, help, etc.          |
+--------------------------+----------------------------------------------------------------+
| paddle.incubate          | APIs for incubating new features.                              |
+--------------------------+----------------------------------------------------------------+
| paddle.io                | APIs related to data input and output such as                  |
|                          | Dataset, and DataLoader.                                       |
+--------------------------+----------------------------------------------------------------+
| paddle.inference         | APIs related to inference for predictions.                     |
+--------------------------+----------------------------------------------------------------+
| paddle.jit               | Dynamic graph to static graph APIs, including                  |
|                          | to_static, not_to_static, save, load, etc.                     |
+--------------------------+----------------------------------------------------------------+
| paddle.linalg            | Linear algebra related APIs, such as det, svd, etc.            |
+--------------------------+----------------------------------------------------------------+
| paddle.metric            | APIs related to evaluation computation such as                 |
|                          | Accuracy and Auc.                                              |
+--------------------------+----------------------------------------------------------------+
| paddle.nn                | Networking-related APIs such as Linear, Conv2D,                |
|                          | CrossEntropyLoss, RNN，and ReLU, etc.                          |
+--------------------------+----------------------------------------------------------------+
| paddle.onnx              | APIs related to convert paddle model to ONNX，such as          |
|                          | export                                                         |
+--------------------------+----------------------------------------------------------------+
| paddld.optimizer         | APIs related to optimization algorithms such as SGD,           |
|                          | Adagrad, and Adam.                                             |
+--------------------------+----------------------------------------------------------------+
| paddle.optimizer.lr      | APIs related to learning rate decay, such as                   |
|                          | NoamDecay, StepDecay, PiecewiseDecay, etc.                     |
+--------------------------+----------------------------------------------------------------+
| paddle.profiler          | Performance profiler APIs for the Paddle framework,            |
|                          | providing functionality to display and analyze                 |
|                          | performance for model training and inference processes.        |
+--------------------------+----------------------------------------------------------------+
| paddle.random            | Random number generation related APIs, including initial_seed. |
+--------------------------+----------------------------------------------------------------+
| paddle.quantization      | Quantization related APIs.                                     |
+--------------------------+----------------------------------------------------------------+
| paddle.regularizer       | Regularization APIs, including L1Decay, L2Decay, etc.          |
+--------------------------+----------------------------------------------------------------+
| paddle.signal            | APIs for signal processing.                                    |
+--------------------------+----------------------------------------------------------------+
| paddle.sparse            | The Sparse domain API.                                         |
+--------------------------+----------------------------------------------------------------+
| paddle.static            | Basic framework related APIs under static graph,               |
|                          | such as Variable, Program, Executor, etc.                      |
+--------------------------+----------------------------------------------------------------+
| paddle.static.nn         | Special APIs for networking under static graph such            |
|                          | as full connect layer fc and control flow                      |
|                          | while_loop/cond.                                               |
+--------------------------+----------------------------------------------------------------+
| paddle.sysconfig         | System configuration APIs, such as get_include, get_lib.       |
+--------------------------+----------------------------------------------------------------+
| paddle.text              | The NLP domain API currently includes data sets                |
|                          | related to the NLP domain, such as Imdb and Movielens.         |
+--------------------------+----------------------------------------------------------------+
| paddle.utils             | Utils APIs, including CppExtension, CUDAExtension.             |
+--------------------------+----------------------------------------------------------------+
| paddle.vision            | Vision domain APIs such as datasets Cifar10,                   |
|                          | data processing ColorJitter, and commonly used models          |
|                          | like resnet.                                                   |
+--------------------------+----------------------------------------------------------------+

---

## File: docs/api/paddle/_assert_cn.rst

.. _cn_api_paddle__assert:

_assert
-------------------------------

.. py:function:: paddle._assert(condition, message="")

对 Python assert 的封装，支持符号追踪。

在动态图模式下，该函数的行为与 Python 的 assert 语句一致。在静态图模式下，当 condition 是 Tensor 时，会在计算图中创建一个 Assert 算子。

参数
::::::::::::
    - **condition** (bool|Tensor) - 断言的条件。如果是 Tensor，必须是布尔标量（numel=1）。
    - **message** (str，可选) - 断言失败时显示的错误信息。默认值为 ""。

代码示例
::::::::::::

.. code-block:: pycon

    >>> import paddle
    >>> # Non-tensor condition
    >>> paddle._assert(1 == 1, "This should pass")

    >>> # Tensor condition
    >>> x = paddle.to_tensor([True])
    >>> paddle._assert(x, "Tensor assertion")

---

## File: docs/api/paddle/abs__cn.rst

.. _cn_api_paddle_abs_:

abs\_
-------------------------------

.. py:function:: paddle.abs_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_abs` API，对输入 x 采用 Inplace 策略。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x`` 。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/abs_cn.rst

.. _cn_api_paddle_abs:

abs
-------------------------------

.. py:function:: paddle.abs(x, name=None)




绝对值函数。

.. math::
    out = |x|

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：int32、int64、float16、float32、float64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.abs

---

## File: docs/api/paddle/acos__cn.rst

.. _cn_api_paddle_acos_:

acos\_
-------------------------------

.. py:function:: paddle.acos_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_acos` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/acos_cn.rst

.. _cn_api_paddle_acos:

acos
-------------------------------

.. py:function:: paddle.acos(x, name=None, *, out=None)




arccosine 函数。

.. math::
    out = cos^{-1}(x)

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** (Tensor，可选)- 输出的结果。该参数为仅关键字参数，默认值为 None。

返回
:::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。


代码示例
:::::::::
COPY-FROM: paddle.acos

---

## File: docs/api/paddle/acosh__cn.rst

.. _cn_api_paddle_acosh_:

acosh\_
-------------------------------

.. py:function:: paddle.acosh_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_acosh` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/acosh_cn.rst

.. _cn_api_paddle_acosh:

acosh
-------------------------------

.. py:function:: paddle.acosh(x, name=None, *, out=None)




Arccosh 函数。

.. math::
    out = acosh(x)

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** (Tensor，可选)- 输出的结果。该参数为仅关键字参数，默认值为 None。

返回
:::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。



代码示例
:::::::::

COPY-FROM: paddle.acosh

---

## File: docs/api/paddle/add__cn.rst

.. _cn_api_paddle_add_:

add\_
-------------------------------

.. py:function:: paddle.add_(x)
Inplace 版本的 :ref:`cn_api_paddle_add` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/add_cn.rst

.. _cn_api_paddle_add:

add
-------------------------------

.. py:function:: paddle.add(x, y, name=None, *, alpha=1, out=None)



逐元素相加算子，输入 ``x`` 与输入 ``y`` 逐元素相加，并将各个位置的输出元素保存到返回结果中。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，参数名 ``other`` 可替代 ``y`` ，如 ``add(input=tensor_x, other=tensor_y, ...)`` 等价于 ``add(x=tensor_x, y=tensor_y, ...)`` 。
    输入 ``x`` 与输入 ``y`` 必须和广播为相同形状，关于广播规则，请参见 `Tensor 介绍`_ .

        .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7


等式为：

.. math::
        Out = X + alpha \times Y

- :math:`X`：多维 Tensor。
- :math:`Y`：多维 Tensor。

以下情况使用该算子，该情况为：
1. ``X`` 与 ``Y`` 的形状一样。
2. ``Y`` 的形状是 ``X`` 的一部分连续的形状。


参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：bool、bfloat16、float16、float32、float64、int8、int16、int32、int64、uint8、complex64、complex128。
      ``别名: input``
    - **y** (Tensor) - 输入的 Tensor，数据类型为：bool、bfloat16、float16、float32、float64、int8、int16、int32、int64、uint8、complex64、complex128。
      ``别名: other``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **alpha** (Number, 可选) - 对 ``y`` 的缩放因子，默认值为 1。
    - **out** (Tensor, 可选) - 输出 Tensor，默认值为 None。

返回
:::::::::
多维 Tensor，数据类型与 ``x`` 相同，维度为广播后的形状。


代码示例
:::::::::

COPY-FROM: paddle.add

---

## File: docs/api/paddle/add_n_cn.rst

[Binary file]

---

## File: docs/api/paddle/addmm__cn.rst

.. _cn_api_paddle_addmm_:

addmm\_
-------------------------------

.. py:function:: paddle.addmm_(input, x, y, beta=1.0, alpha=1.0, name=None)
Inplace 版本的 :ref:`cn_api_paddle_addmm` API，对输入 ``input`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/addmm_cn.rst

[Binary file]

---

## File: docs/api/paddle/addmv_cn.rst

.. _cn_api_paddle_addmv:

addmv
-------------------------------

.. py:function:: paddle.addmv(input, mat, vec, beta=1, alpha=1, name=None, *, out=None)

执行矩阵 ``mat`` 和向量 ``vec`` 的矩阵-向量乘法，并将其加到输入 Tensor 上。

公式为：out = beta * input + alpha * (mat @ vec)

参数
:::::::::
    - **input** (Tensor) - 待加的输入 Tensor。
    - **mat** (Tensor) - 待乘的矩阵。
    - **vec** (Tensor) - 待乘的向量。
    - **beta** (float，可选) - input 的乘数，默认值为 1。
    - **alpha** (float，可选) - mat @ vec 的乘数，默认值为 1。
    - **name** (str，可选) - 操作名称，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
Tensor：计算结果 Tensor。

代码示例
:::::::::

COPY-FROM: paddle.addmv

---

## File: docs/api/paddle/addr_cn.rst

.. _cn_api_paddle_addr:

addr
-------------------------------

.. py:function:: paddle.addr(input, vec1, vec2, beta=1, alpha=1, name=None, *, out=None)

执行向量 ``vec1`` 和向量 ``vec2`` 的外积，并将其加到输入矩阵上。

公式为：out = beta * input + alpha * (vec1 outer vec2)

参数
:::::::::
    - **input** (Tensor) - 待加的输入 Tensor。
    - **vec1** (Tensor) - 第一个向量。
    - **vec2** (Tensor) - 第二个向量。
    - **beta** (float，可选) - input 的乘数，默认值为 1。
    - **alpha** (float，可选) - 外积的乘数，默认值为 1。
    - **name** (str，可选) - 操作名称，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
Tensor：计算结果 Tensor。

代码示例
:::::::::

COPY-FROM: paddle.addr

---

## File: docs/api/paddle/all_cn.rst

.. _cn_api_paddle_all:

all
-------------------------------

.. py:function:: paddle.all(x, axis=None, keepdim=False, name=None, *, out=None)

对指定维度上的 Tensor 元素进行逻辑与运算，并输出相应的计算结果。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``， ``dim`` 可替代 ``axis``。

参数
:::::::::
    - **x** （Tensor）- 输入变量为多维 Tensor，数据类型为 bool、float32、float64、int32、int64。
      别名： ``input``
    - **axis** （int | list | tuple，可选）- 计算逻辑与运算的维度。如果为 None，则计算所有元素的逻辑与并返回包含单个元素的 Tensor 变量，否则必须在 :math:`[−rank(x),rank(x)]` 范围内。如果 :math:`axis [i] <0`，则维度将变为 :math:`rank+axis[i]`，默认值为 None。
      别名： ``dim``
    - **keepdim** (bool，可选) - 是否在输出 Tensor 中保留减小的维度。除非 keepdim 为 True，否则输出 Tensor 的维度将比输入 Tensor 小一维，默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** （Tensor，可选） - 指定输出结果的 ``Tensor``，默认值为 None。

返回
:::::::::
  Tensor，在指定维度上进行逻辑与运算的 Tensor，数据类型和输入数据类型一致。


代码示例
:::::::::

COPY-FROM: paddle.all

---

## File: docs/api/paddle/allclose_cn.rst

.. _cn_api_paddle_allclose:

allclose
-------------------------------

.. py:function:: paddle.allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name=None)

逐个检查 x 和 y 的所有元素是否均满足如下条件：

..  math::
    \left| x - y \right| \leq atol + rtol \times \left| y \right|

该 API 的行为类似于 :math:`numpy.allclose`，即当两个待比较 Tensor 的所有元素均在一定容忍误差范围内视为相等则该 API 返回 True 值。

参数
::::::::::::

    - **x** (Tensor) - 输入的 ``Tensor``，数据类型为：float16、float32、float64。别名 ``input``。
    - **y** (Tensor) - 输入的 ``Tensor``，数据类型为：float16、float32、float64。别名 ``other``。
    - **rtol** (float，可选) - 相对容忍误差，默认值为 1e-5。
    - **atol** (float，可选) - 绝对容忍误差，默认值为 1e-8。
    - **equal_nan** (bool，可选) - 如果设置为 True，则两个 NaN 数值将被视为相等，默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
计算得到的布尔类型单值 Tensor。

代码示例
::::::::::::

COPY-FROM: paddle.allclose

---

## File: docs/api/paddle/amax_cn.rst

[Binary file]

---

## File: docs/api/paddle/amin_cn.rst

[Binary file]

---

## File: docs/api/paddle/angle_cn.rst

.. _cn_api_paddle_angle:

angle
-------------------------------

.. py:function:: paddle.angle(x, name=None, *, out=None)


逐元素计算复数的相位角。对于非负实数，相位角为 0，而对于负实数，相位角为 :math:`\pi`。

.. math::

    angle(x) = arctan2(x.imag, x.real)

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：complex64, complex128 或 float32, float64。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 ``None``。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
输出实数 Tensor，与 ``x`` 的数值精度一致。

代码示例
:::::::::

COPY-FROM: paddle.angle

---

## File: docs/api/paddle/any_cn.rst

.. _cn_api_paddle_any:

any
-------------------------------

.. py:function:: paddle.any(x, axis=None, keepdim=False, name=None, *, out=None)

对指定维度上的 Tensor 元素进行逻辑或运算，并输出相应的计算结果。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，参数名 ``dim`` 可替代 ``axis``，如 ``any(input=tensor_x, dim=1, ...)`` 等价于 ``any(x=tensor_x, axis=1, ...)``。

参数
:::::::::
    - **x** (Tensor) - 输入变量为多维 Tensor，数据类型为 bool、float32、float64、int32、int64。别名： ``input``。
    - **axis** (int|list|tuple，可选) - 计算逻辑或运算的维度。如果为 None，则计算所有元素的逻辑或并返回包含单个元素的 Tensor，否则必须在 :math:`[−rank(x),rank(x)]` 范围内。如果 :math:`axis [i] <0`，则维度将变为 :math:`rank+axis[i]`，默认值为 None。别名： ``dim``。
    - **keepdim** (bool，可选) - 是否在输出 Tensor 中保留输入的维度。除非 keepdim 为 True，否则输出 Tensor 的维度将比输入 Tensor 小一维，默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 输出 Tensor。默认值为 None。

返回
:::::::::
  Tensor，在指定维度上进行逻辑或运算的 Tensor，数据类型和输入数据类型一致。


代码示例
:::::::::

COPY-FROM: paddle.any

---

## File: docs/api/paddle/arange_cn.rst

[Binary file]

---

## File: docs/api/paddle/argmax_cn.rst

[Binary file]

---

## File: docs/api/paddle/argmin_cn.rst

[Binary file]

---

## File: docs/api/paddle/argsort_cn.rst

[Binary file]

---

## File: docs/api/paddle/argwhere_cn.rst

.. _cn_api_paddle_argwhere:

argwhere
-------------------------------

.. py:function:: paddle.argwhere(input)




返回输入 ``x`` 中非零元素的坐标。如果输入 ``x`` 有 ``n`` 维，共包含 ``z`` 个非零元素，返回结果是一个 ``shape`` 等于 ``[z x n]`` 的 ``Tensor``，第 ``i`` 行代表输入中第 ``i`` 个非零元素的坐标。

参数
:::::::::

    - **input** （Tensor）– 输入的 Tensor。



返回
:::::::::
    - **Tensor(1-D Tensor)**，数据类型为 **INT64** 。



代码示例
:::::::::

COPY-FROM: paddle.argwhere

---

## File: docs/api/paddle/as_complex_cn.rst

[Binary file]

---

## File: docs/api/paddle/as_real_cn.rst

.. _cn_api_paddle_as_real:

as_real
-------------------------------

.. py:function:: paddle.as_real(x, name=None)


将复数 Tensor 转为实数 Tensor。

输入 Tensor 的数据类型是 'complex64' 或者 'complex128'，输出 Tensor 的数据类型相应为 'float32' 或者 'float64'。

输入 Tensor 的形状是 ``(*,)`` (其中 ``*`` 表示任意形状)，输出 Tensor 的形状是 ``(*, 2)``，亦即，输出的形状是在输入形状后附加一个 ``2``，因为一个复数的实部和虚部分别表示为一个实数。

下图展示了一个 as_real 简单的使用情形。一个形状为[2, 3]的复数 Tensor 经过 as_real 转换，拆分出一个长度为 2 的维度，形状变为[2, 3, 2]。

.. figure:: ../../images/api_legend/as_real.png
   :alt: as_real 图示
   :width: 500
   :align: center

参数
:::::::::
    - **x** (Tensor) - 输入 Tensor，数据类型为：'complex64' 或 'complex128'。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
输出 Tensor，数据类型是 'float32' 或 'float64'，与 ``x`` 的数值精度一致。

代码示例
:::::::::

COPY-FROM: paddle.as_real

---

## File: docs/api/paddle/as_strided_cn.rst

[Binary file]

---

## File: docs/api/paddle/as_tensor_cn.rst

.. _cn_api_paddle_as_tensor:

as_tensor
-------------------------------

.. py:function:: paddle.as_tensor(data, dtype=None, device=None, requires_grad=False, pin_memory=False)

``paddle.tensor`` 的别名，详细参考 :ref:`cn_api_paddle_tensor`。

---

## File: docs/api/paddle/asin__cn.rst

.. _cn_api_paddle_asin_:

asin\_
-------------------------------

.. py:function:: paddle.asin_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_asin` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/asin_cn.rst

.. _cn_api_paddle_asin:

asin
-------------------------------

.. py:function:: paddle.asin(x, name=None)




arcsine 函数。

.. math::
    out = sin^{-1}(x)

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32, float64, float16, bfloat16,
      uint8, int8, int16, int32, int64, complex64 or complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同（整数类型自动转换为 float32 类型）。

代码示例
::::::::::::

COPY-FROM: paddle.asin

---

## File: docs/api/paddle/asinh__cn.rst

.. _cn_api_paddle_asinh_:

asinh\_
-------------------------------

.. py:function:: paddle.asinh_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_asinh` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/asinh_cn.rst

.. _cn_api_paddle_asinh:

asinh
-------------------------------

.. py:function:: paddle.asinh(x, name=None, *, out=None)

Arcsinh 函数。

.. math::
    out = asinh(x)

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64、complex64、complex128。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。



代码示例
:::::::::

COPY-FROM: paddle.asinh

---

## File: docs/api/paddle/assign_cn.rst

.. _cn_api_paddle_assign:

assign
-------------------------------

.. py:function:: paddle.assign(x, output=None)




将输入数据拷贝至输出 Tensor。

参数
::::::::::::

    - **x** (Tensor|np.ndarray|list|tuple|scalar) - 输入 Tensor，或 numpy 数组，或由基本数据组成的 list/tuple，或基本数据，支持数据类型为 float32、float64、int32、int64 和 bool。注意：由于当前框架的 protobuf 传输数据限制，float64 数据会被转化为 float32 数据。
    - **output** (Tensor，可选) - 输出 Tensor。如果为 None，则创建一个新的 Tensor 作为输出 Tensor。默认值为 None。

返回
::::::::::::
Tensor，形状、数据类型和值与 ``x`` 一致。


代码示例
::::::::::::

COPY-FROM: paddle.assign

---

## File: docs/api/paddle/atan2_cn.rst

[Binary file]

---

## File: docs/api/paddle/atan__cn.rst

.. _cn_api_paddle_atan_:

atan\_
-------------------------------

.. py:function:: paddle.atan_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_atan` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/atan_cn.rst

.. _cn_api_paddle_atan:

atan
-------------------------------

.. py:function:: paddle.atan(x, name=None, *, out=None)




arctangent 函数。

.. math::
    out = tan^{-1}(x)

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64、float16、complex64、complex128。别名 ``input`` 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.atan

---

## File: docs/api/paddle/atanh__cn.rst

.. _cn_api_paddle_atanh_:

atanh\_
-------------------------------

.. py:function:: paddle.atanh_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_atanh` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/atanh_cn.rst

.. _cn_api_paddle_atanh:

atanh
-------------------------------

.. py:function:: paddle.atanh(x, name=None, *, out=None)

Arctanh 函数。

.. math::
    out = atanh(x)

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** (Tensor，可选)- 输出的结果。该参数为仅关键字参数，默认值为 None。

返回
:::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。



代码示例
:::::::::

COPY-FROM: paddle.atanh

---

## File: docs/api/paddle/atleast_1d_cn.rst

.. _cn_api_paddle_atleast_1d:

atleast_1d
-------------------------------

.. py:function:: paddle.atleast_1d(*inputs, name=None)

将输入转换为张量并返回至少为 ``1`` 维的视图。标量输入会被转换， ``1`` 维或更高维的输入则会被保留。

参数
::::::::::::

    - **inputs** (Tensor|list(Tensor)) - 一个或多个 Tensor，支持可变参数用法，数据类型为： ``float16``, ``float32``, ``float64``, ``int16``, ``int32``, ``int64``, ``int8``, ``uint8``, ``complex64``, ``complex128``, ``bfloat16`` 或 ``bool``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor 或者由 Tensor 组成的 list。当只有一个输入的时候返回一个 Tensor，当有多个输入的时候返回由 Tensor 组成的 list。

代码示例
::::::::::::

COPY-FROM: paddle.atleast_1d

---

## File: docs/api/paddle/atleast_2d_cn.rst

.. _cn_api_paddle_atleast_2d:

atleast_2d
-------------------------------

.. py:function:: paddle.atleast_2d(*inputs, name=None)

将输入转换为张量并返回至少为 ``2`` 维的视图。 ``2`` 维或更高维的输入会被保留。

下图分别展示了 ``atleast_2d`` 在不同数据类型下，对 1 个 ``0`` 维张量输入、1 个 ``0`` 维张量输入和 1 个 ``1`` 维张量输入，以及 1 个 ``0`` 维张量输入和 1 个 ``3`` 维张量输入，将其返回为至少为 ``2`` 维视图的张量或张量 list 的情形。

.. image:: ../../images/api_legend/atleast_2d.png
   :width: 600
   :alt: 图例

参数
::::::::::::

    - **inputs** (Tensor|list(Tensor)) - 一个或多个 Tensor，支持可变参数用法，数据类型为： ``float16``, ``float32``, ``float64``, ``int16``, ``int32``, ``int64``, ``int8``, ``uint8``, ``complex64``, ``complex128``, ``bfloat16`` 或 ``bool``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor 或者由 Tensor 组成的 list。当只有一个输入的时候返回一个 Tensor，当有多个输入的时候返回由 Tensor 组成的 list。

代码示例
::::::::::::

COPY-FROM: paddle.atleast_2d

---

## File: docs/api/paddle/atleast_3d_cn.rst

.. _cn_api_paddle_atleast_3d:

atleast_3d
-------------------------------

.. py:function:: paddle.atleast_3d(*inputs, name=None)

将输入转换为张量并返回至少为 ``3`` 维的视图。 ``3`` 维或更高维的输入会被保留。

参数
::::::::::::

    - **inputs** (Tensor|list(Tensor)) - 一个或多个 Tensor，支持可变参数用法，数据类型为： ``float16``, ``float32``, ``float64``, ``int16``, ``int32``, ``int64``, ``int8``, ``uint8``, ``complex64``, ``complex128``, ``bfloat16`` 或 ``bool``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor 或者由 Tensor 组成的 list。当只有一个输入的时候返回一个 Tensor，当有多个输入的时候返回由 Tensor 组成的 list。

代码示例
::::::::::::

COPY-FROM: paddle.atleast_3d

---

## File: docs/api/paddle/autocast_cn.rst

.. _cn_api_paddle_autocast:

autocast
-------------------------------

.. py:function:: paddle.autocast(device_type, dtype='float16', enabled=True, cache_enabled =True)

``paddle.amp.autocast`` 的别名，请参考 :ref:`cn_api_paddle_amp_autocast`。

---

## File: docs/api/paddle/baddbmm__cn.rst

.. _cn_api_paddle_baddbmm_:

baddbmm\_
-------------------------------

.. py:function:: paddle.baddbmm_(input, x, y, beta=1.0, alpha=1.0, out_dtype=None, name=None)

Inplace 版本的 :ref:`cn_api_paddle_baddbmm` API，对输入 ``input`` 采用 Inplace 策略。
更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/baddbmm_cn.rst

.. _cn_api_paddle_baddbmm:

baddbmm
-------------------------------

.. py:function:: paddle.baddbmm(input, x, y, beta=1.0, alpha=1.0, out_dtype=None, name=None, *, out=None)

计算 x 和 y 的批量矩阵乘积，将结果乘以标量 alpha，再加上 input 与标量 beta 的乘积，得到输出。其中 input 与 x、y 乘积的维度必须是可广播的。

计算过程的公式为：

..  math::
    out = \beta \times input + \alpha \times x \times y
其中 :math:`\beta` 和 :math:`\alpha` 是缩放因子。

..  note::
    别名支持: 参数名 ``batch1`` 可替代 ``x``，参数名 ``batch2`` 可替代 ``y`` ，如 ``baddbmm(input=tensor_input, batch1=tensor_x, batch2=tensor_y, ...)`` 等价于 ``baddbmm(input=tensor_input, x=tensor_x, y=tensor_y, ...)`` 。

参数
::::::::::::
    - **input** (Tensor) - 输入 Tensor input，必须是一个 2 维或 3 维张量，数据类型支持 bfloat16、float16、float32、float64。
    - **x** (Tensor) - 输入 Tensor x，必须是一个形状为 [b, n, p] 的 3 维张量，数据类型支持 bfloat16、float16、float32、float64。
      ``别名：batch1``
    - **y** (Tensor) - 输入 Tensor y，必须是一个形状为 [b, p, m] 的 3 维张量，数据类型支持 bfloat16、float16、float32、float64。
      ``别名：batch2``
    - **beta** (float，可选) - 乘以 input 的标量，数据类型支持 float，默认值为 1.0。
    - **alpha** (float，可选) - 乘以 x*y 的标量，数据类型支持 float，默认值为 1.0。
    - **out_dtype** (paddle.dtype, 可选) - 输出数据类型，默认值为 None，表示输出数据类型与输入 input 数据类型一致。支持设置为以下数据类型：float16、bfloat16、float32、float64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
计算得到的 Tensor。Tensor 数据类型与输入 input 数据类型一致。

代码示例
::::::::::::

COPY-FROM: paddle.baddbmm

---

## File: docs/api/paddle/batch_cn.rst

.. _cn_api_paddle_batch:

batch
-------------------------------

.. py:function:: paddle.batch(reader, batch_size, drop_last=False)

一个 reader 的装饰器。返回的 reader 将输入 reader 的数据打包成指定的 batch_size 大小的批处理数据（batched data）。

.. warning::
    不推荐使用这个 API，如有数据加载需求推荐使用支持多进程并发加速的 ``paddle.io.DataLoader``

参数
::::::::::::

    - **reader** (generator)- 读取数据的数据 reader。
    - **batch_size** (int)- 批尺寸。
    - **drop_last** (bool) - 若设置为 True，则当最后一个 batch 不等于 batch_size 时，丢弃最后一个 batch；若设置为 False，则不会。默认值为 False。

返回
::::::::::::
batched reader


代码示例
::::::::::::

COPY-FROM: paddle.batch

---

## File: docs/api/paddle/bernoulli__cn.rst

.. _cn_api_paddle_bernoulli_:

bernoulli\_
-------------------------------

.. py:function:: paddle.bernoulli_(x, p=0.5, name=None)

Inplace 版本的 :ref:`cn_api_paddle_bernoulli` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

.. note::

    参数名 ``input`` 可替代 ``x``，如 ``bernoulli_(input=tensor_x)`` 等价于 ``bernoulli_(x=tensor_x)``。

---

## File: docs/api/paddle/bernoulli_cn.rst

[Binary file]

---

## File: docs/api/paddle/bincount_cn.rst

.. _cn_api_paddle_bincount:

bincount
-------------------------------

.. py:function:: paddle.bincount(x, weights=None, minlength=0, name=None)

统计输入 Tensor 中每个元素出现的次数，如果传入 weights Tensor 则每次计数加一时会乘以 weights Tensor 对应的值。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor。必须是一维 Tensor，其中元素必须大于等于 0，数据类型为 int32, int64。别名 ``input`` 。
    - **weights** (Tensor，可选) - weights Tensor，代表输入 Tensor 中每个元素的权重。长度必须与输入 Tensor 相同。数据类型为 int32, int64, float32 或 float64。默认为 None
    - **minlength** (int，可选) - 输出 Tensor 的最小长度，如果大于输入 Tensor 中的最大值，则多出的位置补 0。该值必须大于等于 0。默认为 0。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，维度为 1。

代码示例
::::::::::::

COPY-FROM: paddle.bincount

---

## File: docs/api/paddle/binomial_cn.rst

.. _cn_api_paddle_binomial:

binomial
-------------------------------

.. py:function:: paddle.binomial(count, prob, name=None)

以输入参数 ``count`` 和 ``prob`` 分别为二项分布的 ``n`` 和 ``p`` 参数，生成一个二项分布的随机数 Tensor ，支持 Tensor 形状广播。输出 Tensor 的 dtype 为 ``int64`` 。

.. math::

        out_i \sim Binomial (n = count_i, p = prob_i)

参数
::::::::::::

    - **count** (Tensor) - Tensor 的每个元素代表一个二项分布的总试验次数。数据类型支持 ``int32`` 、``int64`` 。
    - **prob** (Tensor) - Tensor 的每个元素代表一个二项分布的试验成功概率。数据类型支持 ``bfloat16`` 、``float16`` 、``float32`` 、``float64`` 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::

    Tensor，二项分布采样得到的随机 Tensor，形状为 ``count`` 和 ``prob`` 进行广播后的 Tensor 形状， dtype 为 ``int64`` 。


代码示例
::::::::::::

COPY-FROM: paddle.binomial

---

## File: docs/api/paddle/bitwise_and__cn.rst

.. _cn_api_paddle_bitwise_and_:

bitwise\_and\_
-------------------------------

.. py:function:: paddle.bitwise_and_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_bitwise_and` API，对输入 ``x`` 采用 Inplace 策略。

参数
::::::::::::
    - **x** (Tensor) - 输入的 Tensor。别名 ``input``。
    - **y** (Tensor) - 输入的 Tensor。别名 ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/bitwise_and_cn.rst

.. _cn_api_paddle_bitwise_and:

bitwise_and
-------------------------------

.. py:function:: paddle.bitwise_and(x, y, name=None, *, out=None)

对 Tensor ``x`` 和 ``y`` 逐元素进行 ``按位与`` 运算。

.. math::
        Out = X \& Y

.. note::
    ``paddle.bitwise_and`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7
参数
::::::::::::
        - **x** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：bool，uint8，int8，int16，int32，int64。别名 ``input``。
        - **y** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：bool，uint8，int8，int16，int32，int64。别名 ``other``。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
        - **out** （Tensor，可选）- 输出的结果 ``Tensor``，是与输入数据类型相同的 N-D ``Tensor``。默认值为 None，此时将创建新的 Tensor 来保存输出结果。

返回
::::::::::::
 ``按位与`` 运算后的结果 ``Tensor``，数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.bitwise_and

---

## File: docs/api/paddle/bitwise_invert__cn.rst

.. _cn_api_paddle_bitwise_invert_:

bitwise\_invert\_
-------------------------------

.. py:function:: paddle.bitwise_invert_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_bitwise_invert` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/bitwise_invert_cn.rst

.. _cn_api_paddle_bitwise_invert:

bitwise_invert
-------------------------------

.. py:function:: paddle.bitwise_invert(x, out=None, name=None)

对 Tensor ``x`` 逐元素进行 ``按位取反`` 运算。

.. math::
       Out = \sim X

.. note::
       ``bitwise_invert`` 和 ``bitwise_not`` 执行相同的操作，功能等效。

参数
::::::::::::

        - **x** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：bool，uint8，int8，int16，int32，int64。
        - **out** （Tensor，可选）- 输出的结果 ``Tensor``，是与输入数据类型相同的 N-D ``Tensor``。默认值为 None，此时将创建新的 Tensor 来保存输出结果。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
 ``按位取反`` 运算后的结果 ``Tensor``，数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.bitwise_invert

---

## File: docs/api/paddle/bitwise_left_shift__cn.rst

[Binary file]

---

## File: docs/api/paddle/bitwise_left_shift_cn.rst

.. _cn_api_paddle_bitwise_left_shift:

bitwise_left_shift
-------------------------------

.. py:function:: paddle.bitwise_left_shift(x, y, is_arithmetic=True, out=None, name=None)

对 Tensor ``x`` 和 ``y`` 逐元素进行 ``按位算术(或逻辑)左移`` 运算。

关于 **有符号数的符号位** 在不同情景下的行为：
  1. 算术左移时，符号位同其他位一样，一起左移，右边补 0；
  2. 逻辑左移时，符号位同其他位一样，一起左移，右边补 0；
  3. 算术右移时，符号位同其他位一样，一起右移，左边补符号位；
  4. 逻辑右移时，符号位同其他位一样，一起右移，左边补 0；

.. note::
    当有符号数左移发生溢出时，其值不可控，可能会在左移时突然变号，这是因为在左移时，有符号数的符号位同样进行左移，会导致符号位右侧的值不断成为符号位，例如

    example1:

    .. code-block:: text

        int8_t x = -45; // 补码为 1101,0011      表示-45

        int8_t y = x << 2;   //补码为 0100,1100  表示 76

        int8_t z = x << 3;   //补码为 1001,1000  表示-104

    example2:

    .. code-block:: text

        int8_t x = -86; // 补码为 1010,1010      表示-86

        int8_t y = x << 1;   //补码为 0101,0100  表示 84

        int8_t z = x << 2;   //补码为 1010,1000  表示-88

    以上为溢出导致的符号突变。

.. math::
        Out = X \ll Y

.. note::
    ``paddle.bitwise_left_shift`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7
参数
::::::::::::

        - **x** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：uint8，int8，int16，int32，int64。别名 ``input``。
        - **y** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：uint8，int8，int16，int32，int64。别名 ``other``。
        - **is_arithmetic** （bool） - 用于表明是否执行算术位移，True 表示算术位移，False 表示逻辑位移。默认值为 True，表示算术位移。
        - **out** （Tensor，可选）- 输出的结果 ``Tensor``，是与输入数据类型相同的 N-D ``Tensor``。默认值为 None，此时将创建新的 Tensor 来保存输出结果。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
::::::::::::
 ``按位算术(逻辑)左移`` 运算后的结果 ``Tensor``，数据类型与 ``x`` 相同。

代码示例 1
::::::::::::

算术左移

COPY-FROM: paddle.bitwise_left_shift:bitwise_left_shift_example1

代码示例 2
::::::::::::

逻辑左移

COPY-FROM: paddle.bitwise_left_shift:bitwise_left_shift_example2

---

## File: docs/api/paddle/bitwise_not__cn.rst

.. _cn_api_paddle_bitwise_not_:

bitwise\_not\_
-------------------------------

.. py:function:: paddle.bitwise_not_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_bitwise_not` API，对输入 ``x`` 采用 Inplace 策略。

参数
::::::::::::
    - **x** (Tensor) - 输入的 Tensor。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/bitwise_not_cn.rst

.. _cn_api_paddle_bitwise_not:

bitwise_not
-------------------------------

.. py:function:: paddle.bitwise_not(x, name=None, *, out=None)

对 Tensor ``x`` 逐元素进行 ``按位取反`` 运算。

.. math::
       Out = \sim X

.. note::
    ``paddle.bitwise_not`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
::::::::::::
        - **x** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：bool，uint8，int8，int16，int32，int64。别名 ``input``。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
        - **out** （Tensor，可选）- 输出的结果 ``Tensor``，是与输入数据类型相同的 N-D ``Tensor``。默认值为 None，此时将创建新的 Tensor 来保存输出结果。

返回
::::::::::::
 ``按位取反`` 运算后的结果 ``Tensor``，数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.bitwise_not

---

## File: docs/api/paddle/bitwise_or__cn.rst

.. _cn_api_paddle_bitwise_or_:

bitwise\_or\_
-------------------------------

.. py:function:: paddle.bitwise_or_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_bitwise_or` API，对输入 ``x`` 采用 Inplace 策略。

参数
::::::::::::
    - **x** (Tensor) - 输入的 Tensor。别名 ``input``。
    - **y** (Tensor) - 输入的 Tensor。别名 ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/bitwise_or_cn.rst

[Binary file]

---

## File: docs/api/paddle/bitwise_right_shift__cn.rst

.. _cn_api_paddle_bitwise_right_shift_:

bitwise_right_shift\_
-------------------------------

.. py:function:: paddle.bitwise_right_shift_(x, y, is_arithmetic=True, name=None)

Inplace 版本的 :ref:`cn_api_paddle_bitwise_right_shift` API，对输入 ``x`` 采用 Inplace 策略。

参数
::::::::::::

        - **x** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：uint8，int8，int16，int32，int64。别名 ``input``。
        - **y** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：uint8，int8，int16，int32，int64。别名 ``other``。
        - **is_arithmetic** （bool） - 用于表明是否执行算术位移，True 表示算术位移，False 表示逻辑位移。默认值为 True，表示算术位移。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/bitwise_right_shift_cn.rst

[Binary file]

---

## File: docs/api/paddle/bitwise_xor__cn.rst

.. _cn_api_paddle_bitwise_xor_:

bitwise_xor\_
-------------------------------

.. py:function:: paddle.bitwise_xor_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_bitwise_xor` API，对输入 ``x`` 采用 Inplace 策略。

参数
::::::::::::
    - **x** (Tensor) - 输入的 Tensor。别名 ``input``。
    - **y** (Tensor) - 输入的 Tensor。别名 ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/bitwise_xor_cn.rst

.. _cn_api_paddle_bitwise_xor:

bitwise_xor
-------------------------------

.. py:function:: paddle.bitwise_xor(x, y, name=None, *, out=None)

对 Tensor ``x`` 和 ``y`` 逐元素进行 ``按位异或`` 运算。

.. math::
        Out = X ^\wedge Y

.. note::
    ``paddle.bitwise_xor`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
::::::::::::
        - **x** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：bool，uint8，int8，int16，int32，int64。别名 ``input``。
        - **y** （Tensor）- 输入的 N-D ``Tensor``，数据类型为：bool，uint8，int8，int16，int32，int64。别名 ``other``。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
        - **out** （Tensor，可选）- 输出的结果 ``Tensor``，是与输入数据类型相同的 N-D ``Tensor``。默认值为 None，此时将创建新的 Tensor 来保存输出结果。

返回
::::::::::::
 ``按位异或`` 运算后的结果 ``Tensor``，数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.bitwise_xor

---

## File: docs/api/paddle/block_diag_cn.rst

.. _cn_api_paddle_block_diag:

block_diag
-------------------------------

.. py:function:: paddle.block_diag(inputs, name=None)

根据输入的张量创建块对角矩阵。

本 API 支持两种调用方式：

1. **Paddle 风格**： ``paddle.block_diag(inputs, name=None)``
   使用张量序列作为输入。

2. **PyTorch 风格**： ``paddle.block_diag(*tensors)``
   使用可变数量的张量参数。

参数
:::::::::
    - **inputs**  (list|tuple) - 张量列表或张量元组，其子项为 0、1、2 维的 Tensor。数据类型为： ``bool``、 ``float16``、 ``float32``、 ``float64``、 ``uint8``、 ``int8``、 ``int16``、 ``int32``、 ``int64``、 ``bfloat16``、 ``complex64``、 ``complex128``。
    - **name**  (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 ``None``。

返回
:::::::::

Tensor， 与 ``inputs`` 数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.block_diag

---

## File: docs/api/paddle/bmm_cn.rst

.. _cn_api_paddle_bmm:

bmm
-------------------------------

.. py:function:: paddle.bmm(x, y, name=None, *, out=None)




对输入 x 及输入 y 进行矩阵相乘。

两个输入的维度必须等于 3，并且矩阵 x 和矩阵 y 的第一维必须相等。同时矩阵 x 的第三维必须等于矩阵 y 的第二维。

例如：若 x 和 y 分别为 (b, m, k) 和 (b, k, n) 的矩阵，则函数的输出为一个 (b, m, n) 的矩阵。

参数
:::::::::

    - **x** (Tensor) - 输入变量，类型为 Tensor。别名 ``input``。
    - **y** (Tensor) - 输入变量，类型为 Tensor。别名 ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
Tensor，矩阵相乘后的结果。

代码示例
:::::::::

COPY-FROM: paddle.bmm

---

## File: docs/api/paddle/broadcast_shape_cn.rst

.. _cn_api_paddle_broadcast_shape:

broadcast_shape
-------------------------------

.. py:function:: paddle.broadcast_shape(x_shape, y_shape)

.. note::
    该函数返回对 x_shape 大小的 Tensor 和 y_shape 大小的 Tensor 做 broadcast 操作后得到的 shape，如您想了解更多，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::
    - **x_shape** (list[int]|tuple[int]) - 输入 Tensor 的 shape。
    - **y_shape** (list[int]|tuple[int]) - 输入 Tensor 的 shape。

返回
:::::::::
broadcast 操作后的 shape，返回类型为 list[int]。


代码示例
:::::::::

COPY-FROM: paddle.broadcast_shape

---

## File: docs/api/paddle/broadcast_shapes_cn.rst

.. _cn_api_paddle_broadcast_shapes:

broadcast_shapes
-------------------------------

.. py:function:: paddle.broadcast_shapes(*shapes: Sequence[int])

计算多个 Tensor shape 经过广播（broadcasting）之后的结果 shape。


参数
::::::::::::

    - **shapes** (Sequence[int]) - 一个或多个 Tensor 的 shape。每个 shape 都是一个整数序列（List 或 Tuple）。

返回
::::::::::::
list[int]，广播后的结果 shape。


代码示例
::::::::::::

COPY-FROM: paddle.broadcast_shapes

---

## File: docs/api/paddle/broadcast_tensors_cn.rst

[Binary file]

---

## File: docs/api/paddle/broadcast_to_cn.rst

.. _cn_api_paddle_broadcast_to:

broadcast_to
-------------------------------

.. py:function:: paddle.broadcast_to(x, shape, name=None)

根据 ``shape`` 指定的形状广播 ``x``，广播后，``x`` 的形状和 ``shape`` 指定的形状一致。

``x`` 的维数和 ``shape`` 的元素数应小于等于 6，并且 ``shape`` 中的元素数应该大于等于 ``x`` 的维数。扩展的维度的维度值应该为 1。

下图展示了一个形状为[3]的一维张量根据 ``shape`` 指定的形状广播为[2,3]的二维张量这一过程。

.. figure:: ../../images/api_legend/broadcast_to.png
    :width: 500
    :align: center

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x`` 和 ``size`` 可替代 ``shape``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``， ``size=[2, 3]`` 等价于 ``shape=[2, 3]``。

参数
:::::::::

    - **x** (Tensor) - 输入的 Tensor，数据类型为：bool、float16、float32、float64、int32、int64、uint8 或 uint16。
      别名： ``input``
    - **shape** (tuple|list|Tensor) - 给定输入 ``x`` 扩展后的形状，若 ``shape`` 为 list 或者 tuple，则其中的元素值应该为整数或者是形状为 1-D 或 0-D 的 Tensor，若 ``shape`` 类型为 Tensor，则其应该为 1-D Tensor。
      别名： ``size``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，数据类型与 ``x`` 相同。

代码示例
:::::::::

COPY-FROM: paddle.broadcast_to

---

## File: docs/api/paddle/bucketize_cn.rst

.. _cn_api_paddle_bucketize:

bucketize
-------------------------------

.. py:function:: paddle.bucketize(x, sorted_sequence, out_int32=False, right=False, name=None)

将根据给定的一维 Tensor ``sorted_sequence`` 返回输入 ``x`` 对应的桶索引。

参数
::::::::::
    - **x** (Tensor) - 输入的 N 维 Tensor，支持的数据类型：int32、int64、float32、float64。
    - **sorted_sequence** (Tensor) - 输入的一维 Tensor，支持的数据类型：int32、int64、float32、float64。该 Tensor 的数值在其最后一个维度递增。
    - **out_int32** (bool，可选) - 输出的数据类型支持 int32、int64。默认值为 False，表示默认的输出数据类型为 int64。
    - **right** (bool，可选) - 根据给定 ``x`` 在 ``sorted_sequence`` 查找对应的上边界或下边界。如果 ``sorted_sequence`` 的值为 nan 或 inf，则返回最内层维度的大小。默认值为 False，表示在 ``sorted_sequence`` 的查找给定 ``x`` 的下边界。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::
Tensor(与 ``x`` 维度相同)，如果参数 ``out_int32`` 为 False，则返回数据类型为 int64 的 Tensor，否则将返回 int32 的 Tensor。

代码示例
::::::::::

COPY-FROM: paddle.bucketize

---

## File: docs/api/paddle/cartesian_prod_cn.rst

[Binary file]

---

## File: docs/api/paddle/cast__cn.rst

.. _cn_api_paddle_cast_:

cast\_
-------------------------------

.. py:function:: paddle.cast_(x, dtype)

Inplace 版本的 :ref:`cn_api_paddle_cast` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/cast_cn.rst

.. _cn_api_paddle_cast:

cast
-------------------------------

.. py:function:: paddle.cast(x, dtype)




将 ``x`` 的数据类型转换为 ``dtype`` 并输出。支持输出和输入的数据类型相同。

下图展示了一个例子：将输入的 float64 类型 Tensor 转化为 uint8 类型 Tensor

.. image:: ../../images/api_legend/cast.png
   :alt: 图例

参数
::::::::::::

    - **x** (Tensor) - 输入多维 Tensor，支持的数据类型为：bool、float16、float32、float64、uint8、int32、int64。
    - **dtype** (str|paddle.dtype|np.dtype) - 输出 Tensor 的数据类型。支持的数据类型为：bool、float16、float32、float64、int8、int32、int64、uint8。

返回
::::::::::::
Tensor，维度与 ``x`` 相同，数据类型为 ``dtype``。

代码示例
::::::::::::

COPY-FROM: paddle.cast

---

## File: docs/api/paddle/cat_cn.rst

.. _cn_api_paddle_cat:

cat
-------------------------------

.. py:function:: paddle.cat(x, axis=0, name=None, *, out=None)

``concat`` 的别名，请参考 :ref:`cn_api_paddle_concat`。

---

## File: docs/api/paddle/cauchy__cn.rst

.. _cn_api_paddle_cauchy_:

cauchy\_
-------------------------------

.. py:function:: paddle.cauchy_(x, loc = 0, scale = 1, name = None)



直接修改输入张量 ``x``，将所有元素替换为从柯西分布中随机采样的数值。

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，支持的数据类型为：float32、float64。
    - **loc** (scalar，可选) - 分布峰值的位置参数，数据类型为 float32 或 float64。默认值为 0，对应标准柯西分布。参数别名：median。
    - **scale** (scalar，可选) - 表示分布峰值一半高度处的半宽度（HWHM），控制曲线的陡峭程度。必须为正数，数据类型为 float32 或 float64。默认值为 1，对应标准柯西分布。参数别名：sigma。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，对输入的张量 ``x`` 直接进行了修改，数据类型与输入时相同。

代码示例
::::::::::::

COPY-FROM: paddle.cauchy_

---

## File: docs/api/paddle/cdist_cn.rst

[Binary file]

---

## File: docs/api/paddle/ceil__cn.rst

.. _cn_api_paddle_ceil_:

ceil\_
-------------------------------

.. py:function:: paddle.ceil_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_ceil` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/ceil_cn.rst

.. _cn_api_paddle_ceil:

ceil
-------------------------------

.. py:function:: paddle.ceil(x, name=None)




向上取整运算函数。

.. math::
    out = \left \lceil x \right \rceil


.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，数据类型支持 float32, float64, float16, bfloat16, uint8, int8, int16, int32, int64。
      别名： ``input``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** （Tensor，可选） - 指定输出结果的 ``Tensor``，默认值为 None。

返回
::::::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.ceil

---

## File: docs/api/paddle/chunk_cn.rst

[Binary file]

---

## File: docs/api/paddle/clamp__cn.rst

.. _cn_api_paddle_clamp_:

clamp\_
-------------------------------

.. py:function:: paddle.clamp_(x, min=None, max=None, name=None)

``clip_`` 的别名，请参考 :ref:`cn_api_paddle_clip_`。

.. note::
    别名支持：参数名 ``input`` 可替代 ``x``，如 ``clamp_(input=tensor_x)`` 等价于 ``clamp_(x=tensor_x)``。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/clamp_cn.rst

.. _cn_api_paddle_clamp:

clamp
-------------------------------

.. py:function:: paddle.clamp(x, min=None, max=None, name=None, *, out=None)

``clip`` 的别名，请参考 :ref:`cn_api_paddle_clip`。

---

## File: docs/api/paddle/clamp_max_cn.rst

.. _cn_api_paddle_clamp_max:

clamp_max
-------------------------------

.. py:function:: paddle.clamp_max(input, max, *, out=None)

将输入中的所有元素裁剪到区间 [min=None, max] 内。

该接口是 ``paddle.clip`` 的封装，仅设置上界。

参数
::::::::::::

    - **input** (Tensor) - 输入的 Tensor。
    - **max** (float|Tensor) - 裁剪的最大值。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 输出 Tensor。默认值为 None。

返回
::::::::::::
输出 Tensor，与 ``input`` 维度相同。

代码示例
::::::::::::

COPY-FROM: paddle.clamp_max

---

## File: docs/api/paddle/clip__cn.rst

.. _cn_api_paddle_clip_:

clip\_
-------------------------------

.. py:function:: paddle.clip_(x, min=None, max=None, name=None)

Inplace 版本的 :ref:`cn_api_paddle_clip` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/clip_cn.rst

[Binary file]

---

## File: docs/api/paddle/clone_cn.rst

.. _cn_api_paddle_clone:

clone
-------------------------------

.. py:function:: paddle.clone(x, name=None)

对输入 Tensor :attr:`x` 进行拷贝，并返回一个新的 Tensor。

除此之外，该 API 提供梯度计算，在计算反向时，输出 Tensor 的梯度将会回传给输入 Tensor。

参数
:::::::::
    - **x** (Tensor) - 输入 Tensor。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::

``Tensor``，从输入 :attr:`x` 拷贝的 Tensor。

代码示例
:::::::::

COPY-FROM: paddle.clone

---

## File: docs/api/paddle/column_stack_cn.rst

.. _cn_api_paddle_column_stack:

column_stack
-------------------------------

.. py:function:: paddle.column_stack(x, name=None)

沿水平轴堆叠输入 ``x`` 中的所有张量。 ``x`` 中的每个张量 ``tensor`` 如果在堆叠之前 ``tensor.ndim < 2`` ，则首先被整形为 ``(tensor.numel(), 1)``。所有张量必须具有相同的数据类型。

下图展示了一个 column_stack 的情形，将一个形状为（3，1）的二维张量与一个形状为（3，）的一维张量进行 column_stack 操作，其中一维张量首先被整形为（3，1），然后再沿水平轴堆叠输入所有张量。通过图例能很好看出张量的变化。

.. image:: ../../images/api_legend/column_stack.png
    :width: 600
    :alt: 图例

参数
::::::::::::

    - **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple， ``x`` 中张量的数据类型必须相同。支持的数据类型： ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，与输入数据类型相同的堆叠张量。

代码示例
::::::::::::

COPY-FROM: paddle.column_stack

---

## File: docs/api/paddle/combinations_cn.rst

[Binary file]

---

## File: docs/api/paddle/complex_cn.rst

.. _cn_api_paddle_complex:

complex
-------------------------------

.. py:function:: paddle.complex(real, imag, name=None, *, out=None)


给定实部和虚部，返回一个复数 Tensor。


参数
:::::::::
    - **real** (Tensor) - 实部，数据类型为：float32 或 float64。
    - **imag** (Tensor) - 虚部，数据类型和 ``real`` 相同。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
输出 Tensor，数据类型是 complex64 或者 complex128，与 ``real`` 和 ``imag`` 的数值精度一致。

.. note::
    ``paddle.complex`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

代码示例
:::::::::

COPY-FROM: paddle.complex

---

## File: docs/api/paddle/concat_cn.rst

.. _cn_api_paddle_concat:

concat
-------------------------------

.. py:function:: paddle.concat(x, axis=0, name=None, *, out=None)


对输入沿参数 ``axis`` 轴进行联结，返回一个新的 Tensor。该 API 不支持输入 0-D Tensor，因为其必须指定沿着某个轴拼接，而 0-D Tensor 没有轴。

下图展示了 concat 操作的典型情况——两个形状为 [2, 3, 4] 的三维张量通过 concat 操作沿着不同的 ``axis`` 轴拼接为不同形状的三维张量，我们可以清晰地看到不同维度拼接的效果。

.. image:: ../../images/api_legend/concat.png
   :width: 500
   :alt: 图例

.. note::
    别名支持: 参数名 ``tensors`` 可替代 ``x``，参数名 ``dim`` 可替代 ``axis`` ，如 ``concat(tensors=tensor_x, dim=1, ...)`` 等价于 ``concat(x=tensor_x, axis=1, ...)`` 。

参数
::::::::::::

    - **x** (list|tuple) - 待联结的 Tensor list 或者 Tensor tuple，支持的数据类型为：bool、float16、bfloat16、float32、float64、int8、uint8、int16、uint16、int32、int64、complex64、complex128， ``x`` 中所有 Tensor 的数据类型应该一致。别名： ``tensors``。
    - **axis** (int|Tensor，可选) - 指定对输入 ``x`` 进行运算的轴，可以是整数或者形状为[]的 0-D Tensor，数据类型为 int32 或者 int64。 ``axis`` 的有效范围是 [-R, R)，R 是输入 ``x`` 中 Tensor 的维度，``axis`` 为负值时与 :math:`axis + R` 等价。默认值为 0。别名： ``dim``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
联结后的 Tensor，数据类型和 ``x`` 中的 Tensor 相同。


代码示例
::::::::::::

COPY-FROM: paddle.concat

---

## File: docs/api/paddle/concatenate_cn.rst

.. _cn_api_paddle_concatenate:

concatenate
-------------------------------

.. py:function:: paddle.concatenate(x, axis=0, name=None, *, out=None)

``concat`` 的别名，请参考 :ref:`cn_api_paddle_concat`。

---

## File: docs/api/paddle/conj_cn.rst

.. _cn_api_paddle_conj:

conj
-------------------------------

.. py:function:: paddle.conj(x, name=None, *, out=None)


是逐元素计算 Tensor 的共轭运算。

参数
::::::::::::

    - **x** (Tensor) - 输入的复数值的 Tensor，数据类型为：complex64、complex128、bfloat16、float16、float32、float64、int32 或 int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 ``None``。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::

Tensor，输入的共轭。形状和数据类型与输入一致。如果 Tensor 元素是实数类型，如 float32、float64、int32、或者 int64，返回值和输入相同。


代码示例
::::::::::::

COPY-FROM: paddle.conj

---

## File: docs/api/paddle/copysign__cn.rst

.. _cn_api_paddle_copysign_:

copysign\_
-------------------------------

.. py:function:: paddle.copysign_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_copysign` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/copysign_cn.rst

.. _cn_api_paddle_copysign:

copysign
-------------------------------

.. py:function:: paddle.copysign(x, y, name=None, *, out=None)


按照元素计算两个输入 Tensor 的 copysign 大小，由数值和符号组成，其数值部分来自于第一个 Tensor 中的元素，符号部分来自于第二个 Tensor 中的元素。

.. math::

    copysign(x_{i},y_{i})=\left\{\begin{matrix}
    & -|x_{i}| & if \space y_{i} <= -0.0\\
    & |x_{i}| & if \space y_{i} >= 0.0
    \end{matrix}\right.


参数
::::::::::::

    - **x** (Tensor) - 输入的复数值的 Tensor，数据类型为：bool, uint8, int8, int16, int32, int64, bfloat16, float16, float32, float64。别名： ``input``。
    - **y** (Tensor) - 输入的复数值的 Tensor，数据类型为：bool, uint8, int8, int16, int32, int64, bfloat16, float16, float32, float64。别名： ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::

Tensor，输出数据类型与输入数据类型相同。


代码示例 1
::::::::::::

COPY-FROM: paddle.copysign:example1


代码示例 2
::::::::::::

支持广播机制

COPY-FROM: paddle.copysign:example2

代码示例 3
::::::::::::

y 为 +0.0 时

COPY-FROM: paddle.copysign:example_zero1

代码示例 4
::::::::::::

y 为 -0.0 时

COPY-FROM: paddle.copysign:example_zero2

---

## File: docs/api/paddle/cos__cn.rst

.. _cn_api_paddle_cos_:

cos\_
-------------------------------

.. py:function:: paddle.cos_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_cos` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/cos_cn.rst

.. _cn_api_paddle_cos:

cos
-------------------------------

.. py:function:: paddle.cos(x, name=None, *, out=None)




余弦函数。

输入范围是 ``(-inf, inf)``，输出范围是 ``[-1,1]``。

.. math::

    out = cos(x)

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64 、float16、complex64、complex128。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.cos

---

## File: docs/api/paddle/cosh__cn.rst

.. _cn_api_paddle_cosh_:

cosh\_
-------------------------------

.. py:function:: paddle.cosh_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_cosh` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/cosh_cn.rst

.. _cn_api_paddle_cosh:

cosh
-------------------------------

.. py:function:: paddle.cosh(x, name=None, *, out=None)




双曲余弦函数。

输入范围是 ``(-inf, inf)``，输出范围是 ``[1,inf]``。

.. math::

    out = \frac{exp(x)+exp(-x)}{2}

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64 、float16、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** (Tensor，可选)- 输出的结果。该参数为仅关键字参数，默认值为 None。

返回
::::::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.cosh

---

## File: docs/api/paddle/count_nonzero_cn.rst

.. _cn_api_paddle_count_nonzero:

count_nonzero
-------------------------------

.. py:function:: paddle.count_nonzero(x, axis=None, keepdim=False, name=None)

沿给定的轴 ``axis`` 统计输入 Tensor ``x`` 中非零元素的个数。

参数
::::::::::
   - **x** (Tensor) - 输入的 Tensor，数据类型为：bool、float16、float32、float64、int32、int64。别名：``input``。
   - **axis** (None|int|list|tuple，可选) - 指定对 ``x`` 进行统计的轴。``axis`` 可以是 int 或 int 元素的列表/元组。``axis`` 值应该在范围[-D，D)内，D 是 ``x`` 的维度。如果 ``axis`` 或其中的元素值小于 0，则等价于 :math:`axis + D`。如果 ``axis`` 是 None，则对 ``x`` 的全部元素进行统计。默认值为 None。别名：``dim``。
   - **keepdim** (bool，可选) - 是否在输出 Tensor 中保留被统计的维度。如果 ``keepdim`` 为 True，则输出 Tensor 和 ``x`` 具有相同的维度（被统计的维度大小为 1）；否则，输出 Tensor 会在 ``axis`` 上进行 squeeze 操作。默认值为 False。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::
    ``Tensor``，沿着 ``axis`` 统计输入 Tensor 中非零元素的个数，数据类型 int64。

代码示例
::::::::::

COPY-FROM: paddle.count_nonzero

---

## File: docs/api/paddle/CPUPlace_cn.rst

.. _cn_api_paddle_CPUPlace:

CPUPlace
-------------------------------

.. py:class:: paddle.CPUPlace




``CPUPlace`` 是一个设备描述符，指定 ``CPUPlace`` 则 ``Tensor`` 将被自动分配在该设备上，并且模型将会运行在该设备上。

代码示例
::::::::::::

COPY-FROM: paddle.CPUPlace

---

## File: docs/api/paddle/create_parameter_cn.rst

.. _cn_api_paddle_create_parameter:

create_parameter
-------------------------------


.. py:function:: paddle.create_parameter(shape,dtype,name=None,attr=None,is_bias=False,default_initializer=None)


创建一个参数。该参数是一个可学习的变量，拥有梯度并且可优化。

.. note::
    这是一个低级别的 API。如果您希望自己创建新的 op，这个 API 将非常有用，无需使用 layers。

参数
::::::::::::

    - **shape** (list[int]) - 指定输出 Tensor 的形状，它可以是一个整数列表。
    - **dtype** (str|paddle.dtype|np.dtype) – 初始化数据类型。可设置的字符串值有："float16"，"float32"，"float64"。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **attr** (ParamAttr，可选) - 指定参数的属性对象。具体用法请参见 :ref:`cn_api_paddle_ParamAttr`。默认值为 None，表示将采用 ParamAttr 的默认方式初始化。
    - **is_bias** (bool，可选) - 当 default_initializer 为空，该值会对选择哪个默认初始化程序产生影响。如果 is_bias 为真，则使用 initializer.Constant(0.0)，否则使用 Xavier()，默认值 False。
    - **default_initializer** (Initializer，可选) - 参数的初始化程序，默认值为空。

返回
::::::::::::
创建的 Parameter 变量。

代码示例
::::::::::::

COPY-FROM: paddle.static.create_parameter

---

## File: docs/api/paddle/crop_cn.rst

.. _cn_api_paddle_crop:

crop
-------------------------------

.. py:function:: paddle.crop(x, shape=None, offsets=None, name=None)




根据偏移量（offsets）和形状（shape），裁剪输入（x）Tensor。

**示例**：

::

    * 示例 1（输入为 2-D Tensor）：

        输入：
            X.shape = [3, 5]
            X.data = [[0, 1, 2, 0, 0],
                      [0, 3, 4, 0, 0],
                      [0, 0, 0, 0, 0]]

        参数：
            shape = [2, 2]
            offsets = [0, 1]

        输出：
            Out.shape = [2, 2]
            Out.data = [[1, 2],
                        [3, 4]]

    * 示例 2（输入为 3-D Tensor）：

        输入：

            X.shape = [2, 3, 4]
            X.data =  [[[0, 1, 2, 3],
                        [0, 5, 6, 7],
                        [0, 0, 0, 0]],
                       [[0, 3, 4, 5],
                        [0, 6, 7, 8],
                        [0, 0, 0, 0]]]

        参数：
            shape = [2, 2, -1]
            offsets = [0, 0, 1]

        输出：
            Out.shape = [2, 2, 3]
            Out.data = [[[1, 2, 3],
                         [5, 6, 7]],
                        [[3, 4, 5],
                         [6, 7, 8]]]

**示例二图解说明**：

    下图展示了示例二中的情形——一个形状为[2,3,4]的三维张量通过 crop 操作裁剪为形状为[2,2,3]的三维张量，同时保持了张量中元素的顺序和值不变。通过比较，可以清晰地看到张量形状变化前后各元素的对应关系。

    .. figure:: ../../images/api_legend/crop.png
       :width: 500
       :alt: 示例二图示
       :align: center

参数
:::::::::

  - **x** (Tensor) - 1-D 到 6-D Tensor，数据类型为 float32、float64、int32 或者 int64。
  - **shape** (list|tuple|Tensor，可选) - 输出 Tensor 的形状，数据类型为 int32。如果是列表或元组，则其长度必须与 x 的维度大小相同，如果是 Tensor，则其应该是 1-D Tensor。当它是列表时，每一个元素可以是整数或者形状为[]的 0-D Tensor。含有 Tensor 的方式适用于每次迭代时需要改变输出形状的情况。
  - **offsets** (list|tuple|Tensor，可选) - 每个维度上裁剪的偏移量，数据类型为 int32。如果是列表或元组，则其长度必须与 x 的维度大小相同，如果是 Tensor，则其应是 1-D Tensor。当它是列表时，每一个元素可以是整数或者形状为[]的 0-D Tensor。含有 Tensor 的方式适用于每次迭代的偏移量（offset）都可能改变的情况。默认值：None，每个维度的偏移量为 0。
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
裁剪后的 Tensor，数据类型与输入（x）相同。



代码示例
:::::::::

COPY-FROM: paddle.crop

---

## File: docs/api/paddle/cross_cn.rst

[Binary file]

---

## File: docs/api/paddle/CUDAPinnedPlace_cn.rst

.. _cn_api_paddle_CUDAPinnedPlace:

CUDAPinnedPlace
-------------------------------

.. py:class:: paddle.CUDAPinnedPlace




``CUDAPinnedPlace`` 是一个设备描述符，它所指代的页锁定内存由 CUDA 函数 ``cudaHostAlloc()`` 在主机内存上分配，主机的操作系统将不会对这块内存进行分页和交换操作，可以通过直接内存访问技术访问，加速主机和 GPU 之间的数据拷贝。
有关 CUDA 的数据转移和 ``pinned memory``，参见 `官方文档 <https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#pinned-memory>`_ 。

代码示例
::::::::::::

COPY-FROM: paddle.CUDAPinnedPlace

---

## File: docs/api/paddle/CUDAPlace_cn.rst

.. _cn_api_paddle_CUDAPlace:

CUDAPlace
-------------------------------

.. py:class:: paddle.CUDAPlace





``CUDAPlace`` 是一个设备描述符，表示一个分配或将要分配 ``Tensor`` 的 GPU 设备。
每个 ``CUDAPlace`` 有一个 ``dev_id`` （设备 id）来表明当前的 ``CUDAPlace`` 所代表的显卡编号，编号从 0 开始。
``dev_id`` 不同的 ``CUDAPlace`` 所对应的内存不可相互访问。
这里编号指的是可见显卡的逻辑编号，而不是显卡实际的编号。
可以通过 ``CUDA_VISIBLE_DEVICES`` 环境变量限制程序能够使用的 GPU 设备，程序启动时会遍历当前的可见设备，并从 0 开始为这些设备编号。
如果没有设置 ``CUDA_VISIBLE_DEVICES``，则默认所有的设备都是可见的，此时逻辑编号与实际编号是相同的。

参数
::::::::::::

  - **id** (int) - GPU 的设备 ID。

代码示例
::::::::::::

COPY-FROM: paddle.CUDAPlace

---

## File: docs/api/paddle/cummax_cn.rst

[Binary file]

---

## File: docs/api/paddle/cummin_cn.rst

[Binary file]

---

## File: docs/api/paddle/cumprod__cn.rst

.. _cn_api_paddle_cumprod_:

cumprod\_
-------------------------------

.. py:function:: paddle.cumprod_(x, dim=None, dtype=None, name=None)
Inplace 版本的 :ref:`cn_api_paddle_cumprod` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

 .. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/cumprod_cn.rst

.. _cn_api_paddle_cumprod:

cumprod
-------------------------------

.. py:function:: paddle.cumprod(x, dim=None, dtype=None, name=None)



沿给定维度 ``dim`` 计算输入 tensor ``x`` 的累乘。

.. note::
    结果的第一个元素和输入的第一个元素相同。

参数
:::::::::
    - **x** (Tensor) - 累乘的输入，需要进行累乘操作的 tensor。
    - **dim** (int，可选) - 指明需要累乘的维度，取值范围需在[-x.rank,x.rank)之间，其中 x.rank 表示输入 tensor x 的维度，-1 代表最后一维。
    - **dtype** (str|paddle.dtype|np.dtype，可选) - 输出 tensor 的数据类型，支持 int32、int64、bfloat16、float16、float32、float64、complex64、complex128。如果指定了，那么在执行操作之前，输入的 tensor 将被转换为 dtype 类型。这对于防止数据类型溢出非常有用。默认为：None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，累乘操作的结果。

代码示例
::::::::::

COPY-FROM: paddle.cumprod

---

## File: docs/api/paddle/cumsum__cn.rst

.. _cn_api_paddle_cumsum_:

cumsum\_
-------------------------------

.. py:function:: paddle.cumsum_(x, axis=None, dtype=None, name=None)
Inplace 版本的 :ref:`cn_api_paddle_cumsum` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

 .. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/cumsum_cn.rst

.. _cn_api_paddle_cumsum:

cumsum
-------------------------------

.. py:function:: paddle.cumsum(x, axis=None, dtype=None, name=None, *, out=None)



沿给定 ``axis`` 计算 Tensor ``x`` 的累加和。

**注意**：结果的第一个元素和输入的第一个元素相同。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x`` 和 ``dim`` 可替代 ``axis``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``， ``dim=2`` 等价于 ``axis=2``。

参数
:::::::::
    - **x** (Tensor) - 累加的输入，需要进行累加操作的 Tensor。别名 ``input``。
    - **axis** (int，可选) - 指明需要累加的维度。-1 代表最后一维。默认：None，将输入展开为一维变量再进行累加计算。别名 ``dim``。
    - **dtype** (str|paddle.dtype|np.dtype，可选) - 输出 Tensor 的数据类型，支持 int32、int64、bfloat16、float16、float32、float64、complex64、complex128。当输入 ``x`` 的类型是 int8/int16/int32 时，默认值是 int64；否则默认值是 None。如果不为 None，那么在执行操作之前，输入 Tensor 将被转换为 dtype。这对于防止数据类型溢出非常有用。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
``Tensor``，累加的结果。

代码示例
::::::::::

COPY-FROM: paddle.cumsum

---

## File: docs/api/paddle/cumulative_trapezoid_cn.rst

.. _cn_api_paddle_cumulative_trapezoid:

cumulative_trapezoid
--------------------------------

.. py:function:: paddle.cumulative_trapezoid(y, x=None, dx=None, axis=-1, name=None, *, out=None)

在指定维度上对输入实现 `trapezoid rule <https://en.wikipedia.org/wiki/Trapezoidal_rule>`_ 算法。与 :ref:`cn_api_paddle_trapezoid` 的区别是，所用累积求和函数为 cumsum。


参数
:::::::::

    - **y** (Tensor) - 输入多维 Tensor，可选的数据类型为 float16、float32、float64。
    - **x** (Tensor，可选) - ``y`` 中数值对应的浮点数所组成的 Tensor，类型与 ``y`` 相同，形状与 ``y`` 的形状相匹配；若 ``x`` 有输入，已知 ``y`` 的尺寸为 ``[d_1, d_2, ... , d_n]`` 且 ``axis=k``，则 ``x`` 的尺寸只能为 ``[d_k]`` 或 ``[d_1, d_2, ... , d_n]``；如果 ``x`` 为 None，则假定采样点均匀分布 ``dx``。
    - **dx** (float，可选) - 相邻采样点之间的常数间隔；当 ``x`` 和 ``dx`` 均未指定时，``dx`` 默认为 1.0。
    - **axis** (int，可选) - 计算 trapezoid rule 时 ``y`` 的维度。默认值 -1。别名 ``dim``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
Tensor，按 trapezoidal rule 计算出 ``y`` 等于 N 维张量时的定积分，结果为 N 维张量。


代码示例
:::::::::

COPY-FROM: paddle.cumulative_trapezoid

---

## File: docs/api/paddle/DataParallel_cn.rst

[Binary file]

---

## File: docs/api/paddle/deg2rad_cn.rst

.. _cn_api_paddle_deg2rad:

deg2rad
-------------------------------

.. py:function:: paddle.deg2rad(x, name=None, *, out=None)

将元素从度转换为弧度

.. math::

    deg2rad(x)=\pi * x / 180

参数
:::::::::

    - **x**  (Tensor) - 输入的 Tensor，数据类型为：int32、int64、float32、float64。
    - **name**  (str，可选) - 操作的名称（可选，默认值为 None）。更多信息请参见 :ref:`api_guide_Name`。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::

输出 Tensor，与 ``x`` 维度相同、数据类型相同（输入为 int 时，输出数据类型为 float32）。

代码示例
:::::::::

COPY-FROM: paddle.deg2rad

---

## File: docs/api/paddle/diag_cn.rst

[Binary file]

---

## File: docs/api/paddle/diag_embed_cn.rst

[Binary file]

---

## File: docs/api/paddle/diagflat_cn.rst

[Binary file]

---

## File: docs/api/paddle/diagonal_cn.rst

[Binary file]

---

## File: docs/api/paddle/diagonal_scatter_cn.rst

[Binary file]

---

## File: docs/api/paddle/diff_cn.rst

.. _cn_api_paddle_diff:

diff
-------------------------------

.. py:function:: paddle.diff(x, n=1, axis=-1, prepend=None, append=None, name=None, *, out=None)

沿着指定轴计算输入 Tensor 的 n 阶前向差值，一阶的前向差值计算公式如下：

..  math::
    out[i] = x[i+1] - x[i]

.. note::
    高阶的前向差值可以通过递归的方式进行计算，``n`` 的值支持任意正整数。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x`` 和 ``dim`` 可替代 ``axis``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``， ``dim=1`` 等价于 ``axis=1``。

参数
::::::::::::

    - **x** (Tensor) - 待计算前向差值的输入 ``Tensor``，支持 bool、int32、int64、float16、float32、float64 数据类型。别名 ``input``。
    - **n** (int，可选) - 需要计算前向差值的次数，``n`` 的值支持任意正整数，默认值为 1。
    - **axis** (int，可选) - 沿着哪一维度计算前向差值，默认值为-1，也即最后一个维度。别名 ``dim``。
    - **prepend** (Tensor，可选) - 在计算前向差值之前，沿着指定维度 axis 附加到输入 x 的前面，它的维度需要和输入一致，并且除了 axis 维外，其他维度的形状也要和输入一致，默认值为 None。
    - **append** (Tensor，可选) - 在计算前向差值之前，沿着指定维度 axis 附加到输入 x 的后面，它的维度需要和输入一致，并且除了 axis 维外，其他维度的形状也要和输入一致，默认值为 None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
前向差值计算后的 Tensor，数据类型和输入一致。

代码示例
:::::::::

COPY-FROM: paddle.diff

---

## File: docs/api/paddle/digamma__cn.rst

.. _cn_api_paddle_digamma_:

digamma\_
-------------------------------

.. py:function:: paddle.digamma_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_digamma` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/digamma_cn.rst

.. _cn_api_paddle_digamma:

digamma
----------------

.. py:function:: paddle.digamma(x, name=None)


逐元素计算输入 Tensor 的 digamma 函数值

.. math::
    \\Out = \Psi(x) = \frac{ \Gamma^{'}(x) }{ \Gamma(x) }\\


参数
:::::::::
  - **x** (Tensor) – 输入 Tensor。数据类型为 float32，float64。
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``, digamma 函数计算结果，数据类型和维度大小与输入一致。

代码示例
:::::::::

COPY-FROM: paddle.digamma

---

## File: docs/api/paddle/disable_compat_cn.rst

.. _cn_api_paddle_disable_compat:

disable_compat
-------------------------------

.. py:function:: paddle.disable_compat()

通过从 ``sys.meta_path`` 中移除 ``TorchProxyMetaFinder`` 来禁用 PyTorch 代理。
这可以防止 ``torch`` 导入被代理到 PaddlePaddle。

返回
:::::::::
    None

代码示例
:::::::::

COPY-FROM: paddle.disable_compat

---

## File: docs/api/paddle/disable_signal_handler_cn.rst

.. _cn_api_paddle_disable_signal_handler:

disable_signal_handler
-------------------------------

.. py:function:: paddle.disable_signal_handler()

关闭 Paddle 系统信号处理方法

Paddle 默认在 C++层面注册了系统信号处理方法，用于优化报错信息。
但是一些特定的 Python module 可能需要使用某些系统信号，引发冲突。
您可以通过调用本函数来关闭 Paddle 的系统信号处理方法

如果您在一个 Python 文件中同时使用了 Paddle 和下述框架的一种或多种，
则请在其他框架执行前首先调用 paddle.disable_signal_handler()

1.TVM 框架
2.ADLIK 框架

返回
:::::::::
无

代码示例
:::::::::

COPY-FROM: paddle.disable_signal_handler

---

## File: docs/api/paddle/disable_static_cn.rst

.. _cn_api_paddle_disable_static:

disable_static
-------------------------------

.. py:function:: paddle.disable_static(place=None)

.. note::
    从 2.0.0 版本开始，Paddle 默认开启动态图模式。

该接口关闭静态图模式。可通过 :ref:`cn_api_paddle_enable_static` 开启静态图模式。


参数
::::::::::::

  - **place** (paddle.CPUPlace|paddle.CUDAPlace，可选) - 动态图运行时的设备。默认值为 ``None``，此时，会根据 paddle 的版本自动判断。

返回
::::::::::::
无

代码示例
::::::::::::

COPY-FROM: paddle.disable_static

---

## File: docs/api/paddle/dist_cn.rst

.. _cn_api_paddle_dist:

dist
-------------------------------

.. py:function:: paddle.dist(x, y, p=2, name=None)

计算 :math:`(x-y)` 的 :math:`p` 范数（p-norm），需要注意这不是严格意义上的范数，仅作为距离的度量。输入 :math:`x` 和 :math:`y` 的形状（shape）必须是可广播的（broadcastable）。其含义如下，详情请参考 `Tensor 的广播机制 <../../guides/beginner/tensor_cn.html#id7>`_ ：

- 每个输入都至少有 1 维
- 对两个输入的维度从后向前匹配，两个输入每一维的大小需要满足 3 个条件中的任意一个：相等、其中一个为 1 或者其中一个不存在。

定义 :math:`z=x-y`，:math:`x` 和 :math:`y` 的形状是可广播的，那么 :math:`z` 的形状可按照下列步骤得到：

(1) 如果 :math:`x` 和 :math:`y` 的维数不同，先对维数较少的这个输入的维度往前补 1。

例如，:math:`x` 的形状为 [8, 1, 6, 1]，:math:`y` 的形状为 [7, 1, 5]，对 :math:`y` 的维度补 1，

x (4-D Tensor):  8 x 1 x 6 x 1

y (4-D Tensor):  1 x 7 x 1 x 5


(2) 确定输出 :math:`z` 每一维度的大小：从两个输入的维度中选取最大值。

z (4-D Tensor):  8 x 7 x 6 x 5

若两个输入的维数相同，则输出的大小可直接用步骤 2 确定。以下是 :math:`p` 取不同值时，范数的计算公式：

当 :math:`p = 0`，定义 :math:`0^0 = 0`，则 :math:`z` 的零范数是 :math:`z` 中非零元素的个数。

.. math::
    ||z||_{0}=\lim_{p \rightarrow 0}\sum_{i=1}^{m}|z_i|^{p}

当 :math:`p = \infty` 时，:math:`z` 的无穷范数是 :math:`z` 所有元素中的绝对值最大值。

.. math::
    ||z||_\infty=\max_i |z_i|

当 :math:`p = -\infty` 时，:math:`z` 的负无穷范数是 :math:`z` 所有元素中的绝对值最小值。

.. math::
    ||z||_{-\infty}=\min_i |z_i|

其他情况下，:math:`z` 的 :math:`p` 范数使用以下公式计算：

.. math::
    ||z||_{p}=(\sum_{i=1}^{m}|z_i|^p)^{\frac{1}{p}}

参数
::::::::::::

  - **x** (Tensor) - 1-D 到 6-D Tensor，数据类型为 bfloat16，float16，float32 或 float64。别名 ``input``。
  - **y** (Tensor) - 1-D 到 6-D Tensor，数据类型为 bfloat16，float16，float32 或 float64。别名 ``other``。
  - **p** (float，可选) - 用于设置需要计算的范数，数据类型为 float32 或 float64。默认值为 2。
  - **name** (str，可选) - 具体用法请参见  :ref:`api_guide_Name` ，一般无需设置，默认值为 None。



返回
::::::::::::
Tensor，:math:`(x-y)` 的 :math:`p` 范数。

代码示例
::::::::::::

COPY-FROM: paddle.dist

---

## File: docs/api/paddle/div__cn.rst

.. _cn_api_paddle_div_:

div\_
-------------------------------

.. py:function:: paddle.div_(x, y, name=None, *, rounding_mode=None, out=None)

别名函数，功能与 :ref:`cn_api_paddle_divide_` 完全相同，详情请参考 :ref:`cn_api_paddle_divide_` 。

---

## File: docs/api/paddle/div_cn.rst

.. _cn_api_paddle_div:

div
-------------------------------

.. py:function:: paddle.div(x, y, name=None, *, rounding_mode=None, out=None)

别名函数，功能与 :ref:`cn_api_paddle_divide` 完全相同，详情请参考 :ref:`cn_api_paddle_divide` 。

---

## File: docs/api/paddle/divide__cn.rst

.. _cn_api_paddle_divide_:

divide\_
-------------------------------

.. py:function:: paddle.divide_(x, y, name=None, *, rounding_mode=None, out=None)
Inplace 版本的 :ref:`cn_api_paddle_divide` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/divide_cn.rst

.. _cn_api_paddle_divide:

divide
-------------------------------

.. py:function:: paddle.divide(x, y, name=None, *, rounding_mode=None, out=None)

逐元素相除算子，输入 ``x`` 与输入 ``y`` 逐元素相除，并将各个位置的输出元素保存到返回结果中。

.. note::
    别名支持：参数名 ``input`` 可替代 ``x``，参数名 ``other`` 可替代 ``y`` ，如 ``divide(input=tensor_x, other=tensor_y, ...)`` 等价于 ``divide(x=tensor_x, y=tensor_y, ...)`` 。
    输入 ``x`` 与输入 ``y`` 必须和广播为相同形状，关于广播规则，请参见 `Tensor 介绍`_ 。

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

等式为：

.. math::
        Out = X / Y

- :math:`X`：多维 Tensor。
- :math:`Y`：多维 Tensor。

参数
:::::::::
        - **x** (Tensor) - 多维 Tensor。数据类型为 bool、bfloat16、float16、float32、float64、int8、int16、int32、int64、uint8、complex64、complex128。
          ``别名: input``
        - **y** (Tensor) - 多维 Tensor。数据类型为 bool、bfloat16、float16、float32、float64、int8、int16、int32、int64、uint8、complex64、complex128。
          ``别名: other``
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
        - **rounding_mode** (str，可选) - 指定舍入模式。可选值为 ``None``、``"trunc"`` 或 ``"floor"``。如果 ``rounding_mode=None``，则不进行舍入操作；如果 ``rounding_mode="trunc"``，则向零截断；如果 ``rounding_mode="floor"``，则向负无穷舍入。
        - **out** (Tensor，可选) - 输出 Tensor，默认值为 None。


返回
:::::::::

   ``Tensor``，存储运算后的结果。如果 x 和 y 有不同的 shape 且是可以广播的，返回 Tensor 的 shape 是 x 和 y 经过广播后的 shape。如果 x 和 y 有相同的 shape，返回 Tensor 的 shape 与 x，y 相同。



代码示例
:::::::::

COPY-FROM: paddle.divide

---

## File: docs/api/paddle/dot_cn.rst

[Binary file]

---

## File: docs/api/paddle/dsplit_cn.rst

.. _cn_api_paddle_dsplit:

dsplit
-------------------------------

.. py:function:: paddle.dsplit(x, num_or_indices, name=None)


``dsplit`` 全称 Depth Split ，即深度分割，将输入 Tensor 沿着深度轴分割成多个子 Tensor，等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 2。

.. note::
   请确保使用 ``paddle.dsplit`` 进行变换的 Tensor 维度数量不少于 3。

如下图，Tensor ``x`` 的 shape 为[4, 4, 4]，经过 ``paddle.dsplit(x, num_or_indices=2)`` 变换后，得到 ``out0`` 和 ``out1`` 两个 shape 均为[4, 4, 2]的子 Tensor：

.. image:: ../../images/api_legend/dsplit/dsplit.png
   :alt: dsplit 图例

参数
:::::::::
       - **x** (Tensor) - 输入变量，数据类型为 bool、bfloat16、float16、float32、float64、uint8、int8、int32、int64 的多维 Tensor，其维度必须大于 2。
       - **num_or_indices** (int|list|tuple) - 如果 ``num_or_indices`` 是一个整数 ``n`` ，则 ``x`` 拆分为 ``n`` 部分。如果 ``num_or_indices`` 是整数索引的列表或元组，则在每个索引处分割 ``x`` 。
       - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::

list[Tensor]，分割后的 Tensor 列表。


代码示例
:::::::::

COPY-FROM: paddle.dsplit

---

## File: docs/api/paddle/dstack_cn.rst

.. _cn_api_paddle_dstack:

dstack
-------------------------------

.. py:function:: paddle.dstack(x, name=None)

沿深度轴堆叠输入 ``x`` 中的所有张量。所有张量必须具有相同的数据类型。

参数
::::::::::::

    - **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple， ``x`` 中张量的数据类型必须相同。支持的数据类型： ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，与输入数据类型相同的堆叠张量。

也可以参考下方的图示来理解 ``dstack`` 是如何对张量进行变换的。图片展示了两个形状为 [3] 的一维张量以及两个形状为 [3, 2] 的二维张量，这些张量在深度方向上堆叠后的结果。其中，形状为 [3] 的一维张量在堆叠时会被扩展为形状为 [1, 3] 的二维张量。

.. image:: ../../images/api_legend/dstack.png
   :width: 500
   :alt: 图例

代码示例
::::::::::::

COPY-FROM: paddle.dstack

---

## File: docs/api/paddle/einsum_cn.rst

.. _cn_api_paddle_einsum:

einsum
------

.. py:function:: paddle.einsum(equation, *operands)

该函数用于对一组输入 Tensor 进行 Einstein 求和，**该函数目前仅适用于动态图**。

Einstein 求和是一种采用 Einstein 标记法描述的 Tensor 求和，输入单个或多个 Tensor，输出单个 Tensor。

如下的 Tensor 操作或运算均可视为 Einstein 求和的特例

    - 单操作数
        - 迹：trace
        - 对角元：diagonal
        - 转置：transpose
        - 求和：sum
    - 双操作数
        - 内积：dot
        - 外积：outer
        - 广播乘积：mul，*
        - 矩阵乘：matmul
        - 批量矩阵乘：bmm
    - 多操作数
        - 广播乘积：mul，*
        - 多矩阵乘：A.matmul(B).matmul(C)

**关于求和标记的约定**

    - 维度分量下标：Tensor 的维度分量下标使用英文字母表示，不区分大小写，如'ijk'表示 Tensor 维度分量为 i,j,k
    - 下标对应输入操作数：维度下标以 ``,`` 分段，按顺序 1-1 对应输入操作数
    - 广播维度：省略号 ``...`` 表示维度的广播分量，例如，'i...j'表示首末分量除外的维度需进行广播对齐
    - 自由标和哑标：输入标记中仅出现一次的下标为自由标，重复出现的下标为哑标，哑标对应的维度分量将被规约消去
    - 输出：输出 Tensor 的维度分量既可由输入标记自动推导，也可以用输出标记定制化
        - 自动推导输出
            - 广播维度分量位于维度向量高维位置，自由标维度分量按字母顺序排序，位于维度向量低纬位置，哑标维度分量不输出
        - 定制化输出
            - 维度标记中 ``->`` 右侧为输出标记
            - 若输出包含广播维度，则输出标记需包含 ``...``
            - 输出标记为空时，对输出进行全量求和，返回该标量
            - 输出不能包含输入标记中未出现的下标
            - 输出下标不可以重复出现
            - 哑标出现在输出标记中则自动提升为自由标
            - 输出标记中未出现的自由标被降为哑标
    - 例子
        - '...ij, ...jk'，该标记中 i,k 为自由标，j 为哑标，输出维度'...ik'
        - 'ij -> i'，i 为自由标，j 为哑标
        - '...ij, ...jk -> ...ijk'，i,j,k 均为自由标
        - '...ij, ...jk -> ij'，若输入 Tensor 中的广播维度不为空，则该标记为无效标记

**求和规则**

Einsum 求和过程理论上等价于如下四步，但实现中实际执行的步骤会有差异。

    - 第一步，维度对齐：将所有标记按字母序排序，按照标记顺序将输入 Tensor 逐一转置、补齐维度，使得处理后的所有 Tensor 其维度标记保持一致
    - 第二步，广播乘积：以维度下标为索引进行广播点乘
    - 第三步，维度规约：将哑标对应的维度分量求和消除
    - 第四步，转置输出：若存在输出标记，则按标记进行转置，否则按广播维度+字母序自由标的顺序转置，返回转之后的 Tensor 作为输出

**关于 trace 和 diagonal 的标记约定（待实现功能）**

    - 在单个输入 Tensor 的标记中重复出现的下标称为对角标，对角标对应的坐标轴需进行对角化操作，如'i...i'表示需对首尾坐标轴进行对角化
    - 若无输出标记或输出标记中不包含对角标，则对角标对应维度规约为标量，相应维度取消，等价于 trace 操作
    - 若输出标记中包含对角标，则保留对角标维度，等价于 diagonal 操作

参数
:::::

    - **equation** (str)：求和标记
    - **operands** (Tensor, [Tensor, ...])：输入 Tensor

返回
:::::

    Tensor：输出 Tensor

代码示例
:::::::::

COPY-FROM: paddle.einsum

---

## File: docs/api/paddle/empty_cn.rst

.. _cn_api_paddle_empty:

empty
-------------------------------

.. py:function:: paddle.empty(shape, dtype=None, name=None, *, out=None, device=None, requires_grad=False, pin_memory=False)



创建形状大小为 shape 并且数据类型为 dtype 的 Tensor，其中元素值是未初始化的。

.. note::
    别名支持: 参数名 ``size`` 可替代 ``shape``。
    ``shape`` 支持可变参数类型。
    使用实例：
        ``paddle.empty(1, 2, 3, dtype=paddle.float32)``
        ``paddle.empty(size=[1, 2, 3], dtype=paddle.float32)``

参数
::::::::::::

    - **shape** (list|tuple|Tensor|*shape) - 生成的 Tensor 的形状。数据类型为 int32 或 int64。
      如果 ``shape`` 是 list、tuple，则其中的元素可以是 int，或者是形状为 [] 且数据类型为 int32、int64 的 0-D Tensor。
      如果 ``shape`` 是 Tensor，则是数据类型为 int32、int64 的 1-D Tensor，表示一个列表。
      如果 ``shape`` 是 \*shape，则可以直接以可变参数的形式传入多个整数（例如 ``randn(2, 3)``）。
      该参数的别名为 ``size``。
    - **dtype** (str|paddle.dtype|np.dtype，可选)- 输出变量的数据类型，可以是 bool、float16、float32、float64、int32、int64、complex64、complex128。若为 None，则输出变量的数据类型为系统全局默认类型，默认值为 None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 用于存储结果的 Tensor。若指定，将直接写入该 Tensor，默认值为 None。
    - **device** (PlaceLike|None，可选) - 期望创建 Tensor 所在的设备。默认值为 None，表示使用当前全局设备（可通过 ``paddle.device.set_device`` 设置）。
    - **requires_grad** (bool，可选) - 是否需要为返回的 Tensor 记录梯度信息。默认值为 False。
    - **pin_memory** (bool，可选) - 若为 True，返回的 Tensor 将分配在锁页内存中。默认值为 False。

返回
::::::::::::
返回一个根据 ``shape`` 和 ``dtype`` 创建并且尚未初始化的 Tensor。

代码示例
::::::::::::

COPY-FROM: paddle.empty

---

## File: docs/api/paddle/empty_like_cn.rst

.. _cn_api_paddle_empty_like:

empty_like
-------------------------------

.. py:function:: paddle.empty_like(x, dtype=None, name=None, *, device=None, requires_grad=False, pin_memory=False)


根据参数 ``x`` 的 shape 和数据类型 ``dtype`` 创建未初始化的 Tensor。如果 ``dtype`` 为 None，则 Tensor 的数据类型与 ``x`` 相同。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``empty_like(input=tensor_x)`` 等价于 ``empty_like(x=tensor_x)`` 。

参数
::::::::::::

    - **x** (Tensor) – 输入 Tensor，输出 Tensor 和 x 具有相同的形状，x 的数据类型可以是 bool、float16、float32、float64、int32、int64。别名： ``input``。
    - **dtype** （str|paddle.dtype|np.dtype，可选）- 输出变量的数据类型，可以是 bool、float16、float32、float64、int32、int64。若参数为 None，则输出变量的数据类型和输入变量相同，默认值为 None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **device** (PlaceLike|None，可选) - 期望创建 Tensor 所在的设备。若为 None，则与 ``x`` 保持一致。
    - **requires_grad** (bool，可选) - 是否需要为返回的 Tensor 记录梯度信息。默认值为 False。
    - **pin_memory** (bool，可选) - 若为 True，返回的 Tensor 将分配在锁页内存中。默认值为 False。

返回
::::::::::::
返回一个根据 ``x`` 和 ``dtype`` 创建并且尚未初始化的 Tensor。

代码示例
::::::::::::

COPY-FROM: paddle.empty_like

---

## File: docs/api/paddle/enable_compat_cn.rst

.. _cn_api_paddle_enable_compat:

enable_compat
-------------------------------

.. py:function:: paddle.enable_compat(*, scope=None, blocked_modules=None, backend='torch', silent=False)

通过将 ``TorchProxyMetaFinder`` 添加到 ``sys.meta_path`` 来启用 PyTorch 兼容代理。
这允许导入实际上是 PaddlePaddle 代理的 ``torch`` 模块。


参数
:::::::::
    - **scope** (str|Iterable[str]，可选) - 指定启用 PyTorch 兼容代理的模块或模块列表。如果为 ``None``，则全局启用 PyTorch 兼容代理。默认为 ``None``。
    - **blocked_modules** (str|Iterable[str]，可选) - 指定从 PyTorch 兼容代理中排除的模块或模块列表。默认为 ``None``。
    - **backend** (str，可选) - 要启用兼容性的后端。目前仅支持 ``"torch"``。默认为 ``"torch"``。
    - **silent** (bool，可选) - 如果为 ``True``，则抑制有关范围更改的警告。默认为 ``False``。

返回
:::::::::
    None

代码示例 1
:::::::::

COPY-FROM: paddle.enable_compat:enable-compat-in-global-scope

代码示例 2
:::::::::

COPY-FROM: paddle.enable_compat:enable-compat-in-specific-scope

---

## File: docs/api/paddle/enable_grad_cn.rst

.. _cn_api_paddle_enable_grad:

enable_grad
-------------------------------

.. py:class:: paddle.enable_grad()



创建一个上下文来启用动态图梯度计算。在此模式下，每次计算的结果都将具有 stop_gradient=False。

也可以用作一个装饰器（需要创建实例对象作为装饰器）。

代码示例
::::::::::::

COPY-FROM: paddle.enable_grad

---

## File: docs/api/paddle/enable_static_cn.rst

.. _cn_api_paddle_enable_static:

enable_static
-------------------------------

.. py:function:: paddle.enable_static()

.. note::
    从 2.0.0 版本开始，Paddle 默认开启动态图模式。

开启静态图模式。可通过 :ref:`cn_api_paddle_disable_static` 关闭静态图模式。


返回
::::::::::::
无

代码示例
::::::::::::

COPY-FROM: paddle.enable_static

---

## File: docs/api/paddle/eq_cn.rst

.. _cn_api_paddle_eq:

eq
-------------------------------

.. py:function:: paddle.eq(x, y, name=None, *, out=None)

``equal`` 的别名，请参考 :ref:`cn_api_paddle_equal`。

---

## File: docs/api/paddle/equal__cn.rst

.. _cn_api_paddle_equal_:

equal\_
-------------------------------

.. py:function:: paddle.equal_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_paddle_equal` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/equal_all_cn.rst

.. _cn_api_paddle_equal_all:

equal_all
-------------------------------

.. py:function:: paddle.equal_all(x, y, name=None)


返回 x==y 的布尔值，如果所有相同位置的元素相同返回 True，否则返回 False。

**注：输出的结果不返回梯度。**


参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、float32、float64、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、float32、float64、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
输出结果为 Tensor，Tensor 数据类型为 bool。

代码示例
::::::::::::

COPY-FROM: paddle.equal_all

---

## File: docs/api/paddle/equal_cn.rst

.. _cn_api_paddle_equal:

equal
-------------------------------
.. py:function:: paddle.equal(x, y, name=None)


返回 :math:`x==y` 逐元素比较 x 和 y 是否相等，相同位置的元素相同则返回 True，否则返回 False。使用重载算子 ``==`` 可以有相同的计算函数效果。

.. note::
    输出的结果不返回梯度。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
::::::::::::
输出结果的 Tensor，输出 Tensor 的 shape 和输入一致，Tensor 数据类型为 bool。

代码示例
::::::::::::

COPY-FROM: paddle.equal

---

## File: docs/api/paddle/erf__cn.rst

.. _cn_api_paddle_erf_:

erf\_
-------------------------------

.. py:function:: paddle.erf_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_erf` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

.. note::

    别名支持：参数名 ``input`` 可替代 ``x``，如 ``erf_(input=tensor_x)`` 等价于 ``erf_(x=tensor_x)``。

---

## File: docs/api/paddle/erf_cn.rst

.. _cn_api_paddle_erf:

erf
-------------------------------

.. py:function:: paddle.erf(x, name=None)

逐元素计算 Erf 激活函数。

更多细节请参考 `Error function <https://en.wikipedia.org/wiki/Error_function>`_。

.. math::
    out = \frac{2}{\sqrt{\pi}} \int_{0}^{x}e^{- \eta^{2}}d\eta

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，数据类型为 float32、float64、uint8、int8、int16、int32、int64。别名: ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 ``None``。

返回
::::::::::::

    Tensor，数据类型为 float32 或 float64（整数类型会自动转换为 float32），形状与输入 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.erf

---

## File: docs/api/paddle/erfinv__cn.rst

.. _cn_api_paddle_erfinv_:

erfinv\_
-------------------------------

.. py:function:: paddle.erfinv_(x)

Inplace 版本的 :ref:`cn_api_paddle_erfinv` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/erfinv_cn.rst

.. _cn_api_paddle_erfinv:

erfinv
-------------------------------

.. py:function:: paddle.erfinv(x, name=None)
计算输入矩阵 x 的逆误差函数。
请参考 erf 计算公式 :ref:`cn_api_paddle_erf`

.. math::
    erfinv(erf(x)) = x

参数
:::::::::

    - **x**  (Tensor) - 输入的 Tensor，数据类型为：float16、bfloat16、float32、float64。
    - **name**  (str，可选) - 操作的名称（可选，默认值为 None）。更多信息请参见 :ref:`api_guide_Name`。

返回
:::::::::

输出 Tensor，与 :attr:`x` 数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.erfinv

---

## File: docs/api/paddle/exp__cn.rst

.. _cn_api_paddle_exp_:

exp\_
-------------------------------

.. py:function:: paddle.exp_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_exp` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/exp_cn.rst

.. _cn_api_paddle_exp:

exp
-------------------------------

.. py:function:: paddle.exp(x, name=None)




对输入，逐元素进行以自然数 e 为底指数运算。

.. math::
    out = e^x

参数
::::::::::::

    - **x** (Tensor) - 该 OP 的输入为多维 Tensor。数据类型为 int32、int64、bfloat16、float16、float32、float64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
输出为 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.exp

---

## File: docs/api/paddle/expand_as_cn.rst

.. _cn_api_paddle_expand_as:

expand_as
-------------------------------

.. py:function:: paddle.expand_as(x, y, name=None)

根据 ``y`` 的形状扩展 ``x``，扩展后，``x`` 的形状和 ``y`` 的形状相同。

``x`` 的维数和 ``y`` 的维数应小于等于 6，并且 ``y`` 的维数应该大于等于 ``x`` 的维数。扩展的维度的维度值应该为 1。

下图展示了一个一维张量通过 expand_as 操作转变为形状为[2,3]的张量。目标张量的形状为[2,3]，通过 expand_as，一维张量扩展成形状为[2,3]的张量。

.. image:: ../../images/api_legend/expand_as.png
   :width: 500
   :alt: 图例

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``， ``other`` 可替代 ``y``。

参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：bool、float32、float64、int32 或 int64。
      别名： ``input``
    - **y** (Tensor) - 给定输入 ``x`` 扩展后的形状。
      别名： ``other``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
返回
:::::::::
Tensor，数据类型与 ``x`` 相同。

代码示例
:::::::::

COPY-FROM: paddle.expand_as

---

## File: docs/api/paddle/expand_cn.rst

.. _cn_api_paddle_expand:

expand
-------------------------------

.. py:function:: paddle.expand(x, shape, name=None)

根据 ``shape`` 指定的形状扩展 ``x``，扩展后，``x`` 的形状和 ``shape`` 指定的形状一致。

``x`` 的维数和 ``shape`` 的元素数应小于等于 6，并且 ``shape`` 中的元素数应该大于等于 ``x`` 的维数。扩展的维度的维度值应该为 1。

**示例图解说明**：
    Original Tensor 显示了一个形状为 [3] 的一维张量 [1, 2, 3]。通过 paddle.expand 方法（参数 ``shape = [2, 3]``）被广播扩展为一个形状为 [2, 3] 的二维张量。

    .. figure:: ../../images/api_legend/expand.png
       :width: 500
       :alt: 示例一图示
       :align: center

.. note::
    别名支持: 别名支持: 参数名 ``input`` 可替代 ``x`` 和 ``size`` 可替代 ``shape``。
    ``shape`` 支持可变参数类型。
    使用实例：
        ``paddle.expand(tensor_x, shape=[3, 4], name=None)``
        ``tensor_x.expand([3, 4]) -> paddle.expand(tensor_x, [3, 4])``
        ``tensor_x.expand(3, 4) -> paddle.expand(tensor_x, 3, 4)``
        ``tensor_x.expand(size=[3, 4]) -> paddle.expand(tensor_x, size=[3, 4])``


参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：bool、float16、float32、float64、int32、int64、uint8 或 uint16。
      别名： ``input``
    - **shape** (tuple|list|Tensor) - 给定输入 ``x`` 扩展后的形状，若 ``shape`` 为 list 或者 tuple，则其中的元素值应该为整数或者是形状为 1-D 或 0-D 的 Tensor，若 ``shape`` 类型为 Tensor，则其应该为 1-D Tensor。值为-1 表示保持相应维度的形状不变。支持可变参数类型。
      别名： ``size``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``N-D Tensor``，数据类型与 ``x`` 相同。

代码示例
:::::::::

COPY-FROM: paddle.expand

---

## File: docs/api/paddle/expand_copy_cn.rst

.. _cn_api_paddle_expand_copy:

expand_copy
-------------------------------

.. py:function:: paddle.expand_copy(x, shape, name=None)

根据 ``shape`` 指定的形状扩展 ``x``，扩展后返回一个新的 Tensor，不会修改原 Tensor。

这是 :ref:`cn_api_paddle_expand` 的非原位版本，始终返回新的 Tensor 而非视图。

.. note::
    该接口有两个签名：
    1. ``paddle.expand_copy(x, shape, name=None)`` (Paddle 风格)：根据广播语义返回扩展后的新 Tensor。
    2. ``paddle.expand_copy(input, *size)`` (PyTorch 风格)：通过可变长 size 参数返回扩展后的新 Tensor。

参数
:::::::::::
    - **x** (Tensor) - 输入的 Tensor。别名 ``input``。
    - **shape** (tuple|list|Tensor) - 目标扩展形状。维度数必须大于或等于 ``x`` 的维度数。若 shape 为 list 或 tuple，其中的元素值应全为整数或 0-D 或 1-D Tensor（数据类型为 int32）。别名 ``size``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::::
Tensor，数据类型与 ``x`` 相同。

代码示例
:::::::::::

COPY-FROM: paddle.expand_copy

---

## File: docs/api/paddle/expm1__cn.rst

.. _cn_api_paddle_expm1_:

expm1\_
-------------------------------

.. py:function:: paddle.expm1_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_expm1` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

.. note::

    别名支持：参数名 ``input`` 可替代 ``x``，如 ``expm1_(input=tensor_x)`` 等价于 ``expm1_(x=tensor_x)``。

---

## File: docs/api/paddle/expm1_cn.rst

.. _cn_api_paddle_expm1:

expm1
-------------------------------

.. py:function:: paddle.expm1(x, name=None)




对输入，逐元素进行以自然数 e 为底指数运算并减 1。

.. math::
    out = e^x - 1

参数
:::::::::

    - **x** (Tensor) - 该 OP 的输入为多维 Tensor。数据类型为：int32、int64、bfloat16、float16、float32、float64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::

输出为 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.expm1

---

## File: docs/api/paddle/eye_cn.rst

[Binary file]

---

## File: docs/api/paddle/finfo_cn.rst

.. _cn_api_paddle_finfo:

finfo
-------------------------------

.. py:function:: paddle.finfo(dtype)



返回一个 ``finfo`` 对象，该对象包含了输入 ``dtype`` 的各种相关的数值信息。其中输入 ``dtype`` 只能是整数类型的 ``paddle.dtype`` 。

其功能类似 `numpy.finfo <https://numpy.org/doc/stable/reference/generated/numpy.finfo.html#numpy-finfo>`_ 。

.. note::
   别名支持: 参数名 ``type`` 可替代 ``dtype``，如 ``type=paddle.float32`` 等价于 ``dtype=paddle.float32``。


参数
:::::::::
    - **dtype** (str|paddle.dtype|np.dtype，可选) - 输入的数据类型，可以是：paddle.float16、 paddle.float32、 paddle.float64、 paddle.bfloat16、 paddle.complex64、 paddle.complex128 或这些类型的字符串形式。别名： ``type``。

返回
:::::::::
一个 ``finfo`` 对象，其中包含 8 个属性，如下所示：

    - **min** (double) - 该数据类型所能表示的最小的数。
    - **max** (double) - 该数据类型所能表示的最大的数。
    - **eps** (double) - 该数据类型所能表示的最小数，使得 1.0 + eps ≠ 1.0 。
    - **resolution** (double) - 这种类型的近似小数分辨率。
    - **smallest_normal** (double) - 这种类型的最小的正 normal 数。
    - **tiny** (double) - 这种类型的最小的正 normal 数，和 smallest_normal 相同。
    - **bits** (int) - 该数据类型所占据的 bit 位数。
    - **dtype** (str) - 该数据类型的字符串名称。


代码示例
:::::::::

COPY-FROM: paddle.finfo

---

## File: docs/api/paddle/fix_cn.rst

.. _cn_api_paddle_fix:

fix
-------------------------------

.. py:function:: paddle.fix(input, name=None, *, out=None)

返回输入 Tensor 的截断整数值。与 ``paddle.trunc`` 功能相同。

参数
:::::::::
    - **input** (Tensor) - 输入 Tensor，数据类型为 int32、int64、float32、float64。别名 ``x``。
    - **name** (str，可选) - 操作名称，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
Tensor：截断后的 Tensor。

代码示例
:::::::::

COPY-FROM: paddle.fix

---

## File: docs/api/paddle/flatten__cn.rst

.. _cn_api_paddle_flatten_:

flatten\_
-------------------------------

.. py:function::  paddle.flatten_(x)

Inplace 版本的 :ref:`cn_api_paddle_flatten` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/flatten_cn.rst

[Binary file]

---

## File: docs/api/paddle/flip_cn.rst

.. _cn_api_paddle_flip:

flip
-------------------------------

.. py:function:: paddle.flip(x, axis, name=None)




沿指定轴反转 n 维 Tensor。

下图展示了 flip 在 2 维和 3 维张量上的情形——一个形状为[4,4]的二维张量以及一个形状为[3,2,2]的三维张量在指定轴上进行翻转。通过比较，可以清晰地看到张量在翻转前后的变化。图例中展示了沿不同轴进行翻转的结果。

.. image:: ../../images/api_legend/flip.png
    :width: 600
    :alt: 图例

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor。维度为多维，数据类型为 bool、int32、int64、float32 或 float64。别名 ``input``。
    - **axis** (list|tuple|int) - 需要翻转的轴。当 axis 是 int 型时，且 axis<0，实际的计算维度为 ndim(x) + axis；axis 是 list 或 tuple 时，``axis[i] < 0`` 时，实际的计算维度为 ndim(x) + axis[i]，其中 i 为 axis 的索引。别名 ``dims``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，在指定 axis 上翻转后的 Tensor，与输入 x 数据类型相同。


代码示例
::::::::::::

COPY-FROM: paddle.flip

---

## File: docs/api/paddle/floor__cn.rst

.. _cn_api_paddle_floor_:

floor\_
-------------------------------

.. py:function:: paddle.floor_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_floor` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/floor_cn.rst

.. _cn_api_paddle_floor:

floor
-------------------------------

.. py:function:: paddle.floor(x, name=None, *, out=None)




向下取整函数。

.. math::
    out = \left \lfloor x \right \rfloor

参数
::::::::::::

    - **x** - 输入为多维 Tensor。数据类型支持 float32、float64、float16、bfloat16、uint8、int8、int16、int32、int64。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
输出为 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.floor

---

## File: docs/api/paddle/floor_divide__cn.rst

.. _cn_api_paddle_floor_divide_:

floor_divide\_
-------------------------------

.. py:function:: paddle.floor_divide_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_floor_divide` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，参数名 ``other`` 可替代 ``y``，如 ``floor_divide_(input=tensor_x, other=tensor_y)`` 等价于 ``floor_divide_(x=tensor_x, y=tensor_y)``。

---

## File: docs/api/paddle/floor_divide_cn.rst

.. _cn_api_paddle_floor_divide:

floor_divide
-------------------------------

.. py:function:: paddle.floor_divide(x, y, name=None)

逐元素整除算子，将输入 ``x`` 与输入 ``y`` 逐元素整除（商被朝 -inf 方向舍入到最接近的整数值），并将各个位置的输出元素保存到返回结果中。

.. note::
    输入 ``x`` 与输入 ``y`` 必须和广播为相同形状，关于广播规则，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

等式为：

.. math::
        Out = floor(X / Y)

- :math:`X`：多维 Tensor。
- :math:`Y`：多维 Tensor。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x`` 和 ``other`` 可替代 ``y``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``， ``other=tensor_y`` 等价于 ``y=tensor_y``。


参数
:::::::::
        - **x** (Tensor) - 多维 Tensor。数据类型为 int8 int16 int32 int64 float32 float64 float16 或 bfloat16。
          别名： ``input``
        - **y** (Tensor) - 多维 Tensor。数据类型为 int8 int16 int32 int64 float32 float64 float16 或 bfloat16。
          别名： ``other``
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
        - **out** （Tensor，可选） - 指定输出结果的 ``Tensor``，默认值为 None。


返回
:::::::::
多维 Tensor，数据类型与 ``x`` 相同，维度为广播后的形状。


代码示例
:::::::::

COPY-FROM: paddle.floor_divide

---

## File: docs/api/paddle/flops_cn.rst

.. _cn_api_paddle_flops:

flops
-------------------------------

.. py:function:: paddle.flops(net, input_size, custom_ops=None, print_detail=False)

打印网络的基础结构和参数信息。

参数
:::::::::
  - **net** (paddle.nn.Layer|paddle.static.Program) - 网络实例，必须是 paddle.nn.Layer 的子类或者静态图下的 paddle.static.Program。
  - **input_size** (list) - 输入 Tensor 的大小。注意：仅支持 batch_size=1。
  - **custom_ops** (dict，可选) - 字典，用于实现对自定义网络层的统计。字典的 key 为自定义网络层的 class，value 为统计网络层 flops 的函数，函数实现方法见示例代码。此参数仅在 ``net`` 为 paddle.nn.Layer 时生效。默认值：None。
  - **print_detail** (bool，可选) - bool 值，用于控制是否打印每个网络层的细节。默认值：False。

返回
:::::::::
int，网络模型的计算量。

代码示例
:::::::::

COPY-FROM: paddle.flops

---

## File: docs/api/paddle/fmax_cn.rst

.. _cn_api_paddle_fmax:

fmax
-------------------------------

.. py:function:: paddle.fmax(x, y, name=None, *, out=None)


比较两个 Tensor 对应位置的元素，返回一个包含该元素最大值的新 Tensor。如果两个元素其中一个是 nan 值，则直接返回另一个值，如果两者都是 nan 值，则返回第一个 nan 值。

等式是：

.. math::
        out = fmax(x, y)

.. note::
   ``paddle.fmax`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

   .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::
   - **x** （Tensor）- 输入的 Tensor。数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或  ``int64`` 。别名 ``input`` 。
   - **y** （Tensor）- 输入的 Tensor。数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或  ``int64`` 。别名 ``other`` 。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
   - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
   ``Tensor``，存储运算后的结果。如果 x 和 y 有不同的 shape 且是可以广播的，返回 Tensor 的 shape 是 x 和 y 经过广播后的 shape。如果 x 和 y 有相同的 shape，返回 Tensor 的 shape 与 x，y 相同。


代码示例
::::::::::

COPY-FROM: paddle.fmax

---

## File: docs/api/paddle/fmin_cn.rst

.. _cn_api_paddle_fmin:

fmin
-------------------------------

.. py:function:: paddle.fmin(x, y, name=None, *, out=None)


比较两个 Tensor 对应位置的元素，返回一个包含该元素最小值的新 Tensor。如果两个元素其中一个是 nan 值，则直接返回另一个值，如果两者都是 nan 值，则返回第一个 nan 值。

等式是：

.. math::
        out = fmin(x, y)

.. note::
   ``paddle.fmin`` 遵守 broadcasting，如您想了解更多，请参见 `Tensor 介绍`_ .

   .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::
   - **x** （Tensor）- 输入的 Tensor。数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或  ``int64`` 。别名 ``input`` 。
   - **y** （Tensor）- 输入的 Tensor。数据类型为 ``bfloat16`` 、 ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int32`` 或  ``int64`` 。别名 ``other`` 。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
   - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
   ``Tensor``，存储运算后的结果。如果 x 和 y 有不同的 shape 且是可以广播的，返回 Tensor 的 shape 是 x 和 y 经过广播后的 shape。如果 x 和 y 有相同的 shape，返回 Tensor 的 shape 与 x，y 相同。


代码示例
::::::::::

COPY-FROM: paddle.fmin

---

## File: docs/api/paddle/frac__cn.rst

.. _cn_api_paddle_frac_:

frac\_
-------------------------------

.. py:function:: paddle.frac_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_frac` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/frac_cn.rst

.. _cn_api_paddle_frac:

frac
-------------------------------

.. py:function:: paddle.frac(x, name=None, *, out=None)


得到输入 ``Tensor`` 的小数部分。


参数
:::::::::
    - **x** (Tensor)：输入变量，类型为 Tensor，支持 int32、int64、float32、float64 数据类型。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** (Tensor，可选)- 输出的结果。该参数为仅关键字参数，默认值为 None。

返回
:::::::::
    - Tensor (Tensor)，输入矩阵只保留小数部分的结果。


代码示例
:::::::::

COPY-FROM: paddle.frac

---

## File: docs/api/paddle/frexp_cn.rst

.. _cn_api_paddle_frexp:

frexp
-------------------------------

.. py:function:: paddle.frexp(x, name=None, *, out=None)

用于把一个浮点数分解为尾数和指数的函数，返回一个尾数 Tensor 和一个指数 Tensor。

参数
::::::::::
    - **x** (Tensor) – 输入是一个多维的 Tensor，它的数据类型可以是 float32，float64。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见  :ref:`api_guide_Name` ，一般无需设置，默认值为 None。

关键字参数
::::::::::
    - **out** (tuple[Tensor, Tensor]，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 元组中，默认值为 ``None``。

返回
::::::::::
    mantissa（Tensor）：分解后的尾数，类型为 Tensor，形状和原输入的形状一致。

    exponent（Tensor）：分解后的指数，类型为 Tensor，形状和原输入的形状一致。


代码示例
::::::::::

COPY-FROM: paddle.frexp

---

## File: docs/api/paddle/from_dlpack_cn.rst

[Binary file]

---

## File: docs/api/paddle/full_cn.rst

.. _cn_api_paddle_full:

full
-------------------------------

.. py:function:: paddle.full(shape, fill_value, dtype=None, name=None, *, out=None, device=None, requires_grad=False, pin_memory=False)



创建形状大小为 ``shape`` 并且数据类型为 ``dtype``  的 Tensor，其中元素值均为 ``fill_value`` 。

.. note::
    别名支持: 参数名 ``size`` 可替代 ``shape``，如 ``full(size=[2, 3], …)`` 等价于 ``full(shape=[2, 3], …)`` 。

参数
::::::::::::

    - **shape** (list|tuple|Tensor|*shape) - 生成的 Tensor 的形状。数据类型为 int32 或 int64。
      如果 ``shape`` 是 list、tuple，则其中的元素可以是 int，或者是形状为 [] 且数据类型为 int32、int64 的 0-D Tensor。
      如果 ``shape`` 是 Tensor，则是数据类型为 int32、int64 的 1-D Tensor，表示一个列表。
      如果 ``shape`` 是 \*shape，则可以直接以可变参数的形式传入多个整数（例如 ``randn(2, 3)``）。
      该参数的别名为 ``size``。
    - **fill_value** (bool|float|int|Tensor) - 用于初始化输出 Tensor 的常量数据的值。如果 fill_value 是一个 Tensor ，它应该是一个表示标量的 0-D Tensor。注意：该参数不可超过输出变量数据类型的表示范围。
    - **dtype** （str|paddle.dtype|np.dtype，可选）- 输出变量的数据类型，可以是 float16、float32、float64、int32、int64。如果 dtype 为 None，则创建的 Tensor 的数据类型为 float32。默认值为 None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 用于存储结果的 Tensor。若指定，将直接写入该 Tensor，默认值为 None。
    - **device** (PlaceLike|None，可选) - 期望创建 Tensor 所在的设备。默认值为 None，表示使用当前全局设备（可通过 ``paddle.device.set_device`` 设置）。
    - **requires_grad** (bool，可选) - 是否需要为返回的 Tensor 记录梯度信息。默认值为 False。
    - **pin_memory** (bool，可选) - 若为 True，返回的 Tensor 将分配在锁页内存中。默认值为 False。

返回
::::::::::::
返回一个存储结果的 Tensor，数据类型和 dtype 相同。


代码示例
::::::::::::

COPY-FROM: paddle.full

---

## File: docs/api/paddle/full_like_cn.rst

.. _cn_api_paddle_full_like:

full_like
-------------------------------

.. py:function:: paddle.full_like(x, fill_value, dtype=None, name=None, *, device=None, requires_grad=False, pin_memory=False)


创建一个和 ``x`` 具有相同的形状并且数据类型为 ``dtype`` 的 Tensor，其中元素值均为 ``fill_value``，当 ``dtype`` 为 None 的时候，Tensor 数据类型和输入 ``x`` 相同。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
::::::::::::

    - **x** (Tensor) – 输入 Tensor，输出 Tensor 和 x 具有相同的形状，x 的数据类型可以是 bool、float16、float32、float64、int32、int64。
      别名： ``input``
    - **fill_value** (bool|float|int) - 用于初始化输出 Tensor 的常量数据的值。注意：该参数不可超过输出变量数据类型的表示范围。
    - **dtype** (str|paddle.dtype|np.dtype，可选) - 输出变量的数据类型。若参数为 None，则输出变量的数据类型和输入变量相同，默认值为 None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **device** (PlaceLike|None，可选) - 期望创建 Tensor 所在的设备。若为 None，则与 ``x`` 保持一致。
    - **requires_grad** (bool，可选) - 是否需要为返回的 Tensor 记录梯度信息。默认值为 False。
    - **pin_memory** (bool，可选) - 若为 True，返回的 Tensor 将分配在锁页内存中。默认值为 False。

返回
::::::::::::
返回一个根据 ``x`` 、``fill_value`` 、 ``dtype`` 创建的 Tensor。


代码示例
::::::::::::
COPY-FROM: paddle.full_like

---

## File: docs/api/paddle/gammainc__cn.rst

.. _cn_api_paddle_gammainc_:

gammainc\_
-------------------------------

.. py:function:: paddle.gammainc_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_gammainc` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/gammainc_cn.rst

.. _cn_api_paddle_gammainc:

gammainc
-------------------------------

.. py:function:: paddle.gammainc(x, y, name=None)
计算正则化下不完全伽马函数。

.. math::
    P(x, y) = \frac{1}{\Gamma(x)} \int_{0}^{y} t^{x-1} e^{-t} dt

参数
::::::::::::

    - **x** - 非负参数 Tensor。数据类型必须为 float32， float64。
    - **y** - 正参数 Tensor。数据类型必须为 float32， float64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
输出为 Tensor，计算的正则化下不完全伽马函数值。

代码示例
::::::::::::

COPY-FROM: paddle.gammainc

---

## File: docs/api/paddle/gammaincc__cn.rst

.. _cn_api_paddle_gammaincc_:

gammaincc\_
-------------------------------

.. py:function:: paddle.gammaincc_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_gammaincc` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/gammaincc_cn.rst

.. _cn_api_paddle_gammaincc:

gammaincc
-------------------------------

.. py:function:: paddle.gammaincc(x, y, name=None)
计算正则化上不完全伽马函数。

.. math::
    Q(x, y) = \frac{1}{\Gamma(x)} \int_{y}^{\infty} t^{x-1} e^{-t} dt

参数
::::::::::::

    - **x** - 非负参数 Tensor。数据类型必须为 float32， float64。
    - **y** - 正参数 Tensor。数据类型必须为 float32， float64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
输出为 Tensor，计算的正则化上不完全伽马函数值。

代码示例
::::::::::::

COPY-FROM: paddle.gammaincc

---

## File: docs/api/paddle/gammaln__cn.rst

.. _cn_api_paddle_gammaln_:

gammaln\_
-------------------------------

.. py:function:: paddle.gammaln_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_gammaln` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/gammaln_cn.rst

.. _cn_api_paddle_gammaln:

gammaln
-------------------------------

.. py:function:: paddle.gammaln(x, name=None)

逐元素计算伽马函数的绝对值的自然对数。

参数
::::::::::::

    - **x** - 输入 Tensor。数据类型必须为 float16， float32， float64， bfloat16。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
输出为 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
::::::::::::

COPY-FROM: paddle.gammaln

---

## File: docs/api/paddle/gather_cn.rst

.. _cn_api_paddle_gather:

gather
-------------------------------

.. caution::

    本接口根据输入参数的不同，包含两种不同的功能。

    下面列举的两种功能参数输入方式 **互斥**，混用非公共的参数输入方法将会导致报错，请谨慎使用。

=====

.. py:function:: paddle.gather(x, index, axis=None, name=None)

根据索引 index 获取输入 ``x`` 的指定 ``axis`` 维度的条目，并将它们拼接在一起。

.. code-block:: text

        Given:

        X = [[1, 2],
             [3, 4],
             [5, 6]]

        Index = [1, 2]

        axis = 0

        Then:

        Out = [[3, 4],
               [5, 6]]

下面展示了将一个形状为[3,2]的向量通过 gather 操作，沿着 axis = 0 维度，根据索引 Index = [1, 2] 获取对应的二维张量的例子。若索引为零维，则返回结果为一维张量，例如 Index = 0 ，沿着 axis = 0 维度，则返回位于图片上方的一维张量。

.. image:: ../../images/api_legend/gather.png
   :width: 600
   :alt: 图例

参数
::::::::::::
        - **x** (Tensor) - 输入 Tensor，秩 ``rank >= 1``，支持的数据类型包括 int32、int64、float32、float64、complex64、complex128 和 uint8 (CPU)、float16（GPU） 。
        - **index** (Tensor) - 索引 Tensor，秩 ``rank = 0`` 或者 ``rank = 1``，数据类型为 int32 或 int64。
        - **axis** (Tensor) - 指定 index 获取输入的维度，``axis`` 的类型可以是 int 或者 Tensor，当 ``axis`` 为 Tensor 的时候其数据类型为 int32 或者 int64。默认值为 None，当 ``axis`` 为 None 的时候其值为 0。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，当 index 为一维 Tensor 时，返回和输入 Tensor 的形状相同的 Tensor。当 index 为零维 Tensor 时，返回 Tensor 相对于输入 Tensor 会降维， axis 指向的维度会被降维。


代码示例
::::::::::::

COPY-FROM: paddle.gather

=====

.. py:function:: paddle.gather(input, dim, index, out=None)

PyTorch 兼容的 ``gather`` 操作：根据索引 index 获取输入 ``input`` 的指定 ``dim`` 维度的条目，并将它们拼接在一起。行为与 :ref:`cn_api_paddle_take_along_axis` 在 ``broadcast=False`` 情况下一致。

接口对比可见 `【torch 参数更多】torch.gather`_ 。

.. _【torch 参数更多】torch.gather: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.gather.html

参数
::::::::::::
        - **input** (Tensor) - 输入 Tensor，支持的数据类型包括 int32、int64、float32、float64、int16、uint8、float16（GPU）以及 bfloat16（GPU） 。
        - **dim** (int) - 指定 index 获取输入的维度，``dim`` 的类型可以是 int 或者。
        - **index** (Tensor) - 索引 Tensor，``index`` 张量的各维度需要小于等于 ``input`` 张量的各维度（除 ``dim`` 维度外），且值需要在 ``input.shape[dim]`` 范围内。数据类型为 int32 或 int64。
        - **out** (Tensor，可选) - 用于引用式传入输出值，注意：动态图下 out 可以是任意 Tensor，默认值为 None。

.. caution::

        本接口没有实现 PyTorch 的 ``sparse_grad`` 参数！梯度默认是稠密的，等效于 ``sparse_grad=False``。


返回
::::::::::::
Tensor，与 input 有数据类型，与 ``index`` 有相同的形状。

代码示例
:::::::::

见 :ref:`cn_api_paddle_take_along_axis` 的代码示例。

---

## File: docs/api/paddle/gather_nd_cn.rst

.. _cn_api_paddle_gather_nd:

gather_nd
-------------------------------
.. py:function:: paddle.gather_nd(x, index, name=None)


:code:`gather` 的高维推广，并且支持多轴同时索引。:code:`index` 是一个 K 维度的 Tensor，它可以认为是从 :code:`x` 中取 K-1 维 Tensor，每一个元素是一个切片：

.. math::
    output[(i_0, ..., i_{K-2})] = x[index[(i_0, ..., i_{K-2})]]

显然，:code:`index.shape[-1] <= x.rank` 并且输出 Tensor 的维度是 :code:`index.shape[:-1] + x.shape[index.shape[-1]:]` 。

示例：

::

         给定：
             x = [[[ 0,  1,  2,  3],
                       [ 4,  5,  6,  7],
                       [ 8,  9, 10, 11]],
                      [[12, 13, 14, 15],
                       [16, 17, 18, 19],
                       [20, 21, 22, 23]]]
             x.shape = (2, 3, 4)

         - 案例 1:
             index = [[1]]

             gather_nd(x, index)
                      = [x[1, :, :]]
                      = [[12, 13, 14, 15],
                         [16, 17, 18, 19],
                         [20, 21, 22, 23]]

         - 案例 2:

             index = [[0,2]]
             gather_nd(x, index)
                      = [x[0, 2, :]]
                      = [8, 9, 10, 11]

         - 案例 3:

             index = [[1, 2, 3]]
             gather_nd(x, index)
                      = [x[1, 2, 3]]
                      = [23]


**示例图解说明**：

    下图展示了示例中的情形——一个形状为[2,3,4]的三维张量通过 gather_nd 操作分别输出三个不同的张量。通过比较，可以看出不同 index 下输出张量的差别。

    .. figure:: ../../images/api_legend/gather_nd.png
       :width: 761
       :alt: 示例图示
       :align: center


参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，数据类型可以是 int32、int64、float16、float32、float64、bool。
    - **index** (Tensor) - 输入的索引 Tensor，其数据类型 int32 或者 int64。它的维度 :code:`index.rank` 必须大于 1，并且 :code:`index.shape[-1] <= x.rank` 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::

shape 为 index.shape[:-1] + x.shape[index.shape[-1]:]的 Tensor，数据类型与 :code:`x` 一致。

代码示例
::::::::::::

COPY-FROM: paddle.gather_nd

---

## File: docs/api/paddle/gcd__cn.rst

.. _cn_api_paddle_gcd_:

gcd\_
-------------------------------

.. py:function:: paddle.gcd_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_gcd` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/gcd_cn.rst

.. _cn_api_paddle_gcd:

gcd
-------------------------------

.. py:function:: paddle.gcd(x, y, name=None)

计算两个输入的按元素绝对值的最大公约数，输入必须是整型。

.. note::

    gcd(0,0)=0, gcd(0, y)=|y|

    如果 x 和 y 的 shape 不一致，会对两个 shape 进行广播操作，得到一致的 shape（并作为输出结果的 shape），
    请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::

    - **x**  (Tensor) - 输入的 Tensor，数据类型为：int32，int64。支持别名 ``input`` 。
    - **y**  (Tensor) - 输入的 Tensor，数据类型为：int32，int64。支持别名 ``other`` 。
    - **name**  (str，可选) - 操作的名称（可选，默认值为 None）。更多信息请参见 :ref:`api_guide_Name`。

返回
:::::::::

输出 Tensor，与输入数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.gcd

---

## File: docs/api/paddle/geometric__cn.rst

.. _cn_api_paddle_geometric_:

geometric\_
-------------------------------

.. py:function:: paddle.geometric_(x, probs, name=None)
使用从几何分布中抽取的数据填充 Tensor。

参数
::::::::::::

    - **x** (Tensor) - 被填充的 Tensor ，数据类型为： float32、float64。
    - **probs** (float | Tensor) - 输入的概率参数， probs 的值必须为正，数据类型为 float、Tensor。当该参数类型为 Tensor 时， probs 代表每次试验成功的概率。别名： ``p``。
    - **name** (str ，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
填充了服从几何分布随机数的输入 Tensor。

代码示例
::::::::::::

COPY-FROM: paddle.geometric_

---

## File: docs/api/paddle/ger_cn.rst

.. _cn_api_paddle_ger:

ger
-------------------------------

.. py:function:: paddle.ger(x, y, name=None, *, out=None)

``outer`` 的别名，请参考 :ref:`cn_api_paddle_outer`。

---

## File: docs/api/paddle/get_autocast_dtype_cn.rst

.. _cn_api_paddle_get_autocast_dtype:

get_autocast_dtype
-------------------------------

.. py:function:: paddle.get_autocast_dtype(device_type=None)




获取当前上下文中自动混合精度的默认数据类型。


参数
::::::::::::

    - **device_type** (str, 可选) - 设备类型，默认为 None。注意：在 PaddlePaddle 中所有设备共享同一套自动混合精度配置，实际返回值与设备类型无关。

返回
::::::::::::
字符串，当前上下文中自动混合精度的默认数据类型。


代码示例
::::::::::::

COPY-FROM: paddle.get_autocast_gpu_dtype

---

## File: docs/api/paddle/get_autocast_gpu_dtype_cn.rst

.. _cn_api_paddle_get_autocast_gpu_dtype:

get_autocast_gpu_dtype
-------------------------------

.. py:function:: paddle.get_autocast_gpu_dtype(device_type=None)

``get_autocast_dtype`` 的别名，请参考 :ref:`cn_api_paddle_get_autocast_dtype`。

---

## File: docs/api/paddle/get_cuda_rng_state_cn.rst

.. _cn_api_paddle_get_cuda_rng_state:

get_cuda_rng_state
-------------------------------
.. py:function:: paddle.get_cuda_rng_state()

获取 cuda 随机数生成器的状态信息。

返回
::::::::::::

     GeneratorState：对象。

代码示例
::::::::::::

COPY-FROM: paddle.get_cuda_rng_state

---

## File: docs/api/paddle/get_default_device_cn.rst

.. _cn_api_paddle_get_default_device:

get_default_device
-------------------------------

.. py:function:: paddle.get_default_device()

获取程序当前运行的全局设备信息。

返回一个表示当前设备的字符串，格式可能是：

- 'cpu'
- 'gpu:x' (CUDA 设备)
- 'xpu:x' (XPU 设备)
- 'npu:x' (NPU 设备)

如果全局设备未明确设置，将根据以下规则返回：

- 当 CUDA 可用时返回 'gpu:x'
- 当 CUDA 不可用时返回 'cpu'

返回
:::::::::
str: 表示当前设备的字符串

代码示例
:::::::::
.. code-block:: python

    >>> import paddle
    >>> device = paddle.get_default_device()

---

## File: docs/api/paddle/get_default_dtype_cn.rst

.. _cn_api_paddle_get_default_dtype:

get_default_dtype
-------------------------------

.. py:function:: paddle.get_default_dtype()


得到当前全局的 dtype。该值初始是 float32。

返回
::::::::::::
 string，这个全局 dtype 仅支持 float16、float32、float64。

代码示例
::::::::::::

COPY-FROM: paddle.get_default_dtype

---

## File: docs/api/paddle/get_device_module_cn.rst

.. _cn_api_paddle_get_device_module:

get_device_module
-------------------------------

.. py:function:: paddle.get_device_module(device=None)

获取指定设备对应的 Paddle 模块。

参数
:::::::::
- **device** (_CustomPlaceLike, 可选) - 要查询的设备，可以是以下类型之一:

  - paddle.Place 对象 (例如 paddle.CUDAPlace(0))
  - 字符串 (例如 "gpu:0", "xpu", "npu")
  - 整数 (设备索引，例如 0 -> "gpu:0")
  - None (使用当前预期设备)

返回
:::::::::
module: 对应的 Paddle 设备模块 (例如 paddle.cuda, paddle.device.xpu)


代码示例
:::::::::
.. code-block:: python

    >>> import paddle
    >>> paddle.get_device_module("gpu:0")
    <module 'paddle.cuda' ...>

---

## File: docs/api/paddle/get_flags_cn.rst

.. _cn_api_paddle_get_flags:

get_flags
-------------------------------

.. py:function:: paddle.get_flags(flags)


获取指定的 Paddle 环境变量 FLAGS 状态。详情请查看 :ref:`cn_guides_flags_flags`。

参数
::::::::::::


     - **flags** (list of FLAGS [*]) - 想要获取的 FLAGS 标志列表。

返回
::::::::::::

Flag 的值。


代码示例
::::::::::::

COPY-FROM: paddle.get_flags

---

## File: docs/api/paddle/get_rng_state_cn.rst

.. _cn_api_paddle_get_rng_state:

get_rng_state
-------------------------------
.. py:function:: paddle.get_rng_state(device=None)

获取指定设备的随机数生成器的所有随机状态。

参数
::::::::::::
    - **device** (str) - 此参数决定了具体的运行设备。可以是 ``cpu``、``gpu``、``xpu``。默认值为 None。如果为 None，则返回当前设备（由 ``set_device`` 指定）的生成器。

返回
::::::::::::
    - GeneratorState：对象。

代码示例
::::::::::::

COPY-FROM: paddle.get_rng_state

---

## File: docs/api/paddle/grad_cn.rst

[Binary file]

---

## File: docs/api/paddle/greater_equal__cn.rst

.. _cn_api_paddle_greater_equal_:

greater\_equal\_
-------------------------------

.. py:function:: paddle.greater_equal_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_paddle_greater_equal` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/greater_equal_cn.rst

.. _cn_api_paddle_greater_equal:

greater_equal
-------------------------------
.. py:function:: paddle.greater_equal(x, y, name=None)


逐元素地返回 :math:`x >= y` 的逻辑值，相同位置前者输入大于等于后者输入返回 True，否则返回 False。使用重载算子 ``>=`` 可以有相同的计算函数效果。

.. note::
    输出的结果不返回梯度。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
::::::::::::
输出结果的 Tensor，shape 和输入一致，数据类型为 bool。


代码示例
::::::::::::

COPY-FROM: paddle.greater_equal

---

## File: docs/api/paddle/greater_than__cn.rst

.. _cn_api_paddle_greater_than_:

greater\_than\_
-------------------------------

.. py:function:: paddle.greater_than_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_paddle_greater_than` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/greater_than_cn.rst

.. _cn_api_paddle_greater_than:

greater_than
-------------------------------
.. py:function:: paddle.greater_than(x, y, name=None)


返回 :math:`x>y` 逐元素比较 x 和 y 是否相等，相同位置前者输入大于等于后者输入则返回 True，否则返回 False。使用重载算子 ``>`` 可以有相同的计算函数效果。

.. note::
    输出的结果不返回梯度。

参数
:::::::::
    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
:::::::::
Tensor，输出结果，shape 和输入一致，Tensor 数据类型为 bool。


代码示例
:::::::::

COPY-FROM: paddle.greater_than

---

## File: docs/api/paddle/gt_cn.rst

.. _cn_api_paddle_gt:

gt
-------------------------------

.. py:function:: paddle.gt(x, y, name=None, *, out=None)

``greater_than`` 的别名，请参考 :ref:`cn_api_paddle_greater_than`。

---

## File: docs/api/paddle/heaviside_cn.rst

.. _cn_api_paddle_heaviside:

heaviside
-------------------------------

.. py:function:: paddle.heaviside(x, y, name=None, *, out=None)


为 :attr:`x` 中的每个元素计算由 :attr:`y` 中相对应元素决定的赫维赛德阶跃函数，其计算公式为

.. math::
   \mathrm{heaviside}(x, y)=
      \left\{
            \begin{array}{lcl}
            0,& &\text{if } \ x < 0, \\
            y,& &\text{if } \ x = 0, \\
            1,& &\text{if } \ x > 0.
            \end{array}
      \right.

.. note::
   ``paddle.heaviside`` 遵守广播机制，如您想了解更多，请参见 `Tensor 介绍`_ .

   .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::
   - **x** (Tensor) - 赫维赛德阶跃函数的输入 Tensor。数据类型为 bfloat16、float16、float32、float64、int32 或 int64。别名 ``input``。
   - **y** (Tensor) - 决定了一个赫维赛德阶跃函数的 Tensor。数据类型为 bfloat16、float16、float32、float64、int32 或 int64。别名 ``values``。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
   - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::

``Tensor``，存储运算后的结果。如果 :attr:`x` 和 :attr:`y` 有不同的形状且是可以广播的，那么返回 Tensor 的形状是 :attr:`x` 和 :attr:`y` 经过广播后的形状。如果 :attr:`x` 和 :attr:`y` 有相同的形状，那么返回 Tensor 的形状与 :attr:`x` 和 :attr:`y` 相同。


代码示例
::::::::::

COPY-FROM: paddle.heaviside

---

## File: docs/api/paddle/histc_cn.rst

.. _cn_api_paddle_histc:

histc
-------------------------------

.. py:function:: paddle.histc(input, bins=100, min=0.0, max=0.0, name=None, *, out=None)

计算 Tensor 的直方图。

元素被分配到 min 和 max 之间的等宽区间中（包含边界）。如果 min 和 max 都为零，则使用数据的最小值和最大值。

参数
:::::::::
    - **input** (Tensor) - 输入 Tensor。
    - **bins** (int，可选) - 直方图区间数，默认值为 100。
    - **min** (float，可选) - 范围的下端（包含），默认值为 0.0。
    - **max** (float，可选) - 范围的上端（包含），默认值为 0.0。
    - **name** (str，可选) - 操作名称，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
Tensor：直方图 Tensor，数据类型为 float32。

代码示例
:::::::::

COPY-FROM: paddle.histc

---

## File: docs/api/paddle/histogram_bin_edges_cn.rst

.. _cn_api_paddle_histogram_bin_edges:

histogram_bin_edges
-------------------------------

.. py:function:: paddle.histogram_bin_edges(input, bins=100, min=0.0, max=0.0, name=None)

只返回在计算 ``input`` 的直方图时所使用的 bins 的边界值 bin_edges。如果 min 和 max 都为 0.0，则利用数据中的最大最小值作为边界。

参数
::::::::::::

    - **input** (Tensor) - 输入 Tensor。维度为多维，数据类型为 int32、int64、float32 或 float64。
    - **bins** (int，可选) - 直方图 bins(直条)的个数，默认为 100。
    - **min** (float，可选) - range 的下边界(包含)，默认为 0.0。
    - **max** (float，可选) - range 的上边界(包含)，默认为 0.0。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，计算直方图时所使用的边界值 bin_edges，返回的数据类型为 float32。

代码示例
::::::::::::

COPY-FROM: paddle.histogram_bin_edges

---

## File: docs/api/paddle/histogram_cn.rst

.. _cn_api_paddle_histogram:

histogram
-------------------------------

.. py:function:: paddle.histogram(input, bins=100, min=0.0, max=0.0, weight=None, density=False, name=None)

计算输入 Tensor 的直方图。以 min 和 max 为 range 边界，将其均分成 bins 个直条，然后将排序好的数据划分到各个直条(bins)中。如果 min 和 max 都为 0.0，则利用数据中的最大最小值作为边界。

参数
::::::::::::

    - **input** (Tensor) - 输入 Tensor。维度为多维，数据类型为 int32、int64、float32 或 float64。
    - **bins** (int，可选) - 直方图 bins(直条)的个数，默认为 100。
    - **min** (float，可选) - range 的下边界(包含)，默认为 0.0。
    - **max** (float，可选) - range 的上边界(包含)，默认为 0.0。
    - **weight** (Tensor，可选) - 权重 Tensor，维度和 input 相同。如果提供，输入中的每个值都将以对应的权重值进行计数(而不是 1)。默认为 None。
    - **density** (bool，可选) - 如果为 False，则返回直方图中每个 bin 的计数。如果为 True，则返回直方图中每个 bin 经过归一化后的概率密度函数的值，使得直方图的积分(即所有 bin 的面积)等于 1。默认为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，维度为(nbins,)。如果 density 为 True 或者 weight 不为 None，则返回的 Tensor 的数据类型为 float32；否则为 int64。

代码示例
::::::::::::

COPY-FROM: paddle.histogram

---

## File: docs/api/paddle/histogramdd_cn.rst

.. _cn_api_paddle_histogramdd:

histogramdd
-------------------------------

.. py:function:: paddle.histogramdd(x, bins=10, ranges=None, density=False, weights=None, name=None)

计算输入多维 Tensor 的直方图。将最内维度大小为 N 的输入张量的元素解释为 N 维点的集合。将每个点映射到一组 N 维 bin 中，并返回每个 bin 中的点数（或总权重）

输入 x 必须是具有至少 2 个维度的张量。如果输入具有形状 （M，N） 则其 M 行中的每一行定义 N 维空间中的一个点。如果输入有三个或多个维度，则除最后一个维度外的所有维度都将被展平。


参数
::::::::::::

    - **x** (Tensor) - 输入多维 Tensor 。
    - **bins** (Tensor[]|int[]|int) - 如果为 Tensor 数组，则表示所有 bin 边界。如果为 int 数组，则表示每个维度中等宽 bin 的数量。如果为 int，则表示所有维度的等宽 bin 数量。默认值为 10 ，表示所有维度的等宽 bin 数量为 10 个。
    - **ranges** (float[], 可选) - 表示每个维度中最左边和最右边的 bin 边界。如果为 None ，则将每个尺寸的最小值和最大值设置为最左边和最右边。默认值为 None ，表示自动根据最大值与最小值计算 bin 的边界。
    - **density** (bool，可选) - 表示是否计算 density ，如果为 False，结果将包含每个 bin 中的计数（或权重）。如果为 True，则将每个计数（权重）除以总计数（总权重），然后再除以相关 bin 的宽度。默认值为 False ，表示不计算 density 。
    - **weights** (Tensor，可选) - 表示权重。如果传递 Tensor ，则输入中的每个 N 维坐标将其相关权重贡献给其 bin 的结果。权重应具有与输入张量相同的形状，但不包括其最内维度 N。默认情况下，输入中的每个值的权重为 1 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
包含直方图值的 N 维张量，包含 bin 边界信息的 N 个 1D tensor 的序列。

代码示例
::::::::::::

COPY-FROM: paddle.histogramdd

---

## File: docs/api/paddle/hsplit_cn.rst

.. _cn_api_paddle_hsplit:

hsplit
-------------------------------

.. py:function:: paddle.hsplit(x, num_or_indices, name=None)



``hsplit`` 全称 Horizontal Split ，即水平分割，将输入 Tensor 沿着水平轴分割成多个子 Tensor，存在以下两种情况：

1. 当 x 的维度等于 1 时，等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 0；

   .. image:: ../../images/api_legend/hsplit/hsplit-1.png
      :alt: 当 x 的维度等于 1 时

2. 当 x 的维度大于 1 时，等价于将 :ref:`cn_api_paddle_tensor_split` API 的参数 axis 固定为 1。

   .. image:: ../../images/api_legend/hsplit/hsplit-2.png
      :alt: 当 x 的维度大于 1 时

参数
:::::::::
       - **x** (Tensor) - 输入变量，数据类型为 bool、bfloat16、float16、float32、float64、uint8、int8、int32、int64 的多维 Tensor，其维度必须大于 0。
       - **num_or_indices** (int|list|tuple) - 如果 ``num_or_indices`` 是一个整数 ``n`` ，则 ``x`` 拆分为 ``n`` 部分。如果 ``num_or_indices`` 是整数索引的列表或元组，则在每个索引处分割 ``x`` 。
       - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::

list[Tensor]，分割后的 Tensor 列表。


代码示例
:::::::::

COPY-FROM: paddle.hsplit

---

## File: docs/api/paddle/hstack_cn.rst

.. _cn_api_paddle_hstack:

hstack
-------------------------------

.. py:function:: paddle.hstack(x, name=None, *, out=None)

沿水平轴堆叠输入 ``x`` 中的所有张量。所有张量必须具有相同的数据类型。

参数
::::::::::::

    - **x** (list[Tensor]|tuple[Tensor]) - 输入 ``x`` 可以是张量的 list 或 tuple， ``x`` 中张量的数据类型必须相同。支持的数据类型： ``float16`` 、 ``float32`` 、 ``float64`` 、 ``int8`` 、 ``int32`` 、 ``int64`` 或 ``bfloat16`` 。别名 ``tensors``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
Tensor，与输入数据类型相同的堆叠张量。

也可以参考下方的图示来理解 ``hstack`` 是如何对张量进行变换的。

.. image:: ../../images/api_legend/hstack.png
   :width: 500
   :alt: 图例

代码示例
::::::::::::

COPY-FROM: paddle.hstack

---

## File: docs/api/paddle/hypot__cn.rst

.. _cn_api_paddle_hypot_:

hypot\_
-------------------------------

.. py:function:: paddle.hypot_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_hypot` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/hypot_cn.rst

[Binary file]

---

## File: docs/api/paddle/i0__cn.rst

.. _cn_api_paddle_i0_:

i0\_
-------------------------------

.. py:function:: paddle.i0_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_i0` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/i0_cn.rst

.. _cn_api_paddle_i0:

i0
-------------------------------

.. py:function:: paddle.i0(x, name=None)


对于给定 ``x`` 计算其每个元素的第一类零阶修正贝塞尔曲线函数，其中输入 ``x`` 大小无特殊限制。返回一个第一类零阶修正贝塞尔曲线函数上的 Tensor。

.. math::
    I_0(x)=\sum^{\infty}_{k=0}\frac{(x^2/4)^k}{(k!)^2}

参数
::::::::::
    - **x** (Tensor) – 输入是一个多维的 Tensor，它的数据类型可以是 float32，float64。
    - **name** (str，可选) - 具体用法请参见  :ref:`api_guide_Name` ，一般无需设置，默认值为 ``None``。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::
    - ``Tensor`` (Tensor)：在 x 处的第一类零阶修正贝塞尔曲线函数的值。


代码示例
::::::::::

COPY-FROM: paddle.i0

---

## File: docs/api/paddle/i0e_cn.rst

.. _cn_api_paddle_i0e:

i0e
-------------------------------

.. py:function:: paddle.i0e(x, name=None)


对于给定 ``x`` 计算其每个元素的第一类指数缩放零阶修正贝塞尔曲线函数，其中输入 ``x`` 大小无特殊限制。返回一个第一类指数缩放零阶修正贝塞尔曲线函数上的 Tensor。

.. math::
    I_0(x)=\sum^{\infty}_{k=0}\frac{(x^2/4)^k}{(k!)^2} \\
    I_{0e}(x)=e^{-\lvert x\rvert}I_0(x)

参数
::::::::::
    - **x** (Tensor) – 输入是一个多维的 Tensor，它的数据类型可以是 float32，float64。
    - **name** (str，可选) - 具体用法请参见  :ref:`api_guide_Name` ，一般无需设置，默认值为 ``None``。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::
    - ``Tensor`` (Tensor)：在 x 处的第一类指数缩放零阶修正贝塞尔曲线函数的值。


代码示例
::::::::::

COPY-FROM: paddle.i0e

---

## File: docs/api/paddle/i1_cn.rst

.. _cn_api_paddle_i1:

i1
-------------------------------

.. py:function:: paddle.i1(x, name=None, *, out=None)
对于给定 ``x`` 计算其每个元素的第一类一阶修正贝塞尔曲线函数，其中输入 ``x`` 大小无特殊限制。返回第一类一阶修正贝塞尔函数对应输出 Tensor。

.. math::
    I_1(x)=\frac{\left(\text { x }_{i}\right)}{2} * \sum_{k=0}^{\infty} \frac{\left(\text{x}_{i}^{2} / 4\right)^{k}}{(k !) *(k+1) !}

参数
::::::::::
    - **x** (Tensor) – 输入是一个多维的 Tensor，它的数据类型可以是 float32，float64。
    - **name** (str，可选) - 具体用法请参见  :ref:`api_guide_Name` ，一般无需设置，默认值为 ``None``。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::
    - ``Tensor`` (Tensor)：在 x 处的第一类一阶修正贝塞尔曲线函数的值。


代码示例
::::::::::

COPY-FROM: paddle.i1

---

## File: docs/api/paddle/i1e_cn.rst

.. _cn_api_paddle_i1e:

i1e
-------------------------------

.. py:function:: paddle.i1e(x, name=None, *, out=None)
对于给定 ``x`` 计算其每个元素的第一类指数缩放的一阶修正贝塞尔曲线函数，其中输入 ``x`` 大小无特殊限制。返回第一类指数缩放的一阶修正贝塞尔函数对应输出 Tensor。

.. math::
    I_1e(x)=\exp (-|x|) * i 1(x)=\exp (-|x|) * \frac{\left(\text { input }_{i}\right)}{2} * \sum_{k=0}^{\infty} \frac{\left(\text { input }_{i}^{2} / 4\right)^{k}}{(k !) *(k+1) !}

参数
::::::::::
    - **x** (Tensor) – 输入是一个多维的 Tensor，它的数据类型可以是 float32，float64。
    - **name** (str，可选) - 具体用法请参见  :ref:`api_guide_Name` ，一般无需设置，默认值为 ``None``。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::
    - ``Tensor`` (Tensor)：在 x 处的第一类指数缩放的一阶修正贝塞尔曲线函数的值。


代码示例
::::::::::

COPY-FROM: paddle.i1e

---

## File: docs/api/paddle/iinfo_cn.rst

[Binary file]

---

## File: docs/api/paddle/imag_cn.rst

.. _cn_api_paddle_imag:

imag
------

.. py:function:: paddle.imag(x, name=None)

返回一个包含输入复数 Tensor 的虚部数值的新 Tensor。

参数
::::::::::::

    - **x** (Tensor) - 输入的 Tensor，其数据类型可以为 complex64 或 complex128。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，包含原复数 Tensor 的虚部数值。

代码示例
::::::::::::

COPY-FROM: paddle.imag

---

## File: docs/api/paddle/in_dynamic_mode_cn.rst

.. _cn_api_paddle_in_dynamic_mode:

in_dynamic_mode
-------------------------------

.. py:function:: paddle.in_dynamic_mode()

.. note::
    从 2.0.0 版本开始，Paddle 默认开启动态图模式。

该接口查看 paddle 当前是否在动态图模式中运行。

可以通过 :ref:`cn_api_paddle_enable_static` 开启静态图模式，:ref:`cn_api_paddle_disable_static` 关闭静态图模式。

返回
::::::::::::
bool，如果 paddle 当前是在动态图模式运行，则返回 ``True``，否则返回 ``False``。


代码示例
::::::::::::

COPY-FROM: paddle.in_dynamic_mode

---

## File: docs/api/paddle/increment_cn.rst

.. _cn_api_paddle_increment:

increment
-------------------------------

.. py:function:: paddle.increment(x, value=1.0, name=None)




在控制流程中用来让参数 ``x`` 的数值增加 ``value``。

参数
:::::::::

  - **x** (Tensor) – 输入 Tensor，必须始终只有一个元素。支持的数据类型：float32、float64、int32、int64。
  - **value** (float，可选) – ``x`` 的数值增量。默认值为 1.0。
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::

Tensor，形状和数据类型同输入 ``x``。


代码示例
::::::::::::

COPY-FROM: paddle.increment

---

## File: docs/api/paddle/index_add__cn.rst

.. _cn_api_paddle_index_add_:

index_add\_
-------------------------------

.. py:function::  paddle.index_add_(x, index, axis, value, name=None)

Inplace 版本的 :ref:`cn_api_paddle_index_add` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/index_add_cn.rst

.. _cn_api_paddle_index_add:

index_add
-------------------------------

.. py:function:: paddle.index_add(x, index, axis, value, name=None)



沿着指定轴 ``axis`` 将 ``index`` 中指定位置的 ``x`` 与 ``value`` 相加，并写入到结果 Tensor 中的对应位置。这里 ``index`` 是一个 ``1-D`` Tensor。除 ``axis`` 轴外，返回的 Tensor 其余维度大小和输入 ``x`` 相等， ``axis`` 维度的大小等于 ``index`` 的大小。

**示例**

::

    - 示例 1 （输入为 2-D Tensor, axis=0 ）：
        输入：
            x.shape = [3, 3]
            x.data = [[1., 1., 1.],
                      [1., 1., 1.],
                      [1., 1., 1.]]

        参数：
            index.shape = [2]
            index.data = [0, 2]

            axis = 0

            value.shape = [2, 3]
            value.data = [[1., 1., 1.],
                          [1., 1., 1.]]
        输出：
            out.shape = [3, 3]
            out.data = [[2., 2., 2.],
                        [1., 1., 1.],
                        [2., 2., 2.]]

    - 示例 2 （输入为 2-D Tensor, axis=1 ）：
        输入：
            x.shape = [3, 3]
            x.data = [[1., 1., 1.],
                      [1., 1., 1.],
                      [1., 1., 1.]]

        参数：
            index.shape = [2]
            index.data = [0, 2]

            axis = 1

            value.shape = [3, 2]
            value.data = [[1., 1.],
                          [1., 1.],
                          [1., 1.]]
        输出：
            out.shape = [3, 3]
            out.data = [[2., 1., 2.],
                        [2., 1., 2.],
                        [2., 1., 2.]]

**示例 1 图解说明**

    下图展示了示例 1 中的情形——一个形状为 [3,3] 的二维张量通过 index_add 操作在 axis=0 轴上对指定位置的元素进行相加，同时保持了除 ``axis`` 轴外，返回的 Tensor 其余维度大小和输入 ``x`` 相等。

    .. figure:: ../../images/api_legend/index_add/index_add-1.png
        :width: 500
        :alt: 示例 1 图示
        :align: center

**示例 2 图解说明**

    下图展示了示例 2 中的情形——一个形状为 [3,3] 的二维张量通过 index_add 操作在 axis=1 轴上对指定位置的元素进行相加，同时保持了除 ``axis`` 轴外，返回的 Tensor 其余维度大小和输入 ``x`` 相等。

    .. figure:: ../../images/api_legend/index_add/index_add-2.png
        :width: 500
        :alt: 示例 2 图示
        :align: center

参数
:::::::::

    - **x** (Tensor) - 输入 Tensor。 ``x`` 的数据类型可以是 float16，float32，float64，int32，int64。
    - **index** (Tensor) - 包含索引下标的 1-D Tensor。数据类型为 int32 或者 int64。
    - **axis** (int) - 索引轴。数据类型为 int。
    - **value** (Tensor) - 与 ``x`` 相加的 Tensor。 ``value`` 的数据类型同 ``x`` 。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::

Tensor，返回一个数据类型同输入的 Tensor。


代码示例
::::::::::::

COPY-FROM: paddle.index_add

---

## File: docs/api/paddle/index_fill__cn.rst

.. _cn_api_paddle_index_fill_:

index_fill\_
-------------------------------

.. py:function:: paddle.index_fill_(x, index, axis, value, name=None)

Inplace 版本的 :ref:`cn_api_paddle_index_fill` API

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/index_fill_cn.rst

.. _cn_api_paddle_index_fill:

index_fill
-------------------------------

.. py:function:: paddle.index_fill(x, index, axis, value, name=None)

依据指定的轴/维度和索引将指定位置的张量填充为指定值。

本 API 支持两种调用方式：

1. **Paddle 风格**： ``paddle.index_fill(x, index, axis, value, name=None)``
   使用 Paddle 风格的参数顺序和命名。

2. **PyTorch 风格**： ``paddle.index_fill(input, dim, index, value)``
   使用 PyTorch 风格的参数顺序和命名。

**图解说明**：

    一个形状为 [3, 3] 的二维张量，通过 index_fill 操作，当 axis = 0，索引张量 index 为 [0, 2]，填充值 value = -1 时，将第一行和第三行的所有元素填充为 -1，从而得到形状仍为 [3, 3] 但元素部分改变的新张量。

    .. figure:: ../../images/api_legend/index_fill.png
        :width: 500
        :align: center

参数
:::::::::
    - **x** (Tensor) – 输入张量。 ``x`` 的数据类型可以是 ``float16``、 ``float32``、 ``float64``、 ``int32``、 ``int64``。
    - **index** (Tensor) – 包含索引下标的 1-D Tensor。数据类型可以是 ``int32``、 ``int64``。
    - **axis** (int) – 索引轴。数据类型为 ``int``。
    - **value** (float) – 用于填充目标张量的值。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 ``None``。

返回
:::::::::

Tensor，返回一个数据类型同输入的 Tensor。

代码示例
::::::::::::

COPY-FROM: paddle.index_fill

---

## File: docs/api/paddle/index_put__cn.rst

.. _cn_api_paddle_index_put_:

index_put\_
-------------------------------

.. py:function:: paddle.index_put_(x, indices, value, accumulate=False, name=None)

Inplace 版本的 :ref:`cn_api_paddle_index_put` API

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/index_put_cn.rst

[Binary file]

---

## File: docs/api/paddle/index_sample_cn.rst

.. _cn_api_paddle_index_sample:

index_sample
-------------------------------

.. py:function:: paddle.index_sample(x, index)




对输入 ``x`` 中的元素进行批量抽样，取 ``index`` 指定的对应下标的元素，按 index 中出现的先后顺序组织，填充为一个新的 Tensor。

 ``x`` 与 ``index`` 都是 ``2-D`` Tensor。``index`` 的第一维度与输入 ``x`` 的第一维度必须相同，``index`` 的第二维度没有大小要求，可以重复索引相同下标元素。

参数
:::::::::

    - **x** （Tensor）– 输入的二维 Tensor，数据类型为 int32、int64、bfloat16、float16、float32、float64。
    - **index** （Tensor）– 包含索引下标的二维 Tensor。数据类型为 int32、int64。

返回
:::::::::
Tensor，数据类型与输入 ``x`` 相同，维度与 ``index`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.index_sample

---

## File: docs/api/paddle/index_select_cn.rst

[Binary file]

---

## File: docs/api/paddle/inference_mode_cn.rst

.. _cn_api_paddle_inference_mode:

inference_mode
-------------------------------

.. py:class:: paddle.inference_mode(mode=True)



创建一个上下文管理器或装饰器，用于启用或禁用推理模式。

在该模式下，每次计算的结果都将具有 ``stop_gradient=True``。当 ``mode=False`` 时，将启用梯度计算。

也可以用作一个装饰器。

参数
::::::::::::

    - **mode** (bool，可选) - 是否启用推理模式。默认值为 True。

代码示例
::::::::::::

COPY-FROM: paddle.inference_mode

---

## File: docs/api/paddle/inner_cn.rst

.. _cn_api_paddle_inner:

inner
-------------------------------

.. py:function:: paddle.inner(x, y, name=None, *, out=None)

计算两个 Tensor 的内积。

对于 1 维 Tensor 计算普通内积，对于大于 1 维的 Tensor 计算最后一个维度的乘积和，此时两个输入 Tensor 最后一个维度长度需要相等。

参数
::::::::::::

    - **x** (Tensor) - 一个 N 维 Tensor 或者标量 Tensor，如果是 N 维 Tensor 最后一个维度长度需要跟 y 保持一致。别名 ``input``。
    - **y** (Tensor) - 一个 N 维 Tensor 或者标量 Tensor，如果是 N 维 Tensor 最后一个维度长度需要跟 x 保持一致。别名 ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::

    - Tensor, x、y 的内积结果，Tensor shape 为 x.shape[:-1] + y.shape[:-1]。

代码示例：
::::::::::

COPY-FROM: paddle.inner

---

## File: docs/api/paddle/inverse_cn.rst

.. _cn_api_paddle_inverse:

inverse
-------------------------------

.. py:function:: paddle.inverse(x, name=None, *, out=None)

计算方阵的逆矩阵。方阵是行数和列数相同的矩阵。输入可以是一个方阵（2-D Tensor）或者多个方阵组成的 batch（batch of square matrices）。

参数
::::::::::::
    - **x** (Tensor) - 输入 Tensor，最后两个维度应相等。当维度大于 2 时，视为方阵的 batch。数据类型为 float32、float64、complex64、complex128。别名 ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
Tensor，``x`` 的逆矩阵，维度和数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.inverse

---

## File: docs/api/paddle/is_autocast_enabled_cn.rst

.. _cn_api_paddle_is_autocast_enabled:

is_autocast_enabled
-------------------------------

.. py:function:: paddle.is_autocast_enabled(device_type=None)




获取当前上下文中是否启用了自动混合精度。


参数
::::::::::::

    - **device_type** (str, 可选) - 设备类型，默认为 None。注意：在 PaddlePaddle 中所有设备共享同一套自动混合精度配置，实际返回值与设备类型无关。

返回
::::::::::::
布尔值，如果当前上下文中启用了自动混合精度，则返回 ``True``，否则返回 ``False``。


代码示例
::::::::::::

COPY-FROM: paddle.is_autocast_enabled

---

## File: docs/api/paddle/is_complex_cn.rst

.. _cn_api_paddle_is_complex:

is_complex
-------------------------------

.. py:function:: paddle.is_complex(x)

判断输入 tensor 的数据类型是否为复数类型(complex64 或者 complex128)。

.. note::
   别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
:::::::::
   - **x** (Tensor) - 输入 Tensor。别名： ``input``。


返回
:::::::::
bool，如果输入 tensor 的数据类型为复数类型则为 True，反之为 False


代码示例
:::::::::

COPY-FROM: paddle.is_complex

---

## File: docs/api/paddle/is_empty_cn.rst

.. _cn_api_paddle_is_empty:

is_empty
-------------------------------

.. py:function:: paddle.is_empty(x, name=None)




测试输入 Tensor x 是否为空。

参数
::::::::::::

   - **x** (Tensor) - 测试的 Tensor。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，布尔类型的 Tensor，如果输入 Tensor x 为空则值为 True。


代码示例
::::::::::::

COPY-FROM: paddle.is_empty

---

## File: docs/api/paddle/is_floating_point_cn.rst

.. _cn_api_paddle_is_floating_point:

is_floating_point
-------------------------------

.. py:function:: paddle.is_floating_point(x)
判断输入 Tensor 的数据类型是否为浮点类型。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``is_floating_point(input=tensor_x)`` 等价于 ``is_floating_point(x=tensor_x)`` 。

参数
:::::::::

    - **x**  (Tensor) - 输入的 Tensor。别名： ``input``。

返回
:::::::::

bool，输入 tensor 的数据类型为浮点数类型则为 True，反之为 False.

代码示例
:::::::::

COPY-FROM: paddle.is_floating_point

---

## File: docs/api/paddle/is_grad_enabled_cn.rst

.. _cn_api_paddle_is_grad_enabled:

is_grad_enabled
-------------------------------

.. py:function:: paddle.is_grad_enabled()
判断当前动态图下是否启用了计算梯度模式。

返回
:::::::::

bool，判断当前动态图是否启用了计算梯度的模式，若是则为 True，反之为 False。

代码示例
:::::::::

COPY-FROM: paddle.is_grad_enabled

---

## File: docs/api/paddle/is_integer_cn.rst

.. _cn_api_paddle_is_integer:

is_integer
-------------------------------

.. py:function:: paddle.is_integer(x)


判断输入 tensor 的数据类型是否为整数类型。

参数
:::::::::
   - **x** (Tensor) - 输入 Tensor


返回
:::::::::
bool，输入 tensor 的数据类型为整数类型则为 True，反之为 False


代码示例
:::::::::

COPY-FROM: paddle.is_integer

---

## File: docs/api/paddle/is_tensor_cn.rst

.. _cn_api_paddle_is_tensor:

is_tensor
-------------------------------
.. py:function:: paddle.is_tensor(x)


测试输入对象是否是 ``paddle.Tensor``

.. note::
    别名支持: 参数名 ``obj`` 可替代 ``x``，如 ``is_tensor(obj=tensor_x)`` 等价于 ``is_tensor(x=tensor_x)`` 。

参数
::::::::::::

    - **x** (Object) - 测试的对象。别名： ``obj``。


返回
::::::::::::
bool 值，如果 x 是 ``paddle.Tensor`` 类型返回 True，反之返回 False。

代码示例
::::::::::::

COPY-FROM: paddle.is_tensor

---

## File: docs/api/paddle/isclose_cn.rst

[Binary file]

---

## File: docs/api/paddle/isfinite_cn.rst

.. _cn_api_paddle_isfinite:

isfinite
-----------------------------

.. py:function:: paddle.isfinite(x, name=None)

返回输入 Tensor 的每一个值是否为有限值（既非 ``+/-INF`` 也非 ``+/-NaN`` ）。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
:::::::::
    - **x** (Tensor)：输入的 ``Tensor``，数据类型为：float16、float32、float64、int32、int64、complex64、complex128。
      别名： ``input``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，每个元素是一个 bool 值，表示输入 ``x`` 的每个元素是否为有限值（既非 ``+/-INF`` 也非 ``+/-NaN`` ）。

代码示例
:::::::::

COPY-FROM: paddle.isfinite

---

## File: docs/api/paddle/isin_cn.rst

.. _cn_api_paddle_isin:

isin
-----------------------------

.. py:function:: paddle.isin(x, test_x, assume_unique=False, invert=False, name=None)

检验 ``x`` 中的每一个元素是否在 ``test_x`` 中。

.. note::
    别名支持: 参数名 ``elements`` 可替代 ``x``，参数名 ``test_elements`` 可替代 ``test_x``，如 ``isin(elements=tensor1, test_elements=tensor2)`` 等价于 ``isin(x=tensor1, test_x=tensor2)`` 。

参数
:::::::::
    - **x** (Tensor) - 输入的 tensor，数据类型为：'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64'。别名： ``elements``。
    - **test_x** (Tensor) - 用于检验的 tensor，数据类型为：'bfloat16', 'float16', 'float32', 'float64', 'int32', 'int64'。别名： ``test_elements``。
    - **assume_unique** (bool，可选) - 如果设置为 True，表示 ``x`` 与 ``test_x`` 的元素均是唯一的，这种情况可以提升计算的速度。默认值为 False。
    - **invert** (bool，可选) - 是否输出反转的结果。如果为 True，表示将结果反转。默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，输出的 tensor 与输入 ``x`` 形状相同。

代码示例
:::::::::

COPY-FROM: paddle.isin

---

## File: docs/api/paddle/isinf_cn.rst

.. _cn_api_paddle_isinf:

isinf
-----------------------------

.. py:function:: paddle.isinf(x, name=None)

返回输入 tensor 的每一个值是否为 ``+/-INF`` 。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
:::::::::
    - **x** (Tensor)：输入的 ``Tensor``，数据类型为：float16、float32、float64、uint8、int8、int16、int32、int64、complex64、complex128。
      别名： ``input``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，每个元素是一个 bool 值，表示输入 ``x`` 的每个元素是否为 ``+/-INF`` 。

代码示例
:::::::::

COPY-FROM: paddle.isinf

---

## File: docs/api/paddle/isnan_cn.rst

.. _cn_api_paddle_isnan:

isnan
-----------------------------

.. py:function:: paddle.isnan(x, name=None)

返回输入 tensor 的每一个值是否为 ``+/-NaN`` 。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
:::::::::
    - **x** (Tensor) - 输入的 ``Tensor``，数据类型为：float16、float32、float64、int32、int64、complex64、complex128。
      别名： ``input``
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，每个元素是一个 bool 值，表示输入 ``x`` 的每个元素是否为 ``+/-NaN`` 。

代码示例
:::::::::

COPY-FROM: paddle.isnan

---

## File: docs/api/paddle/isneginf_cn.rst

.. _cn_api_paddle_isneginf:

isneginf
-----------------------------

.. py:function:: paddle.isneginf(x, name=None, *, out=None)

返回输入 tensor 的每一个值是否为 ``-INF`` 。

参数
:::::::::
    - **x** (Tensor)：输入的 ``Tensor``，数据类型为：float16、float32、float64、int8、int16、int32、int64、uint8。别名: ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
``Tensor``，每个元素是一个 bool 值，表示输入 ``x`` 的每个元素是否为 ``-INF`` 。

代码示例
:::::::::

COPY-FROM: paddle.isneginf

---

## File: docs/api/paddle/isposinf_cn.rst

.. _cn_api_paddle_isposinf:

isposinf
-----------------------------

.. py:function:: paddle.isposinf(x, name=None, *, out=None)

返回输入 tensor 的每一个值是否为 ``+INF`` 。

参数
:::::::::
    - **x** (Tensor)：输入的 ``Tensor``，数据类型为：bfloat16、float16、float32、float64、int8、int16、int32、int64、uint8。别名: ``input``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
``Tensor``，每个元素是一个 bool 值，表示输入 ``x`` 的每个元素是否为 ``+INF`` 。

代码示例
:::::::::

COPY-FROM: paddle.isposinf

---

## File: docs/api/paddle/isreal_cn.rst

.. _cn_api_paddle_isreal:

isreal
-------------------------------

.. py:function:: paddle.isreal(x, name=None)


判断输入 tensor 的每一个值是否为实数类型(非 complex64 或者 complex128)。

参数
:::::::::
   - **x** (Tensor) - 输入 Tensor。别名: ``input``。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，每个元素是一个 bool 值，表示输入 ``x`` 的每个元素是否为实数类型。


代码示例
:::::::::

COPY-FROM: paddle.isreal

---

## File: docs/api/paddle/kaiser_window_cn.rst

.. _cn_api_paddle_kaiser_window:

kaiser_window
-------------------------------

.. py:function:: paddle.kaiser_window(window_length, periodic=True, beta=12.0, *, dtype='float32', layout=None, device=None, pin_memory=False, requires_grad=False, out=None)

计算 Kaiser 窗。

参数
::::::::::::

    - **window_length** (int) - 返回窗的长度，必须为正数。
    - **periodic** (bool，可选) - 若为 True，则返回适用于周期函数的窗；若为 False，则返回对称窗。默认值为 True。
    - **beta** (float，可选) - 窗函数的形状参数。默认值为 12.0。

关键字参数
::::::::::::

    - **dtype** (str，可选) - 返回 Tensor 的数据类型。默认值为 ``'float32'``。
    - **layout** (str，可选) - 仅为与 PyTorch API 保持一致而保留，在 Paddle 中会被忽略。默认值为 None。
    - **device** (PlaceLike|None，可选) - 返回 Tensor 所在的设备。若为 None，则使用当前设备。默认值为 None。
    - **pin_memory** (bool，可选) - 是否将返回 Tensor 分配在锁页内存中，仅对 CPU Tensor 生效。默认值为 False。
    - **requires_grad** (bool，可选) - 是否为返回 Tensor 记录自动求导。默认值为 False。
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::

Tensor：形状为 ``(window_length,)`` 的一维 Tensor，包含 Kaiser 窗。

代码示例
::::::::::::

COPY-FROM: paddle.kaiser_window

---

## File: docs/api/paddle/kron_cn.rst

[Binary file]

---

## File: docs/api/paddle/kthvalue_cn.rst

.. _cn_api_paddle_kthvalue:

kthvalue
-------------------------------

.. py:function:: paddle.kthvalue(x, k, axis=None, keepdim=False, name=None, *, out=None)

在指定的轴上查找第 k 小的元素和其对应所在的索引信息。

参数
:::::::::
    - **x** （Tensor） - 一个输入的 N-D ``Tensor``，支持的数据类型：float16、float32、float64、int32、int64。别名 ``input``。
    - **k** （int，Tensor） - 需要沿轴查找的第 ``k`` 小，所对应的 ``k`` 值。
    - **axis** （int，可选） - 指定对输入 Tensor 进行运算的轴，``axis`` 的有效范围是[-R, R），R 是输入 ``x`` 的 Rank， ``axis`` 为负时与 ``axis`` + R 等价。默认值为-1。别名 ``dim``。
    - **keepdim** (bool，可选）- 是否保留指定的轴。如果是 True，维度会与输入 x 一致，对应所指定的轴的 size 为 1。否则，由于对应轴被展开，输出的维度会比输入小 1。默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
tuple（Tensor），返回第 k 小的元素和对应的索引信息。结果的数据类型和输入 ``x`` 一致。索引的数据类型是 int64。

代码示例
:::::::::

COPY-FROM: paddle.kthvalue

---

## File: docs/api/paddle/LazyGuard_cn.rst

.. _cn_api_paddle_LazyGuard:

LazyGuard
-------------------------------

.. py:class:: paddle.LazyGuard()



LazyGuard 是一个用于设置模型（继承自 ``paddle.nn.Layer`` ） 中参数延迟初始化的上下文管理器。配合使用 python 的 ``with`` 语句来将 ``with LazyGuard():`` 代码块下所有模型在实例化时，其内部的参数均不会立即申请内存空间。


代码示例
::::::::::::

COPY-FROM: paddle.LazyGuard

---

## File: docs/api/paddle/lcm__cn.rst

.. _cn_api_paddle_lcm_:

lcm\_
-------------------------------

.. py:function:: paddle.lcm_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_paddle_lcm` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/lcm_cn.rst

.. _cn_api_paddle_lcm:

lcm
-------------------------------

.. py:function:: paddle.lcm(x, y, name=None)

计算两个输入的按元素绝对值的最小公倍数，输入必须是整型。

.. note::

    lcm(0,0)=0, lcm(0, y)=0

    如果 x 和 y 的 shape 不一致，会对两个 shape 进行广播操作，得到一致的 shape（并作为输出结果的 shape），
    请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::

    - **x**  (Tensor) - 输入的 Tensor，数据类型为：int32，int64。支持别名 ``input`` 。
    - **y**  (Tensor) - 输入的 Tensor，数据类型为：int32，int64。支持别名 ``other`` 。
    - **name**  (str，可选) - 操作的名称（可选，默认值为 None）。更多信息请参见 :ref:`api_guide_Name`。

返回
:::::::::

输出 Tensor，与输入数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.lcm

---

## File: docs/api/paddle/ldexp__cn.rst

.. _cn_api_paddle_ldexp_:

ldexp\_
-------------------------------

.. py:function:: paddle.ldexp_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_ldexp` API，对输入 ``x`` 采用 Inplace 策略。
更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/ldexp_cn.rst

.. _cn_api_paddle_ldexp:

ldexp
-------------------------------

.. py:function:: paddle.ldexp(x, y, name=None, *, out=None)

计算 ``x`` 乘以 2 的 ``y`` 次幂

.. math::
    out = x * 2^{y}

参数
::::::::::::

    - **x** (Tensor) - 多维 Tensor。数据类型为 float32、float64、int32、int64。别名：``input``。
    - **y** (Tensor) - 多维 Tensor。通常为整数。别名：``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
输出为 Tensor，如果 ``x``， ``y`` 有不同的形状并且是可广播的，那么产生的张量形状是广播后 x 和 y 的形状。如果 ``x``， ``y`` 有相同的形状，其形状与 ``x``， ``y``  相同。数据类型是 float32 或 float64。

代码示例
::::::::::::

COPY-FROM: paddle.ldexp

---

## File: docs/api/paddle/lerp__cn.rst

.. _cn_api_paddle_lerp_:

lerp\_
-------------------------------

.. py:function:: paddle.lerp_(x, y, weight, name=None)

Inplace 版本的 :ref:`cn_api_paddle_lerp` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/lerp_cn.rst

.. _cn_api_paddle_lerp:

lerp
-------------------------------

.. py:function:: paddle.lerp(x, y, weight, name=None, *, out=None)
基于给定的 weight 计算 x 与 y 的线性插值

.. math::
    lerp(x, y, weight) = x + weight * (y - x)
参数
:::::::::

    - **x**  (Tensor) - 输入的 Tensor，作为线性插值开始的点，数据类型为：bfloat16、float16、float32、float64。别名 ``input``。
    - **y**  (Tensor) - 输入的 Tensor，作为线性插值结束的点，数据类型为：bfloat16、float16、float32、float64。别名 ``end``。
    - **weight**  (float|Tensor) - 给定的权重值，weight 为 Tensor 时数据类型为：bfloat16、float16、float32、float64。
    - **name**  (str，可选） - 操作的名称(可选，默认值为 None）。更多信息请参见 :ref:`api_guide_Name`。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::

输出 Tensor，与 ``x`` 数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.lerp

---

## File: docs/api/paddle/less__cn.rst

.. _cn_api_paddle_less_:

less\_
-------------------------------

.. py:function:: paddle.less_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_less` API，对输入 ``x`` 采用 Inplace 策略。
更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/less_cn.rst

.. _cn_api_paddle_less:

less
-------------------------------
.. py:function:: paddle.less(x, y, name=None)


逐元素地返回 :math:`x < y` 的逻辑值，相同位置前者输入小于后者输入则返回 True，否则返回 False。使用重载算子 ``<`` 可以有相同的计算函数效果。

.. note::
    输出的结果不返回梯度。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
::::::::::::
输出结果的 Tensor，输出 Tensor 的 shape 和输入一致，Tensor 数据类型为 bool。


代码示例
::::::::::::

COPY-FROM: paddle.less

---

## File: docs/api/paddle/less_equal__cn.rst

.. _cn_api_paddle_less_equal_:

less\_equal\_
-------------------------------

.. py:function:: paddle.less_equal_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_less_equal` API，对输入 ``x`` 采用 Inplace 策略。
更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/less_equal_cn.rst

.. _cn_api_paddle_less_equal:

less_equal
-------------------------------
.. py:function:: paddle.less_equal(x, y, name=None)


逐元素地返回 :math:`x <= y` 的逻辑值，相同位置前者输入小于等于后者输入则返回 True，否则返回 False。使用重载算子 ``<=`` 可以有相同的计算函数效果。

.. note::
    输出的结果不返回梯度。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
::::::::::::
输出结果的 Tensor，输出 Tensor 的 shape 和输入一致，Tensor 数据类型为 bool。

代码示例
::::::::::::

COPY-FROM: paddle.less_equal

---

## File: docs/api/paddle/less_than__cn.rst

.. _cn_api_paddle_less_than_:

less\_than\_
-------------------------------

.. py:function:: paddle.less_than_(x, y, name=None)

Inplace 版本的 :ref:`cn_api_paddle_less_than` API，对输入 ``x`` 采用 Inplace 策略。
更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/less_than_cn.rst

.. _cn_api_paddle_less_than:

less_than
-------------------------------
.. py:function:: paddle.less_than(x, y, name=None)


逐元素地返回 :math:`x < y` 的逻辑值，相同位置前者输入小于后者输入则返回 True，否则返回 False。使用重载算子 ``<`` 可以有相同的计算函数效果。

.. note::
    输出的结果不返回梯度。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **y** (Tensor) - 输入 Tensor，支持的数据类型包括 bool、bfloat16、float16、float32、float64、uint8、int8、int16、int32、int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。


返回
::::::::::::
输出结果的 Tensor，输出 Tensor 的 shape 和输入一致，Tensor 数据类型为 bool。


代码示例
::::::::::::

COPY-FROM: paddle.less_than

---

## File: docs/api/paddle/lgamma__cn.rst

.. _cn_api_paddle_lgamma_:

lgamma\_
--------------------------------

.. py:function:: paddle.lgamma_(x, name=None)

Inplace 版本的 :ref:`cn_api_paddle_lgamma` API，对输入 ``x`` 采用 Inplace 策略。
更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/lgamma_cn.rst

.. _cn_api_paddle_lgamma:

lgamma
-------------------------------

.. py:function:: paddle.lgamma(x, name=None)

计算输入 x 的 gamma 函数的自然对数并返回。


参数
:::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：float32、float64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
:::::::::
输出 Tensor，与 ``x`` 维度相同、数据类型相同。

代码示例
:::::::::

COPY-FROM: paddle.lgamma

---

## File: docs/api/paddle/linspace_cn.rst

.. _cn_api_paddle_linspace:

linspace
-------------------------------

.. py:function:: paddle.linspace(start, stop, num, dtype=None, name=None)

返回一个 Tensor，Tensor 的值为在区间 start 和 stop 上均匀间隔的 num 个值，输出 Tensor 的长度为 num。
**注意：不进行梯度计算**

参数
::::::::::::

    - **start** (int|float|Tensor) – ``start`` 是区间开始的变量，可以是一个 int、float，或是一个 shape 为[0]的 Tensor，该 Tensor 的数据类型可以是 int32，int64，float32，float64。
    - **stop** (int|float|Tensor) – ``stop`` 是区间结束的变量，可以是一个 int、float，或是一个 shape 为[0]的 Tensor，该 Tensor 的数据类型可以是 int32，int64，float32，float64。
    - **num** (int|Tensor) – ``num`` 是给定区间内需要划分的区间数，可以是一个 int，或是一个 shape 为[0]的 Tensor，该 Tensor 的数据类型需为 int32。
    - **dtype** (str|paddle.dtype|np.dtype，可选) – 输出 Tensor 的数据类型，可以是 int32，int64，float32，float64。如果 dtype 的数据类型为 None，输出 Tensor 数据类型为 float32。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
表示等间隔划分结果的 1-D Tensor，该 Tensor 的 shape 大小为 :math:`[num]`，在 num 为 1 的情况下，仅返回包含 start 元素值的 Tensor。


代码示例
::::::::::::

COPY-FROM: paddle.linspace

---

## File: docs/api/paddle/load_cn.rst

.. _cn_api_paddle_load:

load
-----

.. py:function:: paddle.load(path, **configs)

从指定路径载入可以在 paddle 中使用的对象实例。

.. note::
    目前支持载入：Layer 或者 Optimizer 的 ``state_dict``，Tensor 以及包含 Tensor 的嵌套 list、tuple、dict、Program。对于 Tensor 对象，只保存了它的名字和数值，没有保存 stop_gradient 等属性，如果您需要这些没有保存的属性，请调用 set_value 接口将数值设置到带有这些属性的 Tensor 中。


遇到使用问题，请参考：

    ..  toctree::
        :maxdepth: 1

        ../../../../faq/save_cn.md

参数
:::::::::
    - **path** (str|BytesIO) - 载入目标对象实例的路径/内存对象。通常该路径是目标文件的路径，当从用于存储预测模型 API 的存储结果中载入 state_dict 时，该路径可能是一个文件前缀或者目录。
    - **\*\*configs** (dict，可选) - 其他用于兼容的载入配置选项。这些选项将来可能被移除，如果不是必须使用，不推荐使用这些配置选项。默认为 ``None``。目前支持以下配置选项：

        - (1) model_filename (str) - paddle 1.x 版本 ``save_inference_model`` 接口存储格式的预测模型文件名，原默认文件名为 ``__model__`` ；
        - (2) params_filename (str) - paddle 1.x 版本 ``save_inference_model`` 接口存储格式的参数文件名，没有默认文件名，默认将各个参数分散存储为单独的文件；
        - (3) return_numpy(bool) - 如果被指定为 ``True`` ，``load`` 的结果中的 Tensor 会被转化为 ``numpy.ndarray``，默认为 ``False`` 。

返回
:::::::::
Object，一个可以在 paddle 中使用的对象实例。

代码示例 1
:::::::::

COPY-FROM: paddle.load:code-example-1

代码示例 2
:::::::::

COPY-FROM: paddle.load:code-example-2

代码示例 3
:::::::::

COPY-FROM: paddle.load:code-example-3

代码示例 4
:::::::::

COPY-FROM: paddle.load:code-example-4

代码示例 5
:::::::::

COPY-FROM: paddle.load:code-example-5

---

## File: docs/api/paddle/log10__cn.rst

.. _cn_api_paddle_log10_:

log10\_
-------------------------------

.. py:function:: paddle.log10_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_log10` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/log10_cn.rst

.. _cn_api_paddle_log10:

log10
-------------------------------

.. py:function:: paddle.log10(x, name=None)





Log10 激活函数（逐元素计算底为 10 的对数）

.. math::
                  \\Out=log_{10} x\\


参数
::::::::::::

  - **x** (Tensor) – 输入的 Tensor。数据类型为 int32、int64、float16、bfloat16、float32、float64、complex64 或 complex128。
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
 Tensor，Log10 算子底为 10 对数输出，数据类型与输入一致。


代码示例
::::::::::::

COPY-FROM: paddle.log10

---

## File: docs/api/paddle/log1p_cn.rst

.. _cn_api_paddle_log1p:

log1p
-------------------------------

.. py:function:: paddle.log1p(x, name=None)


计算 Log1p（自然对数 + 1）结果。

.. math::
                  \\Out=ln(x+1)\\


参数
::::::::::::

  - **x** (Tensor) – 输入为一个多维的 Tensor，数据类型为 int32，int64，float16，bfloat16，float32， float64， complex64 或 complex128。
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
计算 ``x`` 的自然对数 + 1 后的 Tensor，数据类型，形状与 ``x`` 一致。

代码示例
::::::::::::

COPY-FROM: paddle.log1p

---

## File: docs/api/paddle/log2__cn.rst

.. _cn_api_paddle_log2_:

log2\_
-------------------------------

.. py:function:: paddle.log2_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_log2` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/log2_cn.rst

.. _cn_api_paddle_log2:

log2
-------------------------------

.. py:function:: paddle.log2(x, name=None, *, out)





Log2 激活函数（计算底为 2 的对数）

.. math::
                  \\Out=log_2x\\


.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``;

参数
:::::::::
  - **x** (Tensor) – 该 OP 的输入为 Tensor。数据类型为 int32，int64，float16，bfloat16，float32， float64， complex64 或 complex128。
    ``别名：input``
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
  - **out** (Tensor，可选) - 输出的结果。该参数为仅关键字参数，默认值为 None。
返回
:::::::::
Tensor,Log2 算子底为 2 对数输出，数据类型与输入一致。


代码示例
:::::::::

COPY-FROM: paddle.log2

---

## File: docs/api/paddle/log__cn.rst

.. _cn_api_paddle_log_:

log\_
-------------------------------

.. py:function:: paddle.log_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_log` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/log_cn.rst

.. _cn_api_paddle_log:

log
-------------------------------

.. py:function:: paddle.log(x, name=None, *, out=None)




Log 激活函数（计算自然对数）

.. math::
                  \\Out=ln(x)\\


参数
::::::::::::

  - **x** (Tensor) – 输入为 Tensor。数据类型只能为 int32，int64，float16，bfloat16，float32， float64， complex64 或 complex128。别名 ``input``。
  - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::

    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::
Tensor, Log 算子自然对数输出，数据类型与输入一致。

代码示例
::::::::::::

COPY-FROM: paddle.log

---

## File: docs/api/paddle/log_normal__cn.rst

.. _cn_api_paddle_log_normal_:

log\_normal\_
-------------------------------

.. py:function:: paddle.log_normal_(x, mean=1.0, std=2.0, name=None)

Inplace 版本的 :ref:`cn_api_paddle_log_normal` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/log_normal_cn.rst

[Binary file]

---

## File: docs/api/paddle/logaddexp_cn.rst

.. _cn_api_paddle_logaddexp:

logaddexp
-------------------------------

.. py:function:: paddle.logaddexp(x, y, name=None, *, out=None)

计算 ``x`` 和 ``y`` 的以 e 为底的指数的和的自然对数。计算公式如下：

.. math::
   logaddexp(x) = \log (exp(x)+exp(y))

参数
::::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：int32，int64，bfloat16，float16，float32、float64。别名 ``input``。
    - **y** (Tensor) - 输入的 Tensor，数据类型为：int32，int64，bfloat16，float16，float32、float64。别名 ``other``。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::
    ``Tensor``，根据上述公式计算的 logaddexp(x) 结果

代码示例
::::::::::

COPY-FROM: paddle.logaddexp

---

## File: docs/api/paddle/logcumsumexp_cn.rst

.. _cn_api_paddle_logcumsumexp:

logcumsumexp
-------------------------------

.. py:function:: paddle.logcumsumexp(x, axis=None, dtype=None, name=None, *, out=None)

计算 x 的指数的前缀和的对数。

假设输入是二维矩阵，j 是 axis 维的下标，i 是另一维的下标，那么运算结果将是

.. math::

    logcumsumexp(x)_{ij} = log \sum_{i=0}^{j}exp(x_{ij})

.. note::
   结果的第一个元素和输入的第一个元素相同。

参数
:::::::::
    - **x** (Tensor) - 需要进行操作的 Tensor，数据类型为 float32、float64、float16、bfloat16、uint8、int8、int16、int32、int64。别名 ``input``。
    - **axis** (int，可选) - 指明需要计算的维度。-1 代表最后一维。默认：None，将输入展开为一维变量再进行计算。别名 ``dim``。
    - **dtype** (str|paddle.dtype|np.dtype，可选) - 输出 Tensor 的数据类型，支持 float16、float32、float64。如果指定了，那么在执行操作之前，输入 Tensor 将被转换为 dtype。这对于防止数据类型溢出非常有用。默认为：None。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
    - Tensor (Tensor)，x 的指数的前缀和的对数（整数输入类型会自动转换为 float32）。


代码示例
:::::::::

COPY-FROM: paddle.logcumsumexp

---

## File: docs/api/paddle/logdet_cn.rst

.. _cn_api_paddle_logdet:

logdet
-------------------------------

.. py:function:: paddle.logdet(input, name=None)

计算一个或一批方阵的行列式的自然对数。

对于行列式为负数的矩阵，返回 ``nan``。
对于行列式为零的矩阵，返回 ``-inf``。

参数
::::::::::::

    - **input** (Tensor) - 输入一个或批量方阵。``input`` 的形状应为 ``[*, n, n]``，其中 ``*`` 为零或更大的批次维度。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::

Tensor：输出矩阵的行列式的自然对数值，Shape 为 ``[*]``。

代码示例
::::::::::::

COPY-FROM: paddle.logdet

---

## File: docs/api/paddle/logical_and__cn.rst

.. _cn_api_paddle_logical_and_:

logical_and\_
-------------------------------

.. py:function:: paddle.logical_and_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_paddle_logical_and` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/logical_and_cn.rst

[Binary file]

---

## File: docs/api/paddle/logical_not__cn.rst

.. _cn_api_paddle_logical_not_:

logical\_not\_
-------------------------------

.. py:function:: paddle.logical_not_(x, name=None)
Inplace 版本的 :ref:`cn_api_paddle_logical_not` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/logical_not_cn.rst

.. _cn_api_paddle_logical_not:

logical_not
-------------------------------

.. py:function:: paddle.logical_not(x, out=None, name=None)




逐元素的对 ``X``  Tensor 进行逻辑非运算

.. math::
        Out = !X

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``。

参数
::::::::::::

        - **x** （Tensor） - 逻辑非运算的输入，是一个 Tensor，支持的数据类型为 bool, int8, int16, int32, int64, bfloat16, float16, float32, float64, complex64, complex128。
          别名： ``input``
        - **out** （Tensor，可选） - 指定算子输出结果的 Tensor，可以是程序中已经创建的任何 Tensor。默认值为 None，此时将创建新的 Tensor 来保存输出结果。
        - **name** （str，可选） - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，与 ``x`` 维度相同，数据类型相同。


代码示例
::::::::::::

COPY-FROM: paddle.logical_not

---

## File: docs/api/paddle/logical_or__cn.rst

.. _cn_api_paddle_logical_or_:

logical_or\_
-------------------------------

.. py:function:: paddle.logical_or_(x, y, name=None)
Inplace 版本的 :ref:`cn_api_paddle_logical_or` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/logical_or_cn.rst

[Binary file]

---

## File: docs/api/paddle/logical_xor_cn.rst

[Binary file]

---

## File: docs/api/paddle/logit__cn.rst

.. _cn_api_paddle_logit_:

logit\_
-------------------------------

.. py:function:: paddle.logit_(x, eps=None, name=None)
Inplace 版本的 :ref:`cn_api_paddle_logit` API，对输入 ``x`` 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/logit_cn.rst

[Binary file]

---

## File: docs/api/paddle/logspace_cn.rst

[Binary file]

---

## File: docs/api/paddle/logsumexp_cn.rst

.. _cn_api_paddle_logsumexp:

logsumexp
-------------------------------

.. py:function:: paddle.logsumexp(x, axis=None, keepdim=False, name=None, *, out=None)

沿着参数 ``axis`` 计算 ``x`` 的以 e 为底的指数的和的自然对数。计算公式如下：

.. math::
   logsumexp(x) = \log\sum exp(x)

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``， ``dim`` 可替代 ``axis``。

参数
::::::::::
    - **x** (Tensor) - 输入的 Tensor，数据类型为：float16，float32、float64，维度不超过 4 。
      别名： ``input``
    - **axis** (int|list|tuple，可选) - 指定对 ``x`` 进行计算的轴。``axis`` 可以是 int、list(int)、tuple(int)。如果 ``axis`` 包含多个维度，则沿着 ``axis`` 中的所有轴进行计算。``axis`` 或者其中的元素值应该在范围[-D, D)内，D 是 ``x`` 的维度。如果 ``axis`` 或者其中的元素值小于 0，则等价于 :math:`axis + D`。如果 ``axis`` 是 None，则对 ``x`` 的全部元素计算 logsumexp。默认值为 None。
      别名： ``dim``
    - **keepdim** (bool，可选) - 是否在输出 Tensor 中保留减小的维度。如果 ``keepdim`` 为 True，则输出 Tensor 和 ``x`` 具有相同的维度(减少的维度除外，减少的维度的大小为 1)。否则，输出 Tensor 的形状会在 ``axis`` 上进行 squeeze 操作。默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** （Tensor，可选） - 指定输出结果的 ``Tensor``，默认值为 None。

返回
::::::::::
    ``Tensor``，沿着 ``axis`` 进行 logsumexp 计算的结果，数据类型和 ``x`` 相同。

代码示例
::::::::::

COPY-FROM: paddle.logsumexp

---

## File: docs/api/paddle/masked_fill__cn.rst

.. _cn_api_paddle_masked_fill_:

masked_fill\_
-------------------------------

.. py:function:: paddle.masked_fill_(x, mask, value, name=None)

Inplace 版本的 :ref:`cn_api_paddle_masked_fill` API，对输入 x 采用 Inplace 策略。

.. note::
    别名支持：参数名 ``input`` 可替代 ``x``，如 ``masked_fill_(input=tensor_x, mask=tensor_mask, value=val)`` 等价于 ``masked_fill_(x=tensor_x, mask=tensor_mask, value=val)``。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/masked_fill_cn.rst

.. _cn_api_paddle_masked_fill:

masked_fill
-------------------------------

.. py:function:: paddle.masked_fill(x, mask, value, name=None)

在 mask 为 True 的位置用 value 填充 x 中的元素。mask 的形状必须与 x 的形状可广播。

下图展示了一个例子：假设我们有一个所有元素值为 1 的 3x3 矩阵 ``x`` 和一个相同尺寸的掩码矩阵 ``Mask``，``Value`` 值为 3。

.. image:: ../../images/api_legend/masked_fill.png
   :width: 700
   :alt: 图例

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，数据类型为 float，double，int，int64_t，float16 或者 bfloat16。别名 ``input``。
    - **mask** (Tensor) - 布尔张量，表示要填充的位置。mask 的形状必须与 x 的形状可广播。mask 的数据类型必须为 bool。
    - **value** (Scalar or 0-D Tensor) - 用于填充目标张量的值，数据类型为 float，double，int，int64_t，float16 或者 bfloat16。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
Tensor，与 ``x`` 具有相同形状和数据类型的 Tensor。

代码示例
::::::::::::

COPY-FROM: paddle.masked_fill

---

## File: docs/api/paddle/masked_scatter__cn.rst

.. _cn_api_paddle_masked_scatter_:

masked_scatter\_
-------------------------------

.. py:function:: paddle.masked_scatter_(x, mask, value, name=None)
Inplace 版本的 :ref:`cn_api_paddle_masked_scatter` API，对输入 x 采用 Inplace 策略。

更多关于 inplace 操作的介绍请参考 `3.1.3 原位（Inplace）操作和非原位操作的区别`_ 了解详情。

.. _3.1.3 原位（Inplace）操作和非原位操作的区别: https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/guides/beginner/tensor_cn.html#id3

---

## File: docs/api/paddle/masked_scatter_cn.rst

.. _cn_api_paddle_masked_scatter:

masked_scatter
-------------------------------

.. py:function:: paddle.masked_scatter(x, mask, value, name=None)

返回一个 N-D 的 Tensor，Tensor 的值是根据 ``mask`` 信息，将 ``value`` 中的值逐个填充到 ``x`` 中 ``mask`` 对应为 ``True`` 的位置，``mask`` 的数据类型是 bool。


**示例图解说明**：

    - value 张量：包含要填充到目标张量中的数据。只有掩码为 True 的部分会从 value 中取值，其余值会被忽略。
    - mask 掩码：指定哪些位置需要从 value 张量中提取值并填充到目标张量中。True 表示对应位置需要被更新。
    - origin 原始张量：输入张量，只有满足掩码的部分会被替换，其余部分保持不变。
    - 操作结果：经过 masked_scatter 操作，origin 张量中掩码为 True 的部分被更新为 value 中对应的值，而掩码为 False 的部分保持不变，形成最终更新的张量。

    .. figure:: ../../images/api_legend/masked_scatter.png
       :width: 500
       :alt: 示例一图示
       :align: center

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，数据类型为 float，double，int，int64_t，float16 或者 bfloat16。
    - **mask** (Tensor) - 布尔张量，表示要填充的位置。mask 的数据类型必须为 bool。
    - **value** (Tensor) - 用于填充目标张量的值，数据类型为 float，double，int，int64_t，float16 或者 bfloat16。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::
返回一个根据 ``mask`` 将对应位置逐个填充 ``value`` 中的 Tensor，数据类型与 ``x`` 相同。


代码示例
::::::::::::

COPY-FROM: paddle.masked_scatter

---

## File: docs/api/paddle/masked_select_cn.rst

.. _cn_api_paddle_masked_select:

masked_select
-------------------------------

.. py:function:: paddle.masked_select(x, mask, name=None)



返回一个 1-D 的 Tensor，Tensor 的值是根据 ``mask`` 对输入 ``x`` 进行选择的，``mask`` 的数据类型是 bool。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，数据类型为 float32，float64，int32 或者 int64。
      别名： ``input``
    - **mask** (Tensor) - 用于索引的二进制掩码的 Tensor，数据类型为 bool。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** （Tensor，可选） - 指定输出结果的 ``Tensor``，默认值为 None。

返回
::::::::::::
返回一个根据 ``mask`` 选择的的 Tensor。


代码示例
::::::::::::

COPY-FROM: paddle.masked_select

---

## File: docs/api/paddle/matmul_cn.rst

.. _cn_api_paddle_matmul:

matmul
-------------------------------

.. py:function:: paddle.matmul(x, y, transpose_x=False, transpose_y=False, name=None, *, out=None)

.. note::
    计算两个 Tensor 的乘积，遵循完整的广播规则，关于广播规则，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x``， ``other`` 可替代 ``y``;

并且其行为与 ``numpy.matmul`` 一致。目前，输入 Tensor 的维数可以是任意数量，``matmul``  可以用于
实现 ``dot`` ， ``matmul`` 和 ``batchmatmul``。实际行为取决于输入 ``x`` 、输入 ``y`` 、 ``transpose_x`` ，
``transpose_y``。具体如下：

- 如果 ``transpose`` 为真，则对应 Tensor 的后两维会转置。如果 Tensor 的一维，则转置无效。假定 ``x`` 是一个 shape=[D] 的一维 Tensor，则 ``x`` 视为 [1, D]。然而，``y`` 是一个 shape=[D]的一维 Tensor，则视为[D, 1]。

乘法行为取决于 ``x`` 和 ``y`` 的尺寸。具体如下：

- 如果两个 Tensor 均为一维，则获得点积结果。

- 如果两个 Tensor 都是二维的，则获得矩阵与矩阵的乘积。

- 如果 ``x`` 是 1 维的，而 ``y`` 是 2 维的，则将 1 放在 ``x`` 维度之前，以进行矩阵乘法。矩阵相乘后，将删除前置尺寸。

- 如果 ``x`` 是 2 维的，而 ``y`` 是 1 维的，获得矩阵与向量的乘积。

- 如果两个输入至少为一维，且至少一个输入为 N 维（其中 N> 2），则将获得批矩阵乘法。如果第一个自变量是一维的，则将 1 放在其维度的前面，以便进行批量矩阵的乘法运算，然后将其删除。如果第二个参数为一维，则将 1 附加到其维度后面，以实现成批矩阵倍数的目的，然后将其删除。根据广播规则广播非矩阵维度（不包括最后两个维度）。例如，如果输入 ``x`` 是（j，1，n，m）Tensor，另一个 ``y`` 是（k，m，p）Tensor，则 out 将是（j，k，n，p）Tensor。

参数
:::::::::
    - **x** (Tensor) - 输入变量，类型为 Tensor，数据类型为 bfloat16， float16， float32， float64。
      ``别名：input``
    - **y** (Tensor) - 输入变量，类型为 Tensor，数据类型为 bfloat16， float16， float32， float64。
      ``别名：other``
    - **transpose_x** (bool，可选) - 相乘前是否转置 x，默认值为 False。
    - **transpose_y** (bool，可选) - 相乘前是否转置 y，默认值为 False。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。
    - **out** (Tensor，可选)- 输出的结果。该参数为仅关键字参数，默认值为 None。

返回
::::::::::::

    - Tensor，矩阵相乘后的结果，数据类型和输入数据类型一致。

代码示例
::::::::::

COPY-FROM: paddle.matmul

---

## File: docs/api/paddle/matrix_transpose_cn.rst

.. _cn_api_paddle_matrix_transpose:

matrix_transpose
-------------------------------

.. py:function:: paddle.matrix_transpose(x, name=None)

对输入张量 ``x`` 的最后两个维度进行转置。

.. note::
       如果 ``n`` 是 ``x`` 的维数，则 ``paddle.matrix_transpose(x)`` 等同于 ``x.transpose([0, 1, ..., n-2, n-1])`` 。

参数
::::::::::::

    - **x** (Tensor) - 输入 Tensor，数据类型为 float32，float64，int32 或者 int64。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::::

 ``Tensor``，数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.matrix_transpose

---

## File: docs/api/paddle/max_cn.rst

[Binary file]

---

## File: docs/api/paddle/maximum_cn.rst

[Binary file]

---

## File: docs/api/paddle/mean_cn.rst

[Binary file]

---

## File: docs/api/paddle/median_cn.rst

.. _cn_api_paddle_median:

median
-------------------------------

.. py:function:: paddle.median(x, axis=None, keepdim=False, mode='avg', name=None)

沿给定的轴 ``axis`` 计算 ``x`` 中元素的中位数。

.. note::
    别名支持: 参数名 ``input`` 可替代 ``x`` 和 ``dim`` 可替代 ``axis``，如 ``input=tensor_x`` 等价于 ``x=tensor_x``， ``dim=1`` 等价于 ``axis=1``。
    当出现别名替换时， ``mode`` 设置默认参数为 ``min`` 而不是 ``avg``。

参数
::::::::::
   - **x** (Tensor) - 输入的 Tensor，数据类型为：bfloat16、float16、float32、float64、int32、int64。
     别名： ``input``
   - **axis** (int，可选) - 指定对 ``x`` 进行计算的轴。``axis`` 可以是 int。``axis`` 值应该在范围 [-D, D) 内，D 是 ``x`` 的维度。如果 ``axis`` 或者其中的元素值小于 0，则等价于 :math:`axis + D`。如果 ``axis`` 是 None，则对 ``x`` 的全部元素计算中位数。默认值为 None。
     别名： ``dim``
   - **keepdim** (bool，可选) - 是否在输出 Tensor 中保留输入的维度。除非 keepdim 为 True，否则输出 Tensor 的维度将比输入 Tensor 小一维，默认值为 False。
   - **mode** (str，可选) - 当输入 Tensor ``x`` 在 ``axis`` 轴上有偶数个元素时，可选择按照中间两个数的平均值或最小值确定中位数。可选的值是 'avg' 或 'min'。默认为 'avg'。当出现别名替换时， ``mode`` 设置默认参数为 ``min`` 而不是 ``avg``。
   - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

返回
::::::::::
    Tensor 或 (Tensor, Tensor)。
    若 ``mode == 'avg'``，返回值是一个中位数 Tensor；
    若 ``mode == 'min'`` 且 ``axis`` 是 None，返回值是一个中位数 Tensor；
    若 ``mode == 'min'`` 且 ``axis`` 不是 None，返回值是两个 Tensor，第一个是中位数，第二个是中位数对应的下标；

    当 ``mode == 'avg'`` 时，若 ``x`` 的数据类型是 float64，返回值的数据类型则是 float64，其他输入数据类型情况下返回值的数据类型均是 float32；
    当 ``mode == 'min'`` 时，返回值中，中位数的数据类型与 ``x`` 的数据类型一致，下标的数据类型均为 int64。

代码示例
::::::::::

COPY-FROM: paddle.median

---

## File: docs/api/paddle/meshgrid_cn.rst

.. _cn_api_paddle_meshgrid:

meshgrid
-------------------------------

.. py:function:: paddle.meshgrid(*args, **kargs)




对每个 Tensor 做扩充操作。输入是 Tensor 或者包含 Tensor 的列表，包含 k 个一维 Tensor，输出 k 个 k 维 Tensor。别名：``paddle.functional.meshgrid``。

参数
::::::::::::

         - **args** (Tensor|Tensor 数组) - 输入变量为 k 个一维 Tensor，形状分别为(N1,), (N2,), ..., (Nk, )。支持数据类型为 bfloat16、float16、float32、float64、int32、int64、complex64 和 complex128。
         - **kargs** (可选) - 目前只接受 name 参数（str），具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。



返回
::::::::::::

k 个 k 维 ``Tensor``，每个形状均为(N1, N2, ..., Nk)。


代码示例
::::::::::::



COPY-FROM: paddle.meshgrid

---

## File: docs/api/paddle/min_cn.rst

[Binary file]

---

## File: docs/api/paddle/minimum_cn.rst

[Binary file]

---

## File: docs/api/paddle/mm_cn.rst

.. _cn_api_paddle_mm:

mm
-------------------------------

.. py:function:: paddle.mm(input, mat2, name=None, *, out=None)




用于两个输入矩阵的相乘。

两个输入的形状可为任意维度，但当任一输入维度大于 3 时，两个输入的维度必须相等。

如果原始 Tensor input 或 mat2 的秩为 1 且未转置，则矩阵相乘后的前置或附加维度 1 将移除。

参数
::::::::::::

    - **input** (Tensor) - 输入变量，类型为 Tensor。支持的数据类型：bfloat16、float16、float32、float64、int8、int32、int64、complex64、complex128。
    - **mat2** (Tensor) - 输入变量，类型为 Tensor。支持的数据类型：bfloat16、float16、float32、float64、int8、int32、int64、complex64、complex128。
    - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
::::::::::::
    - **out** (Tensor，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
::::::::::::

    - Tensor，矩阵相乘后的结果。


::

    * 例 1:

    input: [B, ..., M, K], mat2: [B, ..., K, N]
    out: [B, ..., M, N]

    * 例 2:

    input: [B, M, K], mat2: [B, K, N]
    out: [B, M, N]

    * 例 3:

    input: [B, M, K], mat2: [K, N]
    out: [B, M, N]

    * 例 4:

    input: [M, K], mat2: [K, N]
    out: [M, N]

    * 例 5:

    input: [B, M, K], mat2: [K]
    out: [B, M]

    * 例 6:

    input: [K], mat2: [K]
    out: [1]


代码示例
::::::::::::

COPY-FROM: paddle.mm

---

## File: docs/api/paddle/mod_cn.rst

.. _cn_api_paddle_mod:

mod
-------------------------------

.. py:function:: paddle.mod(x, y, name=None)

逐元素取模算子。公式为：

.. math::
        out = x \% y

.. note::
    ``paddle.mod`` 支持广播。关于广播规则，请参见 `Tensor 介绍`_ .

    .. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
:::::::::
        - **x** (Tensor) - 多维 Tensor。数据类型为 float16、float32 、float64、int32 或 int64。
        - **y** (Tensor) - 多维 Tensor。数据类型为 float16、float32 、float64、int32 或 int64。
        - **name** (str，可选) - 具体用法请参见 :ref:`api_guide_Name` ，一般无需设置，默认值为 None。

返回
:::::::::
``Tensor``，存储运算后的结果。如果 x 和 y 有不同的 shape 且是可以广播的，返回 Tensor 的 shape 是 x 和 y 经过广播后的 shape。如果 x 和 y 有相同的 shape，返回 Tensor 的 shape 与 x，y 相同。

代码示例
:::::::::

COPY-FROM: paddle.mod

---

## File: docs/api/paddle/mode_cn.rst

.. _cn_api_paddle_mode:

mode
-------------------------------

.. py:function:: paddle.mode(x, axis=-1, keepdim=False, name=None, *, out=None)

沿着可选的 ``axis`` 查找对应轴上的众数和结果所在的索引信息。

参数
:::::::::
    - **x** （Tensor） - 输入的多维 ``Tensor``，支持的数据类型：float32、float64、int32、int64。别名 ``input``。
    - **axis** （int，可选） - 指定对输入 Tensor 进行运算的轴，``axis`` 的有效范围是[-R, R），R 是输入 ``x`` 的 Rank， ``axis`` 为负时与 ``axis`` + R 等价。默认值为-1。别名 ``dim``。
    - **keepdim** （bool，可选）- 是否保留指定的轴。如果是 True，维度会与输入 x 一致，对应所指定的轴的 size 为 1。否则，由于对应轴被展开，输出的维度会比输入小 1。默认值为 1。
    - **name** （str，可选） - 具体用法请参见 :ref:`api_guide_Name`，一般无需设置，默认值为 None。

关键字参数
:::::::::
    - **out** (tuple[Tensor, Tensor]，可选) - 输出 Tensor，若不为 ``None``，计算结果将保存在该 Tensor 中，默认值为 ``None``。

返回
:::::::::
tuple（Tensor），返回检索到的众数结果和对应索引信息。结果的数据类型和输入 ``x`` 一致。索引的数据类型是 int64。

代码示例
:::::::::


COPY-FROM: paddle.mode