From cb4d5bd0eccb9389f08182b330c266dfcb89f347 Mon Sep 17 00:00:00 2001 From: aquagull Date: Thu, 18 Sep 2025 16:46:07 +0800 Subject: [PATCH 1/4] update --- docs/api/index_cn.rst | 2 ++ docs/api/index_en.rst | 2 ++ docs/api/paddle/Tensor_cn.rst | 7 +++++++ docs/api/paddle/random/initial_seed_cn.rst | 19 +++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 docs/api/paddle/random/initial_seed_cn.rst diff --git a/docs/api/index_cn.rst b/docs/api/index_cn.rst index 3a14ff08827..d2ac04068e9 100644 --- a/docs/api/index_cn.rst +++ b/docs/api/index_cn.rst @@ -69,6 +69,8 @@ API 文档 +--------------------------+------------------------------------------------------------------------------------+ | paddle.profiler | 飞桨框架的性能分析器,提供对模型训练和推理过程的性能数据进行展示和统计分析的功能。 | +--------------------------+------------------------------------------------------------------------------------+ +| paddle.random | 随机数生成相关 API,包括 initial_seed 等。 | ++--------------------------+------------------------------------------------------------------------------------+ | paddle.regularizer | 正则化相关 API,包括 L1Decay、L2Decay 等。 | +--------------------------+------------------------------------------------------------------------------------+ | paddle.signal | 信号处理领域 API。 | diff --git a/docs/api/index_en.rst b/docs/api/index_en.rst index d50009b5bd8..a398ae1841e 100644 --- a/docs/api/index_en.rst +++ b/docs/api/index_en.rst @@ -83,6 +83,8 @@ In this version, PaddlePaddle has made many optimizations to the APIs. You can r | | 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. | diff --git a/docs/api/paddle/Tensor_cn.rst b/docs/api/paddle/Tensor_cn.rst index cff46edc98a..c8db7744661 100755 --- a/docs/api/paddle/Tensor_cn.rst +++ b/docs/api/paddle/Tensor_cn.rst @@ -964,6 +964,13 @@ cuda(device_id=None, blocking=False) y = x.cuda(1) print(y.place) # CUDAPlace(1) +get_device() +::::::::: + +获取当前 Tensor 所在的设备 ID。 + +返回:设备 ID。CPU 设备返回 -1,GPU 设备返回对应的设备 ID。 + cumsum(axis=None, dtype=None, name=None) ::::::::: diff --git a/docs/api/paddle/random/initial_seed_cn.rst b/docs/api/paddle/random/initial_seed_cn.rst new file mode 100644 index 00000000000..44e28a2ff7f --- /dev/null +++ b/docs/api/paddle/random/initial_seed_cn.rst @@ -0,0 +1,19 @@ +.. _cn_api_paddle_random_initial_seed: + +initial_seed +------------------------------- + +.. py:function:: paddle.random.initial_seed() + +获取当前随机数生成器的初始种子值。 + +该函数返回用于初始化随机数生成器的种子值。这个种子值决定了随机数生成器的初始状态,相同的种子会产生相同的随机数序列。 + +返回 +::::::::: +int:当前随机数生成器的初始种子值。 + +代码示例 +:::::::::: + +COPY-FROM: paddle.random.initial_seed From 9e90d0968f0b06f99f1b6fe7d6d66ce13c358d70 Mon Sep 17 00:00:00 2001 From: aquagull Date: Fri, 26 Sep 2025 15:39:56 +0800 Subject: [PATCH 2/4] update --- docs/api/paddle/random/Overview_cn.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/api/paddle/random/Overview_cn.rst diff --git a/docs/api/paddle/random/Overview_cn.rst b/docs/api/paddle/random/Overview_cn.rst new file mode 100644 index 00000000000..574fd100888 --- /dev/null +++ b/docs/api/paddle/random/Overview_cn.rst @@ -0,0 +1,12 @@ +.. _cn_overview_paddle_random: + +paddle.random +--------------------- + +paddle.random 目录下包含飞桨框架随机数相关 API。具体如下: + + +.. csv-table:: + :header: "API 名称", "API 功能" + + " :ref:`paddle.random.initial_seed ` ", "获取随机数初始种子值" From 1834d9ec96a272f07eb1f40318c8b57206c30624 Mon Sep 17 00:00:00 2001 From: aquagull Date: Fri, 26 Sep 2025 15:41:29 +0800 Subject: [PATCH 3/4] format --- docs/api/index_en.rst | 216 +++++++++++++++++++++--------------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/docs/api/index_en.rst b/docs/api/index_en.rst index 16f851d10bb..86a4d780c24 100644 --- a/docs/api/index_en.rst +++ b/docs/api/index_en.rst @@ -8,112 +8,112 @@ In this version, PaddlePaddle has made many optimizations to the APIs. You can r **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. | -+--------------------------+---------------------------------------------------------------+ ++--------------------------+----------------------------------------------------------------+ +| 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. | -+--------------------------+---------------------------------------------------------------+ ++--------------------------+----------------------------------------------------------------+ +| 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. | ++--------------------------+----------------------------------------------------------------+ From 398a961cee89d5ff98df9ef646855f7455ae4396 Mon Sep 17 00:00:00 2001 From: aquagull Date: Mon, 29 Sep 2025 15:36:00 +0800 Subject: [PATCH 4/4] codestyle --- docs/api/paddle/Tensor__upper_cn.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/api/paddle/Tensor__upper_cn.rst b/docs/api/paddle/Tensor__upper_cn.rst index dd29e409d84..3718c7c1b42 100755 --- a/docs/api/paddle/Tensor__upper_cn.rst +++ b/docs/api/paddle/Tensor__upper_cn.rst @@ -34,16 +34,16 @@ Tensor ======================================= =========================================== Data type \[Dtype\]Tensor ======================================= =========================================== - 32-bit floating point ``paddle.FloatTensor`` - 64-bit floating point ``paddle.DoubleTensor`` - 16-bit floating point ``paddle.HalfTensor`` - 16-bit floating point ``paddle.BFloat16Tensor`` - 8-bit integer (unsigned) ``paddle.ByteTensor`` - 8-bit integer (signed) ``paddle.CharTensor`` - 16-bit integer (signed) ``paddle.ShortTensor`` - 32-bit integer (signed) ``paddle.IntTensor`` - 64-bit integer (signed) ``paddle.LongTensor`` - Boolean ``paddle.BoolTensor`` + 32-bit floating point ``paddle.FloatTensor`` + 64-bit floating point ``paddle.DoubleTensor`` + 16-bit floating point ``paddle.HalfTensor`` + 16-bit floating point ``paddle.BFloat16Tensor`` + 8-bit integer (unsigned) ``paddle.ByteTensor`` + 8-bit integer (signed) ``paddle.CharTensor`` + 16-bit integer (signed) ``paddle.ShortTensor`` + 32-bit integer (signed) ``paddle.IntTensor`` + 64-bit integer (signed) ``paddle.LongTensor`` + Boolean ``paddle.BoolTensor`` ======================================= =========================================== create_tensor(dtype, name=None, persistable=False) @@ -1473,7 +1473,7 @@ exponential_(lam=1.0, name=None) 参数: - **x** (Tensor) - 输入 Tensor,数据类型为 float32/float64。 - **lam** (float) - 指数分布的 :math:`\lambda` 参数。 - 别名: ``lambd`` + 别名: ``lambd`` - **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。