From 0cdd0824b6813e56c7b5d762d8c2c80329336b5d Mon Sep 17 00:00:00 2001 From: Abosite <334481978@qq.com> Date: Thu, 6 Mar 2025 21:28:06 +0800 Subject: [PATCH] delete related files --- .../low_level/layers/data_feeder.rst | 44 ---- .../low_level/layers/data_feeder_en.rst | 41 ---- .../low_level/layers/data_in_out.rst | 32 --- .../low_level/layers/data_in_out_en.rst | 27 --- .../api_guides/low_level/layers/detection.rst | 101 --------- .../low_level/layers/detection_en.rst | 62 ------ docs/api_guides/low_level/layers/math.rst | 193 ------------------ docs/api_guides/low_level/layers/math_en.rst | 193 ------------------ docs/api_guides/low_level/layers/sequence.rst | 111 ---------- .../low_level/layers/sequence_en.rst | 110 ---------- docs/api_guides/low_level/layers/tensor.rst | 141 ------------- .../api_guides/low_level/layers/tensor_en.rst | 141 ------------- 12 files changed, 1196 deletions(-) delete mode 100644 docs/api_guides/low_level/layers/data_feeder.rst delete mode 100755 docs/api_guides/low_level/layers/data_feeder_en.rst delete mode 100644 docs/api_guides/low_level/layers/data_in_out.rst delete mode 100755 docs/api_guides/low_level/layers/data_in_out_en.rst delete mode 100644 docs/api_guides/low_level/layers/detection.rst delete mode 100755 docs/api_guides/low_level/layers/detection_en.rst delete mode 100644 docs/api_guides/low_level/layers/math.rst delete mode 100644 docs/api_guides/low_level/layers/math_en.rst delete mode 100644 docs/api_guides/low_level/layers/sequence.rst delete mode 100644 docs/api_guides/low_level/layers/sequence_en.rst delete mode 100644 docs/api_guides/low_level/layers/tensor.rst delete mode 100755 docs/api_guides/low_level/layers/tensor_en.rst diff --git a/docs/api_guides/low_level/layers/data_feeder.rst b/docs/api_guides/low_level/layers/data_feeder.rst deleted file mode 100644 index fa1d4d3db19..00000000000 --- a/docs/api_guides/low_level/layers/data_feeder.rst +++ /dev/null @@ -1,44 +0,0 @@ -.. _api_guide_data_feeder: - -使用 DataFeeder 传入训练/预测数据 -################################### - -Fluid 提供 :code:`DataFeeder` 类,将 numpy array 等数据转换为 :code:`DenseTensor` 类型传入训练/预测网络。 - -用户创建 :code:`DataFeeder` 对象的方式为: - -.. code-block:: python - - import paddle.fluid as fluid - - image = fluid.layers.data(name='image', shape=[-1, 3, 224, 224], dtype='float32') - label = fluid.layers.data(name='label', shape=[-1, 1], dtype='int64') - place = fluid.CUDAPlace(0) if fluid.core.is_compiled_with_cuda() else fluid.CPUPlace() - feeder = fluid.DataFeeder(feed_list=[image, label], place=place) - -其中,:code:`feed_list` 参数为变量列表,这些变量由 :code:`fluid.layers.data()` 创建, -:code:`place` 参数表示应将 Python 端传入的 numpy array 等数据转换为 GPU 端或是 CPU 端的 :code:`DenseTensor` 。 -创建 :code:`DataFeeder` 对象后,用户可调用其 :code:`feed(iterable)` 方法将用户传入的 -:code:`iterable` 数据转换为 :code:`DenseTensor`。 - -:code:`iterable` 应为 Python List 或 Tuple 类型对象,且 :code:`iterable` 的每个元素均为长度为 N 的 -Python List 或 Tuple 类型对象,其中 N 为创建 :code:`DataFeeder` 对象时传入的 :code:`feed_list` 变量个数。 - -:code:`iterable` 的具体格式为: - -.. code-block:: python - - iterable = [ - (image_1, label_1), - (image_2, label_2), - ... - (image_n, label_n) - ] - -其中,:code:`image_i` 与 :code:`label_i` 均为 numpy array 类型数据。若传入数据的维度为[1],如 :code:`label_i`, -则可传入 Python int、float 等类型数据。 :code:`image_i` 与 :code:`label_i` 的数据类型和维度不必 -与 :code:`fluid.layers.data()` 创建时指定的 :code:`dtype` 和 :code:`shape` 完全一致,:code:`DataFeeder` 内部 -会完成数据类型和维度的转换。若 :code:`feed_list` 中的变量的 :code:`lod_level` 不为零,则 Fluid 会将经过维度转换后的 -:code:`iterable` 中每行数据的第 0 维作为返回结果的 :code:`LoD`。 - -具体使用方法请参见 :ref:`cn_api_fluid_DataFeeder` 。 diff --git a/docs/api_guides/low_level/layers/data_feeder_en.rst b/docs/api_guides/low_level/layers/data_feeder_en.rst deleted file mode 100755 index 243a803e7c3..00000000000 --- a/docs/api_guides/low_level/layers/data_feeder_en.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. _api_guide_data_feeder_en: - -Feed training/inference data with DataFeeder -######################################################## - -Fluid provides the :code:`DataFeeder` class, which converts data types such as numpy array into a :code:`DenseTensor` type to feed the training/inference network. - -To create a :code:`DataFeeder` object: - -.. code-block:: python - - import paddle.fluid as fluid - - image = fluid.layers.data(name='image', shape=[-1, 3, 224, 224], dtype='float32') - label = fluid.layers.data(name='label', shape=[-1, 1], dtype='int64') - place = fluid.CUDAPlace(0) if fluid.core.is_compiled_with_cuda() else fluid.CPUPlace() - feeder = fluid.DataFeeder(feed_list=[image, label], place=place) - -The :code:`feed_list` parameter is a list of variables created by :code:`fluid.layers.data()` . -The :code:`place` parameter indicates that data such as numpy array passed in from the Python side should be converted to GPU or CPU :code:`DenseTensor`. -After creating the :code:`DataFeeder` object, the user can call the :code:`feed(iterable)` method to convert :code:`iterable` data given by user into :code:`DenseTensor` . - -:code:`iterable` should be a object of Python List or a Tuple type, and each element in :code:`iterable` is a Python List of length N or Tuple type object, where N is the number of :code:`feed_list` variables passed in when the :code:`DataFeeder` object is created. - -The concrete format of :code:`iterable` is: - -.. code-block:: python - - iterable = [ - (image_1, label_1), - (image_2, label_2), - ... - (image_n, label_n) - ] - -:code:`image_i` and :code:`label_i` are both numpy array data. If the dimension of the input data is [1], such as :code:`label_i`, -you can feed Python int, float, and other types of data. The data types and dimensions of :code:`image_i` and :code:`label_i` are not necessarily -the same as :code:`dtype` and :code:`shape` specified at :code:`fluid.layers.data()`. :code:`DataFeeder` internally -performs the conversion of data types and dimensions. If the :code:`lod_level` of the variable in :code:`feed_list` is not zero, in Fluid, the 0th dimension of each row in the dimensionally converted :code:`iterable` will be returned as :code:`LoD` . - -Read :ref:`api_fluid_DataFeeder` for specific usage. diff --git a/docs/api_guides/low_level/layers/data_in_out.rst b/docs/api_guides/low_level/layers/data_in_out.rst deleted file mode 100644 index 3d6dbd5b849..00000000000 --- a/docs/api_guides/low_level/layers/data_in_out.rst +++ /dev/null @@ -1,32 +0,0 @@ -.. _api_guide_data_in_out: - -数据输入输出 -############### - - -数据输入 -------------- - -Fluid 支持两种数据输入方式,包括: - -1. Python Reader: 纯 Python 的 Reader。用户在 Python 端定义 :code:`fluid.layers.data` 层构建网络,并通过 -:code:`executor.run(feed=...)` 的方式读入数据。数据读取和模型训练/预测的过程是同步进行的。 - -2. PyReader: 高效灵活的 C++ Reader 接口。PyReader 内部维护容量为 :code:`capacity` 的队列(队列容量由 -:code:`fluid.layers.py_reader` 接口中的 :code:`capacity` 参数设置),Python 端调用队列的 :code:`push` -方法送入训练/预测数据,C++端的训练/预测程序调用队列的 :code:`pop` 方法取出 Python 端送入的数据。PyReader 可与 -:code:`double_buffer` 配合使用,实现数据读取和训练/预测的异步执行。 - -具体使用方法请参考 :ref:`cn_api_fluid_layers_py_reader`。 - - -数据输出 ------------- - -Fluid 支持在训练/预测阶段获取当前 batch 的数据。 - -用户可通过 :code:`executor.run(fetch_list=[...], return_numpy=...)` 的方式 -fetch 期望的输出变量,通过设置 :code:`return_numpy` 参数设置是否将输出数据转为 numpy array。 -若 :code:`return_numpy` 为 :code:`False` ,则返回 :code:`DenseTensor` 类型数据。 - -具体使用方式请参考相关 API 文档 :ref:`cn_api_paddle_static_Executor`。 diff --git a/docs/api_guides/low_level/layers/data_in_out_en.rst b/docs/api_guides/low_level/layers/data_in_out_en.rst deleted file mode 100755 index 7b5b0bb227f..00000000000 --- a/docs/api_guides/low_level/layers/data_in_out_en.rst +++ /dev/null @@ -1,27 +0,0 @@ -.. _api_guide_data_in_out_en: - -Data input and output -###################### - - -Data input -------------- - -Fluid supports two methods for data input, including: - -1. Python Reader: A pure Python Reader. The user defines the :code:`fluid.layers.data` layer on the Python side and builds the network. -Then, read the data by calling :code:`executor.run(feed=...)` . The process of data reading and model training/inference is performed simultaneously. - -2. PyReader: An Efficient and flexible C++ Reader interface. PyReader internally maintains a queue with size of :code:`capacity` (queue capacity is determined by -:code:`capacity` parameter in the :code:`fluid.layers.py_reader` interface ). Python side call queue :code:`push` to feed the training/inference data, and the C++ side training/inference program calls the :code:`pop` method to retrieve the data sent by the Python side. PyReader can work in conjunction with :code:`double_buffer` to realize asynchronous execution of data reading and model training/inference. - -For details, please refer to :ref:`api_fluid_layers_py_reader`. - - -Data output ------------- - -Fluid supports obtaining data for the current batch in the training/inference phase. - -The user can fetch expected variables from :code:`executor.run(fetch_list=[...], return_numpy=...)` . User can determine whether to convert the output data to numpy array by setting the :code:`return_numpy` parameter. -If :code:`return_numpy` is :code:`False` , data of type :code:`DenseTensor` will be returned. diff --git a/docs/api_guides/low_level/layers/detection.rst b/docs/api_guides/low_level/layers/detection.rst deleted file mode 100644 index 2f289edccdf..00000000000 --- a/docs/api_guides/low_level/layers/detection.rst +++ /dev/null @@ -1,101 +0,0 @@ -.. _api_guide_detection: - - -图像检测 -######### - -PaddlePaddle Fluid 在图像检测任务中实现了多个特有的操作。以下分模型介绍各个 api: - -通用操作 -------------- - -图像检测中的一些通用操作,是对检测框的一系列操作,其中包括: - -* 对检测框的编码,解码(box_coder):实现两种框之间编码和解码的转换。例如训练阶段对先验框和真实框进行编码得到训练目标值。API Reference 请参考 :ref:`cn_api_fluid_layers_box_coder` - -* 比较两个检测框并进行匹配: - - * iou_similarity:计算两组框的 IOU 值。API Reference 请参考 :ref:`cn_api_fluid_layers_iou_similarity` - - * bipartite_match:通过贪心二分匹配算法得到每一列中距离最大的一行。API Reference 请参考 :ref:`cn_api_fluid_layers_bipartite_match` - -* 根据检测框和标签得到分类和回归目标值(target_assign):通过匹配索引和非匹配索引得到目标值和对应权重。API Reference 请参考 :ref:`cn_api_fluid_layers_target_assign` - -* 对检测框进行后处理: - - * box_clip: 将检测框剪切到指定大小。API Reference 请参考 :ref:`cn_api_fluid_layers_box_clip` - - * multiclass_nms: 对边界框和评分进行多类非极大值抑制。API Reference 请参考 :ref:`cn_api_fluid_layers_multiclass_nms` - - -RCNN -------------- - -RCNN 系列模型是两阶段目标检测器,其中包含`Faster RCNN `_,`Mask RCNN `_,相较于传统提取区域的方法,RCNN 中 RPN 网络通过共享卷积层参数大幅提高提取区域的效率,并提出高质量的候选区域。RPN 网络需要对输入 anchor 和真实值进行比较生成初选候选框,并对初选候选框分配分类和回归值,需要如下五个特有 api: - -* rpn_target_assign:通过 anchor 和真实框为 anchor 分配 RPN 网络的分类和回归目标值。API Reference 请参考 :ref:`cn_api_fluid_layers_rpn_target_assign` - -* anchor_generator:为每个位置生成一系列 anchor。API Reference 请参考 :ref:`cn_api_fluid_layers_anchor_generator` - -* generate_proposal_labels: 通过 generate_proposals 得到的候选框和真实框得到 RCNN 部分的分类和回归的目标值。API Reference 请参考 :ref:`cn_api_fluid_layers_generate_proposal_labels` - -* generate_proposals: 对 RPN 网络输出 box 解码并筛选得到新的候选框。API Reference 请参考 :ref:`cn_api_fluid_layers_generate_proposals` - -* generate_mask_labels: 通过 generate_proposal_labels 得到的 RoI,和真实框对比后进一步筛选 RoI 并得到 Mask 分支的目标值。API Reference 请参考 :ref:`cn_api_fluid_layers_generate_mask_labels` - -FPN -------------- - -`FPN `_ 全称 Feature Pyramid Networks, 采用特征金字塔做目标检测。 顶层特征通过上采样和低层特征做融合,并将 FPN 放在 RPN 网络中用于生成候选框,有效的提高检测精度,需要如下两种特有 api: - -* collect_fpn_proposals: 拼接多层 RoI,同时选择分数较高的 RoI。API Reference 请参考 :ref:`cn_api_fluid_layers_collect_fpn_proposals` - -* distribute_fpn_proposals: 将多个 RoI 依据面积分配到 FPN 的多个层级中。API Reference 请参考 :ref:`cn_api_fluid_layers_distribute_fpn_proposals` - -SSD ----------------- - -`SSD `_ 全称 Single Shot MultiBox Detector,是目标检测领域较新且效果较好的检测算法之一,具有检测速度快且检测精度高的特点。与两阶段的检测方法不同,单阶段目标检测并不进行区域推荐,而是直接从特征图回归出目标的边界框和分类概率。SSD 网络对六个尺度特>征图计算损失,进行预测,需要如下五种特有 api: - -* 根据不同参数为每个输入位置生成一系列候选框。 - - * prior box: API Reference 请参考 :ref:`cn_api_fluid_layers_prior_box` - - * density_prior box: API Reference 请参考 :ref:`cn_api_fluid_layers_density_prior_box` - -* multi_box_head :得到不同 prior box 的位置和置信度。API Reference 请参考 :ref:`cn_api_fluid_layers_multi_box_head` - -* detection_output:对 prior box 解码,通过多分类 NMS 得到检测结果。API Reference 请参考 :ref:`cn_api_fluid_layers_detection_output` - -* ssd_loss:通过位置偏移预测值,置信度,检测框位置和真实框位置和标签计算损失。API Reference 请参考 :ref:`cn_api_fluid_layers_ssd_loss` - -* detection_map: 利用 mAP 评估 SSD 网络模型。API Reference 请参考 :ref:`cn_api_fluid_layers_detection_map` - -YOLO V3 ---------------- - -`YOLO V3 `_ 是单阶段目标检测器,同时具备了精度高,速度快的特点。对特征图划分多个区块,每个区块得到坐标位置和置信度。采用了多尺度融合的方式预测以得到更高的训练精度,需要如下两种特有 api: - -* yolo_box: 从 YOLOv3 网络的输出生成 YOLO 检测框。API Reference 请参考 :ref:`cn_api_fluid_layers_yolo_box` - -* yolov3_loss:通过给定的预测结果和真实框生成 yolov3 损失。API Reference 请参考 :ref:`cn_api_fluid_layers_yolov3_loss` - -RetinaNet ---------------- - -`RetinaNet `_ 是单阶段目标检测器,引入 Focal Loss 和 FPN 后,能以更快的速率实现与双阶段目标检测网络近似或更优的效果,需要如下三种特有 api: - -* sigmoid_focal_loss: 用于处理单阶段检测器中类别不平均问题的损失。API Reference 请参考 :ref:`cn_api_fluid_layers_sigmoid_focal_loss` - -* retinanet_target_assign: 对给定 anchor 和真实框,为每个 anchor 分配分类和回归的目标值,用于训练 RetinaNet。API Reference 请参考 :ref:`cn_api_fluid_layers_retinanet_target_assign` - -* retinanet_detection_output: 对检测框进行解码,并做非极大值抑制后得到检测输出。API Reference 请参考 :ref:`cn_api_fluid_layers_retinanet_detection_output` - -OCR ---------- - -场景文字识别是在图像背景复杂、分辨率低下、字体多样、分布随意等情况下,将图像信息转化为文字序列的过程,可认为是一种特别的翻译过程:将图像输入翻译为自然语言输出。OCR 任务中需要对检测框进行不规则变换,其中需要如下两个 api: - -* roi_perspective_transform:对输入 roi 做透视变换。API Reference 请参考 :ref:`cn_api_fluid_layers_roi_perspective_transform` - -* polygon_box_transform:对不规则检测框进行坐标变换。API Reference 请参考 :ref:`cn_api_fluid_layers_polygon_box_transform` diff --git a/docs/api_guides/low_level/layers/detection_en.rst b/docs/api_guides/low_level/layers/detection_en.rst deleted file mode 100755 index d2ead09fcd7..00000000000 --- a/docs/api_guides/low_level/layers/detection_en.rst +++ /dev/null @@ -1,62 +0,0 @@ - -.. _api_guide_detection_en: - - -Image Detection -################# - -PaddlePaddle Fluid implements several unique operators for image detection tasks. This article introduces related APIs grouped by diverse model types. - -General operations --------------------- - -Some common operations in image detection are a series of operations on the bounding boxes, including: - -* Encoding and decoding of the bounding box : Conversion between encoding and decoding between the two kinds of boxes. For example, the training phase encodes the prior box and the ground-truth box to obtain the training target value. For API Reference, please refer to :ref:`api_fluid_layers_box_coder` - -* Compare the two bounding boxes and match them: - - * iou_similarity: Calculate the IOU value of the two sets of boxes. For API Reference, please refer to :ref:`api_fluid_layers_iou_similarity` - - * bipartite_match: Get the row with the largest distance in each column by the greedy binary matching algorithm. For API Reference, please refer to :ref:`api_fluid_layers_bipartite_match` - -* Get classification and regression target values ​​(target_assign) based on the bounding boxes and labels: Get the target values and corresponding weights by matched indices and negative indices. For API Reference, please refer to :ref:`api_fluid_layers_target_assign` - - -Faster RCNN -------------- - -`Faster RCNN `_ is a typical dual-stage target detector. Compared with the traditional extraction method, the RPN network in Faster RCNN greatly improves the extraction efficiency by sharing convolution layer parameters, and proposes high-quality region proposals. The RPN network needs to compare the input anchor with the ground-truth value to generate a primary candidate region, and assigns a classification and regression value to the primary candidate box. The following four unique apis are required: - -* rpn_target_assign: Assign the classification and regression target values ​​of the RPN network to the anchor through the anchor and the ground-truth box. For API Reference, please refer to :ref:`api_fluid_layers_rpn_target_assign` - -* anchor_generator: Generate a series of anchors for each location. For API Reference, please refer to :ref:`api_fluid_layers_anchor_generator` - -* generate_proposal_labels: Get the classification and regression target values ​​of the RCNN part through the candidate box and the ground-truth box obtained by generate_proposals. For API Reference, please refer to :ref:`api_fluid_layers_generate_proposal_labels` - -* generate_proposals: Decode the RPN network output box and selects a new region proposal. For API Reference, please refer to :ref:`api_fluid_layers_generate_proposals` - - -SSD ----------------- - -`SSD `_ , the acronym for Single Shot MultiBox Detector, is one of the latest and better detection algorithms in the field of target detection. It has the characteristics of fast detection speed and high detection accuracy. Unlike the dual-stage detection method, the single-stage target detection does not perform regional proposals, but directly returns the target's bounding box and classification probability from the feature map. The SSD network calculates the loss through six metrics of features maps and performs prediction. SSD requires the following five unique apis: - -* Prior Box: Generate a series of candidate boxes for each input position based on different parameters. For API Reference, please refer to :ref:`api_fluid_layers_prior_box` - -* multi_box_head : Get the position and confidence of different prior boxes. For API Reference, please refer to :ref:`api_fluid_layers_multi_box_head` - -* detection_output: Decode the prior box and obtains the detection result by multi-class NMS. For API Reference, please refer to :ref:`api_fluid_layers_detection_output` - -* ssd_loss: Calculate the loss by prediction value of position offset, confidence, bounding box position and ground-truth box position and label. For API Reference, please refer to :ref:`api_fluid_layers_ssd_loss` - -* detection map: Evaluate the SSD network model using mAP. For API Reference, please refer to :ref:`api_fluid_layers_detection_map` - -OCR ---------- - -Scene text recognition is a process of converting image information into a sequence of characters in the case of complex image background, low resolution, diverse fonts, random distribution and so on. It can be considered as a special translation process: translation of image input into natural language output. The OCR task needs to perform irregular transformation on the bounding box, which requires the following two APIs: - -* roi_perspective_transform: Make a perspective transformation on the input RoI. For API Reference, please refer to :ref:`api_fluid_layers_roi_perspective_transform` - -* polygon_box_transform: Coordinate transformation of the irregular bounding box. For API Reference, please refer to :ref:`api_fluid_layers_polygon_box_transform` diff --git a/docs/api_guides/low_level/layers/math.rst b/docs/api_guides/low_level/layers/math.rst deleted file mode 100644 index 2044c91d64e..00000000000 --- a/docs/api_guides/low_level/layers/math.rst +++ /dev/null @@ -1,193 +0,0 @@ -.. _api_guide_math: - - -数学操作 -######### - -Paddle 提供了丰富的数学操作,以下列出的数学操作都是对目标张量进行逐元素的操作。其中,如果二元操作的两个输入有不同形状,会先进行 :code:`broadcast`. 部分数学操作还支持数学操作符,比如: :code:`+`, :code:`-`, :code:`*`, :code:`/` 等。数学操作符不仅支持张量,还支持标量。 - - -一元操作 -================== - -exp ------------------- - -对输入 :code:`Tensor` 逐元素做 :code:`exp` 操作。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_exp` - -tanh ------------------- - -对输入 :code:`Tensor` 逐元素取正切。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_tanh` - -sqrt ------------------- - -对输入 :code:`Tensor` 逐元素取平方根。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sqrt` - -abs ------------------- - -对输入 :code:`Tensor` 逐元素取绝对值。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_abs` - -ceil ------------------- - -对输入 :code:`Tensor` 逐元素向上取整。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_ceil` - -floor ------------------- - -对输入 :code:`Tensor` 逐元素向下取整。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_floor` - -sin ------------------- - -对输入 :code:`Tensor` 逐元素取正弦。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sin` - -cos ------------------- - -对输入 :code:`Tensor` 逐元素取余弦。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_cos` - -cosh ------------------- - -对输入 :code:`Tensor` 逐元素取双曲余弦。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_cosh` - -round ------------------- - -对输入 :code:`Tensor` 逐元素四舍五入取整。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_round` - -square ------------------- - -对输入 :code:`Tensor` 逐元素取平方。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_square` - -reciprocal ------------------- - -对输入 :code:`Tensor` 逐元素取倒数。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_reciprocal` - - -reduce ------------------- - -对输入 :code:`Tensor` 在指定的若干轴上做 reduce 操作,包括:min, max, sum, mean, product - -API Reference 请参考: -:ref:`cn_api_fluid_layers_reduce_min` -:ref:`cn_api_fluid_layers_reduce_max` -:ref:`cn_api_fluid_layers_reduce_sum` -:ref:`cn_api_fluid_layers_reduce_mean` -:ref:`cn_api_fluid_layers_reduce_prod` - - -二元操作 -================== - -elementwise_add ------------------- - -对两个 :code:`Tensor` 逐元素相加,对应的数学操作符为 :code:`+` - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_add` - -elementwise_sub ------------------- - -对两个 :code:`Tensor` 逐元素相减,对应数学操作符 :code:`-` - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_sub` - -elementwise_mul ------------------- - -对两个 :code:`Tensor` 逐元素相乘, 对应数学操作符 :code:`*` - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_mul` - -elementwise_div ------------------- - -对两个 :code:`Tensor` 逐元素相除, 对应数学操作符 :code:`/` 或 :code:`//` - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_div` - - -elementwise_pow ------------------- - -对两个 :code:`Tensor` 逐元素做次幂操作, 对应数学操作符 :code:`**` - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_pow` - -equal ------------------- - -对两个 :code:`Tensor` 逐元素判断是否相等, 对应数学操作符 :code:`==` - -API Reference 请参考 :ref:`cn_api_fluid_layers_equal` - - -less_than ------------------- - -对两个 :code:`Tensor` 逐元素判断是否满足小于关系, 对应数学操作符 :code:`<` - -API Reference 请参考 :ref:`cn_api_fluid_layers_less_than` - - - -sum ------------------- - -对两个 :code:`Tensor` 逐元素相加。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sum` - -elementwise_min ------------------- - -对两个 :code:`Tensor` 逐元素进行 :code:`min(x, y)` 操作。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_min` - -elementwise_max ------------------- - -对两个 :code:`Tensor` 逐元素进行 :code:`max(x, y)` 操作。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_elementwise_max` - -matmul ------------------- - -对两个 :code:`Tensor` 进行矩阵乘操作。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_matmul` diff --git a/docs/api_guides/low_level/layers/math_en.rst b/docs/api_guides/low_level/layers/math_en.rst deleted file mode 100644 index 5851d87e688..00000000000 --- a/docs/api_guides/low_level/layers/math_en.rst +++ /dev/null @@ -1,193 +0,0 @@ -_api_guide_math_en: - - -Mathematical operation -########################### - -Paddle provides a wealth of mathematical operations. The mathematical operations listed below are all elementwise operations on the target tensor. If the two inputs of the binary operations have different shapes, they will be processed first by :code:`broadcast`. Some mathematical operations also support mathematical operators, such as: :code:`+`, :code:`-`, :code:`*`, :code:`/`, etc. Math operators not only support tensors but also scalars. - - -Unary operation -================== - -exp ------------------- - -Perform an :code:`exp` operation on each input :code:`Tensor` element. - -API Reference: :ref:`api_fluid_layers_exp` - -tanh ------------------- - -For the input :code:`Tensor`, take the tanh value of each element. - -API Reference: :ref:`api_fluid_layers_tanh` - -sqrt ------------------- - -For the input :code:`Tensor`, take the square root of each element. - -API Reference: :ref:`api_fluid_layers_sqrt` - -abs ------------------- - -For the input :code:`Tensor`, take the elementwise absolute value. - -API Reference: :ref:`api_fluid_layers_abs` - -ceil ------------------- - -Round up each input :code:`Tensor` element to the nearest greater integer. - -API Reference: :ref:`api_fluid_layers_ceil` - -floor ------------------- - -Round down each input :code:`Tensor` element to the nearest less integer. - -API Reference: :ref:`api_fluid_layers_floor` - -sin ------------------- - -For the input :code:`Tensor`, take the elementwise sin value. - -API Reference: :ref:`api_fluid_layers_sin` - -cos ------------------- - -For input :code:`Tensor`, take the elementwise cosine value. - -API Reference: :ref:`api_fluid_layers_cos` - -cosh ------------------- - -For input :code:`Tensor`, take the elementwise hyperbolic cosine value. - -API Reference: :ref:`api_fluid_layers_cosh` - -round ------------------- - -Rounding the input :code:`Tensor` in elementwise order. - -API Reference: :ref:`api_fluid_layers_round` - -square ------------------- - -Square the input :code:`Tensor` in elementwise order. - -API Reference: :ref:`api_fluid_layers_square` - -reciprocal ------------------- - -For the input :code:`Tensor`, take the reciprocal in elementwise order. - -API Reference: :ref:`api_fluid_layers_reciprocal` - - -reduce ------------------- - -For the input :code:`Tensor`, it performs reduce operations on the specified axes, including: min, max, sum, mean, product - -API Reference: -:ref:`api_fluid_layers_reduce_min` -:ref:`api_fluid_layers_reduce_max` -:ref:`fluid_layers_reduce_sum` -:ref:`api_fluid_layers_reduce_mean` -:ref:`api_fluid_layers_reduce_prod` - - -Binary operation -================== - -elementwise_add ------------------- - -Add two :code:`Tensor` in elementwise order, and the corresponding math operator is :code:`+` . - -API Reference: :ref:`api_fluid_layers_elementwise_add` - -elementwise_sub ------------------- - -Sub two :code:`Tensor` in elementwise order, the corresponding math operator is :code:`-` . - -API Reference: :ref:`api_fluid_layers_elementwise_sub` - -elementwise_mul ------------------- - -Multiply two :code:`Tensor` in elementwise order, and the corresponding math operator is :code:`*` . - -API Reference: :ref:`api_fluid_layers_elementwise_mul` - -elementwise_div ------------------- - -Divide two :code:`Tensor` in elementwise order, and the corresponding math operator is :code:`/` or :code:`//` . - -API Reference: :ref:`api_fluid_layers_elementwise_div` - - -elementwise_pow ------------------- - -Do power operations on two :code:`Tensor` in elementwise order, and the corresponding math operator is :code:`**` . - -API Reference: :ref:`api_fluid_layers_elementwise_pow` - -equal ------------------- - -Judge whether the two :code:`Tensor` elements are equal, and the corresponding math operator is :code:`==` . - -API Reference: :ref:`api_fluid_layers_equal` - - -less_than ------------------- - -Judge whether the two :code:`Tensor` elements satisfy the 'less than' relationship, and the corresponding math operator is :code:`<` . - -API Reference: :ref:`api_fluid_layers_less_than` - - - -sum ------------------- - -Add two :code:`Tensor` in elementwise order. - -API Reference: :ref:`api_fluid_layers_sum` - -elementwise_min ------------------- - -Perform :code:`min(x, y)` operations on two :code:`Tensor` in elementwise order . - -API Reference: :ref:`api_fluid_layers_elementwise_min` - -elementwise_max ------------------- - -Perform :code:`max(x, y)` operations on two :code:`Tensor` in elementwise order . - -API Reference: :ref:`api_fluid_layers_elementwise_max` - -matmul ------------------- - -Perform matrix multiplication operations on two :code:`Tensor`. - -API Reference: :ref:`api_fluid_layers_matmul` diff --git a/docs/api_guides/low_level/layers/sequence.rst b/docs/api_guides/low_level/layers/sequence.rst deleted file mode 100644 index 8b27d7c0a40..00000000000 --- a/docs/api_guides/low_level/layers/sequence.rst +++ /dev/null @@ -1,111 +0,0 @@ -.. _api_guide_sequence: - -######## -序列 -######## - -在深度学习领域许多问题涉及到对 `序列(sequence) `_ 的处理。 -从 Wiki 上的释义可知,序列可以表征多种物理意义,但在深度学习中,最常见的仍然是"时间序列"——一个序列包含多个时间步的信息。 - -在 Paddle Fluid 中,我们将序列表示为 ``DenseTensor``。 -因为一般进行神经网络计算时都是一个 batch 一个 batch 地计算,所以我们用一个 DenseTensor 来存储一个 mini batch 的序列。 -一个 DenseTensor 的第 0 维包含该 mini batch 中所有序列的所有时间步,并且用 LoD 来记录各个序列的长度,区分不同序列。 -而在运算时,还需要根据 LoD 信息将 DenseTensor 中一个 mini batch 的第 0 维拆开成多个序列。(具体请参考上述 LoD 相关的文档。) -所以,对这类 DenseTensor 第 0 维的操作不能简单地使用一般的 layer 来进行,针对这一维的操作必须要结合 LoD 的信息。 -(例如,你不能用 :code:`layers.reshape` 来对一个序列的第 0 维进行 reshape)。 - -为了实行各类针对序列的操作,我们设计了一系列序列相关的 API,专门用于正确处理序列相关的操作。 -实践中,由于一个 DenseTensor 包括一个 mini batch 的序列,同一个 mini batch 中不同的序列通常属于多个 sample,它们彼此之间不会也不应该发生相互作用。 -因此,若一个 layer 以两个(或多个)DenseTensor 为输入(或者以一个 list 的 DenseTensor 为输入),每一个 DenseTensor 代表一个 mini batch 的序列,则第一个 DenseTensor 中的第一个序列只会和第二个 DenseTensor 中的第一个序列发生计算, -第一个 DenseTensor 中的第二个序列只会和第二个 DenseTensor 中的第二个序列发生计算,第一个 DenseTensor 中的第 i 个序列只会和第二个 DenseTensor 中第 i 个序列发生计算,依此类推。 - -**总而言之,一个 DenseTensor 存储一个 mini batch 的多个序列,其中的序列个数为 batch size;多个 DenseTensor 间发生计算时,每个 DenseTensor 中的第 i 个序列只会和其他 DenseTensor 中第 i 个序列发生计算。理解这一点对于理解接下来序列相关的操作会至关重要。** - -1. sequence_softmax -------------------- -这个 layer 以一个 mini batch 的序列为输入,在每个序列内做 softmax 操作。其输出为一个 mini batch 相同 shape 的序列,但在序列内是经 softmax 归一化过的。 -这个 layer 往往用于在每个 sequence 内做 softmax 归一化。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_softmax` - - -2. sequence_concat ------------------- -这个 layer 以一个 list 为输入,该 list 中可以含有多个 DenseTensor,每个 DenseTensor 为一个 mini batch 的序列。 -该 layer 会将每个 batch 中第 i 个序列在时间维度上拼接成一个新序列,作为返回的 batch 中的第 i 个序列。 -理所当然地,list 中每个 DenseTensor 的序列必须有相同的 batch size。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_concat` - - -3. sequence_first_step ----------------------- -这个 layer 以一个 DenseTensor 作为输入,会取出每个序列中的第一个元素(即第一个时间步的元素),并作为返回值。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_first_step` - - -4. sequence_last_step ---------------------- -同 :code:`sequence_first_step` ,除了本 layer 是取每个序列中最后一个元素(即最后一个时间步)作为返回值。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_last_step` - - -5. sequence_expand ------------------- -这个 layer 有两个 DenseTensor 的序列作为输入,并按照第二个 DenseTensor 中序列的 LoD 信息来扩展第一个 batch 中的序列。 -通常用来将只有一个时间步的序列(例如 :code:`sequence_first_step` 的返回结果)延展成有多个时间步的序列,以此方便与有多个时间步的序列进行运算。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_expand` - - -6. sequence_expand_as ---------------------- -这个 layer 需要两个 DenseTensor 的序列作为输入,然后将第一个 Tensor 序列中的每一个序列延展成和第二个 Tensor 中对应序列等长的序列。 -不同于 :code:`sequence_expand` ,这个 layer 会将第一个 DenseTensor 中的序列严格延展为和第二个 DenseTensor 中的序列等长。 -如果无法延展成等长的(例如第二个 batch 中的序列长度不是第一个 batch 中序列长度的整数倍),则会报错。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_expand_as` - - -7. sequence_enumerate ---------------------- -这个 layer 需要一个 DenseTensor 的序列作为输入,同时需要指定一个 :code:`win_size` 的长度。这个 layer 将依次取所有序列中长度为 :code:`win_size` 的子序列,并组合成新的序列。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_enumerate` - - -8. sequence_reshape -------------------- -这个 layer 需要一个 DenseTensor 的序列作为输入,同时需要指定一个 :code:`new_dim` 作为新的序列的维度。 -该 layer 会将 mini batch 内每个序列 reshape 为 new_dim 给定的维度。注意,每个序列的长度会改变(因此 LoD 信息也会变),以适应新的形状。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_reshape` - - -9. sequence_scatter -------------------- -这个 layer 可以将一个序列的数据 scatter 到另一个 tensor 上。这个 layer 有三个 input,一个要被 scatter 的目标 tensor :code:`input`; -一个是序列的数据 :code:`update` ,一个是目标 tensor 的上坐标 :code:`index` 。Output 为 scatter 后的 tensor,形状和 :code:`input` 相同。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_scatter` - - -10. sequence_pad ----------------- -这个 layer 可以将不等长的序列补齐成等长序列。使用这个 layer 需要提供一个 :code:`PadValue` 和一个 :code:`padded_length`。 -前者是用来补齐序列的元素,可以是一个数也可以是一个 tensor;后者是序列补齐的目标长度。 -这个 layer 会返回补齐后的序列,以及一个记录补齐前各个序列长度的 tensor :code:`Length`。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_pad` - - -11. sequence_mask ------------------ -这个 layer 会根据 :code:`input` 生成一个 mask,:code:`input` 是一个记录了每个序列长度的 tensor。 -此外这个 layer 还需要一个参数 :code:`maxlen` 用于指定序列中最长的序列长度。 -通常这个 layer 用于生成一个 mask,将被 pad 后的序列中 pad 的部分过滤掉。 -:code:`input` 的长度 tensor 通常可以直接用 :code:`sequence_pad` 返回的 :code:`Length`。 - -API Reference 请参考 :ref:`cn_api_fluid_layers_sequence_mask` diff --git a/docs/api_guides/low_level/layers/sequence_en.rst b/docs/api_guides/low_level/layers/sequence_en.rst deleted file mode 100644 index 6d6780ef772..00000000000 --- a/docs/api_guides/low_level/layers/sequence_en.rst +++ /dev/null @@ -1,110 +0,0 @@ -.. _api_guide_sequence_en: - -######## -Sequence -######## - -Many problems in the field of deep learning involve the processing of the `sequence `_. -From Wiki's definition, sequences can represent a variety of physical meanings, but in deep learning, the most common is still "time sequence" - a sequence containing information of multiple time steps. - -In Paddle Fluid, we represent the sequence as ``DenseTensor``. -Because the general neural network performs computing batch by batch, we use a DenseTensor to store a mini batch of sequences. -The 0th dimension of a DenseTensor contains all the time steps of all sequences in the mini batch, and LoD is used to record the length of each sequence to distinguish different sequences. -In the calculation, it is also necessary to split the 0th dimension of a mini batch in the DenseTensor into a number of sequences according to the LoD information. (Please refer to the LoD related documents for details. ) -Therefore, the operation for the 0th dimension of DenseTensor cannot be performed simply by a general layer. The operation of this dimension must be combined with the information of LoD. -(For example, you can't reshape the 0th dimension of a sequence with :code:`layers.reshape`). - -In order to correctly implement various sequence-oriented operations, we have designed a series of sequence-related APIs. -In practice, because a DenseTensor contains a mini batch of sequences, and different sequences in the same mini batch usually belong to multiple samples, they do not and should not interact with each other. -Therefore, if a layer is input with two (or more) DenseTensors (or with a list of DenseTensors), and each DenseTensor represents a mini batch of sequences, the first sequence in the first DenseTensor will be only calculated with the first sequence in the second DenseTensor, and the second sequence in the first DenseTensor will only be calculated with the second sequence in the second DenseTensor. To conclude with, the *i'th* sequence in the first DenseTensor will only be calculated with the *i'th* sequence in the second DenseTensor, and so on. - -**In summary, a DenseTensor stores multiple sequences in a mini batch, where the number of sequences is batch size; when multiple DenseTensors are calculated, the i'th sequence in each DenseTensor will only be calculated with the i'th of the other DenseTensors. Understanding this is critical to understand the following associated operations.** - -1. sequence_softmax -------------------- -This layer takes a mini batch of sequences as input and does a softmax operation in each sequence. The output is a mini batch of sequences in the same shape, but it is normalized by softmax within the sequence. -This layer is often used to do softmax normalization within each sequence. - - Please refer to :ref:`api_fluid_layers_sequence_softmax` - - -2. sequence_concat ------------------- -The layer takes a list as input, which can contain multiple DenseTensors, and every DenseTensors is a mini batch of sequences. -The layer will concatenate the i-th sequence in each batch into a new sequence in the time dimension as the i'th sequence in the returned batch. -Of course, the sequences of each DenseTensor in the list must have the same batch size. - - Please refer to :ref:`api_fluid_layers_sequence_concat` - - -3. sequence_first_step ----------------------- -This layer takes a DenseTensor as input and takes the first element in each sequence (the element of the first time step) as the return value. - - Please refer to :ref:`api_fluid_layers_sequence_first_step` - - -4. sequence_last_step ---------------------- -Same as :code:`sequence_first_step` except that this layer takes the last element in each sequence (i.e. the last time step) as the return value. - - Please refer to :ref:`api_fluid_layers_sequence_last_step` - - -5. sequence_expand ------------------- -This layer has two DenseTensors of sequences as input and extends the sequence in the first batch according to the LoD information of the sequence in the second DenseTensor. -It is usually used to extend a sequence with only one time step (for example, the return result of :code:`sequence_first_step`) into a sequence with multiple time steps, which is convenient for calculations with sequences composed of multiple time steps. - - Please refer to :ref:`api_fluid_layers_sequence_expand` - - -6. sequence_expand_as ---------------------- -This layer takes two DenseTensors of sequences as input and then extends each sequence in the first Tensor to a sequence with the same length as the corresponding one in the second Tensor. -Unlike :code:`sequence_expand` , this layer will strictly extend the sequence in the first DenseTensor to have the same length as the corresponding one in the second DenseTensor. -If it cannot be extended to the same length (for example, the sequence length of the second batch is not an integer multiple of the sequence length of the first batch), an error will be reported. - - Please refer to :ref:`api_fluid_layers_sequence_expand_as` - - -7. sequence_enumerate ---------------------- -This layer takes a DenseTensor of sequences as input and also specifies the length of a :code:`win_size`. This layer will take a subsequence of length :code:`win_size` in all sequences and combine them into a new sequence. - - Please refer to :ref:`api_fluid_layers_sequence_enumerate` - - -8. sequence_reshape -------------------- -This layer requires a DenseTensor of sequences as input, and you need to specify a :code:`new_dim` as the dimension of the new sequence. -The layer will reshape each sequence in the mini batch to the dimension given by new_dim. Note that the length of each sequence will be changed (so does the LoD information) to accommodate the new shape. - - Please refer to :ref:`api_fluid_layers_sequence_reshape` - - -9. sequence_scatter -------------------- -This layer can scatter a sequence of data onto another tensor. This layer has three inputs, one is a target tensor to be scattered :code:`input`; -One is the sequence of data to scatter :code:`update` ; One is the upper coordinate of the target tensor :code:`index` . Output is the tensor after scatter, whose shape is the same as :code:`input`. - - Please refer to :ref:`api_fluid_layers_sequence_scatter` - - -10. sequence_pad ----------------- -This layer can pad sequences of unequal length into equal-length sequences. To use this layer you need to provide a :code:`PadValue` and a :code:`padded_length`. -The former is the element used to pad the sequence, it can be a number or a tensor; the latter is the target length of the sequence. -This layer will return the padded sequence, and a tensor :code:`Length` of the length for each sequence before padding. - - Please refer to :ref:`api_fluid_layers_sequence_pad` - - -11. sequence_mask ------------------ -This layer will generate a mask based on :code:`input`, where the :code:`input` is a tensor that records the length of each sequence. -In addition, this layer requires a parameter :code:`maxlen` to specify the largest sequence length in the sequence. -Usually, this layer is used to generate a mask that will filter away the portion of the paddings in the sequence. -The :code:`input` tensor can usually directly use the returned :code:`Length` from :code:`sequence_pad` . - - Please refer to :ref:`api_fluid_layers_sequence_mask` diff --git a/docs/api_guides/low_level/layers/tensor.rst b/docs/api_guides/low_level/layers/tensor.rst deleted file mode 100644 index b8f209ae635..00000000000 --- a/docs/api_guides/low_level/layers/tensor.rst +++ /dev/null @@ -1,141 +0,0 @@ -.. _api_guide_tensor: - -######## -张量 -######## - -Fluid 中使用两种数据结构来承载数据,分别是 `Tensor 和 LoD_Tensor <../../../user_guides/howto/basic_concept/lod_tensor.html>`_ 。 其中 LoD-Tensor 是 Fluid 的特有概念,它在 Tensor 基础上附加了序列信息。框架中可传输的数据包括:输入、输出、网络中的可学习参数,全部统一使用 LoD-Tensor 表示,Tensor 可以看作是一种特殊的 LoD-Tensor。 - -下面介绍这两种数据的相关操作。 - -Tensor -====== - -1. create_tensor ---------------------- -Tensor 用于在框架中承载数据,使用 :code:`create_tensor` 可以创建一个指定数据类型的 Lod-Tensor 变量, - -API reference 请参考: :ref:`cn_api_fluid_layers_create_tensor` - - -2. create_parameter ---------------------- -神经网络的训练过程是一个对参数的学习过程,Fluid 使用 :code:`create_parameter` 创建一个可学习的参数。该参数的值可以被 operator 改变。 - -API reference 请参考::ref:`cn_api_fluid_layers_create_parameter` - - - -3. create_global_var ---------------------- -Fluid 使用 :code:`create_global_var` 创建一个全局 tensor,通过此 API 可以指定被创建 Tensor 变量的数据类型、形状和值。 - -API reference 请参考::ref:`cn_api_fluid_layers_create_global_var` - - -4. cast ---------------- - -Fluid 使用 :code:`cast` 将数据转换为指定类型。 - -API reference 请参考::ref:`cn_api_fluid_layers_cast` - - -5. concat ----------------- - -Fluid 使用 :code:`concat` 将输入数据沿指定维度连接。 - -API reference 请参考::ref:`cn_api_fluid_layers_concat` - - -6. sums ----------------- - -Fluid 使用 :code:`sums` 执行对输入数据的加和。 - -API reference 请参考::ref:`cn_api_fluid_layers_sums` - -7. fill_constant ------------------ - -Fluid 使用 :code:`fill_constant` 创建一个具有特定形状和类型的 Tensor。可以通过 :code:`value` 设置该变量的初始值。 - -API reference 请参考: :ref:`cn_api_fluid_layers_fill_constant` - -8. assign ---------------- - -Fluid 使用 :code:`assign` 复制一个变量。 - -API reference 请参考::ref:`cn_api_fluid_layers_assign` - -9. argmin --------------- - -Fluid 使用 :code:`argmin` 计算输入 Tensor 指定轴上最小元素的索引。 - -API reference 请参考::ref:`cn_api_fluid_layers_assign` - -10. argmax ------------ - -Fluid 使用 :code:`argmax` 计算输入 Tensor 指定轴上最大元素的索引。 - -API reference 请参考::ref:`cn_api_fluid_layers_argmax` - -11. argsort ------------- - -Fluid 使用 :code:`argsort` 对输入 Tensor 在指定轴上进行排序,并返回排序后的数据变量及其对应的索引值。 - -API reference 请参考: :ref:`cn_api_fluid_layers_argsort` - -12. ones -------------- - -Fluid 使用 :code:`ones` 创建一个指定大小和数据类型的 Tensor,且初始值为 1。 - -API reference 请参考: :ref:`cn_api_fluid_layers_ones` - -13. zeros ---------------- - -Fluid 使用 :code:`zeros` 创建一个指定大小和数据类型的 Tensor,且初始值为 0。 - -API reference 请参考: :ref:`cn_api_fluid_layers_zeros` - -14. reverse -------------------- - -Fluid 使用 :code:`reverse` 沿指定轴反转 Tensor。 - -API reference 请参考: :ref:`cn_api_fluid_layers_reverse` - - - -LoD-Tensor -============ - -LoD-Tensor 非常适用于序列数据,相关知识可以参考阅读 `LoD_Tensor <../../../user_guides/howto/basic_concept/lod_tensor.html>`_ 。 - -1. create_lod_tensor ------------------------ - -Fluid 使用 :code:`create_lod_tensor` 基于 numpy 数组、列表或现有 LoD_Tensor 创建拥有新的层级信息的 LoD_Tensor。 - -API reference 请参考: :ref:`cn_api_fluid_create_lod_tensor` - -2. create_random_int_lodtensor ----------------------------------- - -Fluid 使用 :code:`create_random_int_lodtensor` 创建一个由随机整数组成的 LoD_Tensor。 - -API reference 请参考: :ref:`cn_api_fluid_create_random_int_lodtensor` - -3. reorder_lod_tensor_by_rank ---------------------------------- - -Fluid 使用 :code:`reorder_lod_tensor_by_rank` 对输入 LoD_Tensor 的序列信息按指定顺序重拍。 - -API reference 请参考::ref:`cn_api_fluid_layers_reorder_lod_tensor_by_rank` diff --git a/docs/api_guides/low_level/layers/tensor_en.rst b/docs/api_guides/low_level/layers/tensor_en.rst deleted file mode 100755 index 9f62acb452e..00000000000 --- a/docs/api_guides/low_level/layers/tensor_en.rst +++ /dev/null @@ -1,141 +0,0 @@ -.. _api_guide_tensor_en: - -######## -Tensor -######## - -There are two data structures used in Fluid to host the data, namely `Tensor and LoD_Tensor <../../../user_guides/howto/basic_concept/lod_tensor_en.html>`_ . LoD-Tensor is a unique concept of Fluid, which appends sequence information to Tensor. The data that can be transferred in the framework includes: input, output, and learnable parameters in the network. All of them are uniformly represented by LoD-Tensor. In addition, tensor can be regarded as a special LoD-Tensor. - -Now let's take a closer look at the operations related to these two types of data. - -Tensor -====== - -1. create_tensor ---------------------- -Tensor is used to carry data in the framework, using :code:`create_tensor` to create a Lod-Tensor variable of the specified the data type. - -API reference : :ref:`api_fluid_layers_create_tensor` - - -2. create_parameter ---------------------- -The neural network training process is a learning process for parameters. Fluid uses :code:`create_parameter` to create a learnable parameter. The value of this parameter can be changed by the operator. - -API reference : :ref:`api_fluid_layers_create_parameter` - - - -3. create_global_var ---------------------- -Fluid uses :code:`create_global_var` to create a global tensor and this API allows you to specify the data type, shape, and value of the Tensor variable being created. - -API reference : :ref:`api_fluid_layers_create_global_var` - - -4. cast ---------------- - -Fluid uses :code:`cast` to convert the data to the specified type. - -API reference : :ref:`api_fluid_layers_cast` - - -5.concat ----------------- - -Fluid uses :code:`concat` to concatenate input data along a specified dimension. - -API reference : :ref:`api_fluid_layers_concat` - - -6. sums ----------------- - -Fluid uses :code:`sums` to sum up the input data. - -API reference : :ref:`api_fluid_layers_sums` - -7. fill_constant ------------------ - -Fluid uses :code:`fill_constant` to create a Tensor with a specific shape and type. The initial value of this variable can be set via :code:`value`. - -API reference : :ref:`api_fluid_layers_fill_constant` - -8. assign ---------------- - -Fluid uses :code:`assign` to duplicate a variable. - -API reference : :ref:`api_fluid_layers_assign` - -9. argmin --------------- - -Fluid uses :code:`argmin` to calculate the index of the smallest element on the specified axis of Tensor. - -API reference : :ref:`api_fluid_layers_argmin` - -10. argmax ------------ - -Fluid uses :code:`argmax` to calculate the index of the largest element on the specified axis of Tensor. - -API reference : :ref:`api_fluid_layers_argmax` - -11. argsort ------------- - -Fluid uses :code:`argsort` to sort the input Tensor on the specified axis and it will return the sorted data variables and their corresponding index values. - -API reference : :ref:`api_fluid_layers_argsort` - -12. ones -------------- - -Fluid uses :code:`ones` to create a Tensor of the specified size and data type with an initial value of 1. - -API reference : :ref:`api_fluid_layers_ones` - -13. zeros ---------------- - -Fluid uses :code:`zeros` to create a Tensor of the specified size and data type with an initial value of zero. - -API reference : :ref:`api_fluid_layers_zeros` - -14. reverse -------------------- - -Fluid uses :code:`reverse` to invert Tensor along the specified axis. - -API reference : :ref:`api_fluid_layers_reverse` - - - -LoD-Tensor -============ - -LoD-Tensor is very suitable for sequence data. For related knowledge, please read `Tensor and LoD_Tensor <../../../user_guides/howto/basic_concept/lod_tensor_en.html>`_ . - -1.create_lod_tensor ------------------------ - -Fluid uses :code:`create_lod_tensor` to create a LoD_Tensor with new hierarchical information based on a numpy array, a list, or an existing LoD_Tensor. - -API reference : :ref:`api_fluid_create_lod_tensor` - -2. create_random_int_lodtensor ----------------------------------- - -Fluid uses :code:`create_random_int_lodtensor` to create a LoD_Tensor composed of random integers. - -API reference : :ref:`api_fluid_create_random_int_lodtensor` - -3. reorder_lod_tensor_by_rank ---------------------------------- - -Fluid uses :code:`reorder_lod_tensor_by_rank` to reorder the sequence information of the input LoD_Tensor in the specified order. - -API reference : :ref:`api_fluid_layers_reorder_lod_tensor_by_rank`