diff --git a/docs/api/index_cn.rst b/docs/api/index_cn.rst index 5d17028cc46..f61ceadd162 100644 --- a/docs/api/index_cn.rst +++ b/docs/api/index_cn.rst @@ -75,6 +75,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 738b554b811..86a4d780c24 100644 --- a/docs/api/index_en.rst +++ b/docs/api/index_en.rst @@ -8,110 +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. | -+--------------------------+---------------------------------------------------------------+ -| 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. | -+--------------------------+---------------------------------------------------------------+ ++--------------------------+----------------------------------------------------------------+ +| 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. | ++--------------------------+----------------------------------------------------------------+ diff --git a/docs/api/paddle/Tensor__upper_cn.rst b/docs/api/paddle/Tensor__upper_cn.rst index 18651def532..9a7c16329eb 100755 --- a/docs/api/paddle/Tensor__upper_cn.rst +++ b/docs/api/paddle/Tensor__upper_cn.rst @@ -1275,6 +1275,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/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 ` ", "获取随机数初始种子值" 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