From aaae3475e396c795e2af7e635311e295413d69e7 Mon Sep 17 00:00:00 2001 From: xiaoting <31891223+tink2123@users.noreply.github.com> Date: Thu, 10 Oct 2019 12:11:52 +0800 Subject: [PATCH] Polish english apis' doc (#20184) * polish en api,test=develop,test=document_fix * modified api.spec, test=develop,test=document_fix * modified ops for arc,test=develop,test=document_fix * update for 1.6, test=develop,test=document_fix * update API.spec * Update API.spec test=develop,test=document_fix * Update API.spec test=develop,test=document_fix --- paddle/fluid/API.spec | 48 +++++++++---------- python/paddle/fluid/initializer.py | 8 ++-- python/paddle/fluid/layers/detection.py | 43 +++++++++-------- .../fluid/layers/layer_function_generator.py | 2 +- 4 files changed, 53 insertions(+), 48 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index d9806538208..4f157d61df7 100755 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -113,7 +113,7 @@ paddle.fluid.initializer.NormalInitializer ('paddle.fluid.initializer.NormalInit paddle.fluid.initializer.NormalInitializer.__init__ (ArgSpec(args=['self', 'loc', 'scale', 'seed'], varargs=None, keywords=None, defaults=(0.0, 1.0, 0)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.initializer.TruncatedNormalInitializer ('paddle.fluid.initializer.TruncatedNormalInitializer', ('document', 'b8e90aad6ee5687cb5f2b6fd404370d1')) paddle.fluid.initializer.TruncatedNormalInitializer.__init__ (ArgSpec(args=['self', 'loc', 'scale', 'seed'], varargs=None, keywords=None, defaults=(0.0, 1.0, 0)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) -paddle.fluid.initializer.XavierInitializer ('paddle.fluid.initializer.XavierInitializer', ('document', '3d5676f1a5414aa0c815d793a795ccb3')) +paddle.fluid.initializer.XavierInitializer ('paddle.fluid.initializer.XavierInitializer', ('document', 'c3b1953ac9b0bf6c0dac50a093b4ef04')) paddle.fluid.initializer.XavierInitializer.__init__ (ArgSpec(args=['self', 'uniform', 'fan_in', 'fan_out', 'seed'], varargs=None, keywords=None, defaults=(True, None, None, 0)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.initializer.BilinearInitializer ('paddle.fluid.initializer.BilinearInitializer', ('document', '0abf3908cf6a520dcf822c481bd05767')) paddle.fluid.initializer.BilinearInitializer.__init__ (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', 'd389912dc079cbef432335a00017cec0')) @@ -385,26 +385,26 @@ paddle.fluid.layers.StaticRNN.update_memory (ArgSpec(args=['self', 'mem', 'var'] paddle.fluid.layers.reorder_lod_tensor_by_rank (ArgSpec(args=['x', 'rank_table'], varargs=None, keywords=None, defaults=None), ('document', '5b552a1f0f7eb4dacb768a975ba15d08')) paddle.fluid.layers.Print (ArgSpec(args=['input', 'first_n', 'message', 'summarize', 'print_tensor_name', 'print_tensor_type', 'print_tensor_shape', 'print_tensor_lod', 'print_phase'], varargs=None, keywords=None, defaults=(-1, None, 20, True, True, True, True, 'both')), ('document', '3130bed32922b9fd84ce2dea6250f635')) paddle.fluid.layers.is_empty (ArgSpec(args=['x', 'cond'], varargs=None, keywords=None, defaults=(None,)), ('document', '3011dc695f490afdf504dc24f628319a')) -paddle.fluid.layers.sigmoid (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'bdc9a71908d3c9748532ff44c2f31034')) -paddle.fluid.layers.logsigmoid (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '9a4c346630a042454f727ad5e0cffc11')) -paddle.fluid.layers.exp (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '92bec0a7fdec48ad78effdf30b02c6fa')) -paddle.fluid.layers.tanh (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'e7a81a4af62b6c6ce858c897f74a4f0f')) -paddle.fluid.layers.atan (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '2dde114018cbcaff9b24c566bf6704a5')) -paddle.fluid.layers.tanh_shrink (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '000a76652c8e59e21e7fb6d87cc7a668')) -paddle.fluid.layers.sqrt (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'e3dce5e892ce63cc9c6ed87a7e6206d5')) -paddle.fluid.layers.rsqrt (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '0b90c858d4d71a58896537c1bd7acb09')) -paddle.fluid.layers.abs (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '503f4d5723bbe1b6c9f24058078709ed')) -paddle.fluid.layers.ceil (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '5602b78da33c4b0ccaea0374411de423')) -paddle.fluid.layers.floor (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'a0977ab14448ba472e5c2e152f42a818')) -paddle.fluid.layers.cos (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'e94c8569179ffa3a0dca028a5b518dbf')) -paddle.fluid.layers.acos (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '5c9a00178c5c28bb824f7d6c25060d3b')) -paddle.fluid.layers.asin (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '20d1d49fe4d13430a63c57fc4b29a677')) -paddle.fluid.layers.sin (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '4441e4e5e9934eb98760e31330e7a13c')) -paddle.fluid.layers.round (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '40132ef34808ed621c63ed4fd886fd1c')) -paddle.fluid.layers.reciprocal (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '578106495166d0fb65ade2bb51cdf926')) -paddle.fluid.layers.square (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '728233aff902803f5f62e2d340c3bcbb')) -paddle.fluid.layers.softplus (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '74c4e6dfbdfc3453301ea11d722ad3d6')) -paddle.fluid.layers.softsign (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'a70e9320b113ca33c1299bbc032f09d4')) +paddle.fluid.layers.sigmoid (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '6e5a9645817c781e936da11c20395909')) +paddle.fluid.layers.logsigmoid (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '846e66903386aadb31a68c8226ac4880')) +paddle.fluid.layers.exp (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'f96f7fbb3af9816d9960c14737682ee5')) +paddle.fluid.layers.tanh (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '78df12509dddc43baa9cd3d9bb051e8d')) +paddle.fluid.layers.atan (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'f9ad8c2d64119bf4025ffe371bfbc3ad')) +paddle.fluid.layers.tanh_shrink (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '1c9a12739f34385ecd94b03690fffe0b')) +paddle.fluid.layers.sqrt (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '2bfcce8ed36f46973b384db8d229b6f5')) +paddle.fluid.layers.rsqrt (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '27b079cd8002e07dffb4334eba5b3c96')) +paddle.fluid.layers.abs (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '940e2c21a0dab0f035b71eae9d71adec')) +paddle.fluid.layers.ceil (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'a8e6a72192ea5f433a0a150de8152354')) +paddle.fluid.layers.floor (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'ad6c7fc037b433753729f47c7765034f')) +paddle.fluid.layers.cos (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '4f4b15408ae927112e8793441c165709')) +paddle.fluid.layers.acos (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '685761a55d82355ff3421e99b2bc710d')) +paddle.fluid.layers.asin (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '9a2272c67f32c5e662dd96ed21d0b22a')) +paddle.fluid.layers.sin (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'b5226c5b623ecc8bf893990e3b190f7d')) +paddle.fluid.layers.round (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '16fdd1d5a03b9c3f8c436156c0cd508b')) +paddle.fluid.layers.reciprocal (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '50b76cb575a1a09fe1b53ffc06a77e3f')) +paddle.fluid.layers.square (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'b283c4eb9a975d5289d4f53500aa50fa')) +paddle.fluid.layers.softplus (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '0e619a20fa04d2d997b7757dd246eeb2')) +paddle.fluid.layers.softsign (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'bf02c7440088ebb934217c92f001a09d')) paddle.fluid.layers.softshrink (ArgSpec(args=['x', 'alpha'], varargs=None, keywords=None, defaults=(None,)), ('document', '958c7bfdfb0b5e92af6ca4a90d24e5ef')) paddle.fluid.layers.hard_shrink (ArgSpec(args=['x', 'threshold'], varargs=None, keywords=None, defaults=(None,)), ('document', '386a4103d2884b2f1312ebc1e8ee6486')) paddle.fluid.layers.cumsum (ArgSpec(args=['x', 'axis', 'exclusive', 'reverse'], varargs=None, keywords=None, defaults=(None, None, None)), ('document', '5ab9d5721a6734fe127069e4314e1309')) @@ -427,10 +427,10 @@ paddle.fluid.layers.generate_mask_labels (ArgSpec(args=['im_info', 'gt_classes', paddle.fluid.layers.iou_similarity (ArgSpec(args=['x', 'y', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'e24478fd1fcf1727d4947fe14356b3d4')) paddle.fluid.layers.box_coder (ArgSpec(args=['prior_box', 'prior_box_var', 'target_box', 'code_type', 'box_normalized', 'name', 'axis'], varargs=None, keywords=None, defaults=('encode_center_size', True, None, 0)), ('document', '511d7033c0cfce1a5b88c04ad6e7ed5b')) paddle.fluid.layers.polygon_box_transform (ArgSpec(args=['input', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '2183f03c4f16712dcef6a474dbcefa24')) -paddle.fluid.layers.yolov3_loss (ArgSpec(args=['x', 'gt_box', 'gt_label', 'anchors', 'anchor_mask', 'class_num', 'ignore_thresh', 'downsample_ratio', 'gt_score', 'use_label_smooth', 'name'], varargs=None, keywords=None, defaults=(None, True, None)), ('document', '400403175718d5a632402cdae88b01b8')) -paddle.fluid.layers.yolo_box (ArgSpec(args=['x', 'img_size', 'anchors', 'class_num', 'conf_thresh', 'downsample_ratio', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'ed56ff21536ca5c8ad418d0cfaf6a7b9')) +paddle.fluid.layers.yolov3_loss (ArgSpec(args=['x', 'gt_box', 'gt_label', 'anchors', 'anchor_mask', 'class_num', 'ignore_thresh', 'downsample_ratio', 'gt_score', 'use_label_smooth', 'name'], varargs=None, keywords=None, defaults=(None, True, None)), ('document', 'df35e6510e8db0844320ec77dc8b7dc4')) +paddle.fluid.layers.yolo_box (ArgSpec(args=['x', 'img_size', 'anchors', 'class_num', 'conf_thresh', 'downsample_ratio', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '7f255b1f6a548f8fa78bbbc06285fc46')) paddle.fluid.layers.box_clip (ArgSpec(args=['input', 'im_info', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'ce2bfbd685f2a36eda400e00569908cb')) -paddle.fluid.layers.multiclass_nms (ArgSpec(args=['bboxes', 'scores', 'score_threshold', 'nms_top_k', 'keep_top_k', 'nms_threshold', 'normalized', 'nms_eta', 'background_label', 'name'], varargs=None, keywords=None, defaults=(0.3, True, 1.0, 0, None)), ('document', 'f6e333d76922c6e564413b4d216c245c')) +paddle.fluid.layers.multiclass_nms (ArgSpec(args=['bboxes', 'scores', 'score_threshold', 'nms_top_k', 'keep_top_k', 'nms_threshold', 'normalized', 'nms_eta', 'background_label', 'name'], varargs=None, keywords=None, defaults=(0.3, True, 1.0, 0, None)), ('document', 'c01ac2f1fced1ddd98574e71e877a6c2')) paddle.fluid.layers.multiclass_nms2 (ArgSpec(args=['bboxes', 'scores', 'score_threshold', 'nms_top_k', 'keep_top_k', 'nms_threshold', 'normalized', 'nms_eta', 'background_label', 'return_index', 'name'], varargs=None, keywords=None, defaults=(0.3, True, 1.0, 0, False, None)), ('document', 'be156186ee7a2ee56ab30b964acb15e5')) paddle.fluid.layers.retinanet_detection_output (ArgSpec(args=['bboxes', 'scores', 'anchors', 'im_info', 'score_threshold', 'nms_top_k', 'keep_top_k', 'nms_threshold', 'nms_eta'], varargs=None, keywords=None, defaults=(0.05, 1000, 100, 0.3, 1.0)), ('document', '078d28607ce261a0cba2b965a79f6bb8')) paddle.fluid.layers.distribute_fpn_proposals (ArgSpec(args=['fpn_rois', 'min_level', 'max_level', 'refer_level', 'refer_scale', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '1f2b6bfb3027ea63ab86859391f45b03')) diff --git a/python/paddle/fluid/initializer.py b/python/paddle/fluid/initializer.py index 3e53413639f..a58f4efee80 100644 --- a/python/paddle/fluid/initializer.py +++ b/python/paddle/fluid/initializer.py @@ -496,10 +496,10 @@ class XavierInitializer(Initializer): Args: - uniform (bool): whether to use uniform or normal distribution - fan_in (float): fan_in for Xavier initialization. If None, it is + uniform (bool,default True): whether to use uniform ,if False use normal distribution + fan_in (float,default None): fan_in for Xavier initialization. If None, it is inferred from the variable. - fan_out (float): fan_out for Xavier initialization. If None, it is + fan_out (float,default None): fan_out for Xavier initialization. If None, it is inferred from the variable. seed (int): random seed @@ -510,7 +510,7 @@ class XavierInitializer(Initializer): .. code-block:: python import paddle.fluid as fluid - queries = fluid.layers.data(name='x', shape=[1], dtype='float32') + queries = fluid.data(name='x', shape=[None,1], dtype='float32') fc = fluid.layers.fc( input=queries, size=10, param_attr=fluid.initializer.Xavier(uniform=False)) diff --git a/python/paddle/fluid/layers/detection.py b/python/paddle/fluid/layers/detection.py index 7309d4575b5..4a004f3033e 100644 --- a/python/paddle/fluid/layers/detection.py +++ b/python/paddle/fluid/layers/detection.py @@ -834,22 +834,24 @@ def yolov3_loss(x, ${comment} Args: - x (Variable): ${x_comment} + x (Variable): ${x_comment}The data type is float32 or float64. gt_box (Variable): groud truth boxes, should be in shape of [N, B, 4], in the third dimenstion, x, y, w, h should be stored. x,y is the center cordinate of boxes, w, h are the width and height, x, y, w, h should be divided by input image height to scale to [0, 1]. N is the batch number and B is the max box number in - an image. + an image.The data type is float32 or float64. gt_label (Variable): class id of ground truth boxes, shoud be in shape - of [N, B]. + of [N, B].The data type is int32. anchors (list|tuple): ${anchors_comment} anchor_mask (list|tuple): ${anchor_mask_comment} class_num (int): ${class_num_comment} ignore_thresh (float): ${ignore_thresh_comment} downsample_ratio (int): ${downsample_ratio_comment} - name (string): the name of yolov3 loss. Default None. + name (string): The default value is None. Normally there is no need + for user to set this property. For more information, + please refer to :ref:`api_guide_Name` gt_score (Variable): mixup score of ground truth boxes, shoud be in shape of [N, B]. Default None. use_label_smooth (bool): ${use_label_smooth_comment} @@ -871,10 +873,10 @@ def yolov3_loss(x, .. code-block:: python import paddle.fluid as fluid - x = fluid.layers.data(name='x', shape=[255, 13, 13], dtype='float32') - gt_box = fluid.layers.data(name='gt_box', shape=[6, 4], dtype='float32') - gt_label = fluid.layers.data(name='gt_label', shape=[6], dtype='int32') - gt_score = fluid.layers.data(name='gt_score', shape=[6], dtype='float32') + x = fluid.data(name='x', shape=[None, 255, 13, 13], dtype='float32') + gt_box = fluid.data(name='gt_box', shape=[None, 6, 4], dtype='float32') + gt_label = fluid.data(name='gt_label', shape=[None, 6], dtype='int32') + gt_score = fluid.data(name='gt_score', shape=[None, 6], dtype='float32') anchors = [10, 13, 16, 30, 33, 23, 30, 61, 62, 45, 59, 119, 116, 90, 156, 198, 373, 326] anchor_mask = [0, 1, 2] loss = fluid.layers.yolov3_loss(x=x, gt_box=gt_box, gt_label=gt_label, @@ -955,13 +957,15 @@ def yolo_box(x, ${comment} Args: - x (Variable): ${x_comment} - img_size (Variable): ${img_size_comment} + x (Variable): ${x_comment} The data type is float32 or float64. + img_size (Variable): ${img_size_comment} The data type is int32. anchors (list|tuple): ${anchors_comment} class_num (int): ${class_num_comment} conf_thresh (float): ${conf_thresh_comment} downsample_ratio (int): ${downsample_ratio_comment} - name (string): the name of yolo box layer. Default None. + name (string): The default value is None. Normally there is no need + for user to set this property. For more information, + please refer to :ref:`api_guide_Name` Returns: Variable: A 3-D tensor with shape [N, M, 4], the coordinates of boxes, @@ -979,8 +983,8 @@ def yolo_box(x, .. code-block:: python import paddle.fluid as fluid - x = fluid.layers.data(name='x', shape=[255, 13, 13], dtype='float32') - img_size = fluid.layers.data(name='img_size',shape=[2],dtype='int64') + x = fluid.data(name='x', shape=[None, 255, 13, 13], dtype='float32') + img_size = fluid.data(name='img_size',shape=[None, 2],dtype='int64') anchors = [10, 13, 16, 30, 33, 23] boxes,scores = fluid.layers.yolo_box(x=x, img_size=img_size, class_num=80, anchors=anchors, conf_thresh=0.01, downsample_ratio=32) @@ -2802,9 +2806,10 @@ def multiclass_nms(bboxes, N is the batch size. Each bounding box has four coordinate values and the layout is [xmin, ymin, xmax, ymax], when box size equals to 4. + The data type is float32 or float64. 2. (LoDTensor) A 3-D Tensor with shape [M, C, 4] M is the number of bounding boxes, C is the - class number + class number. The data type is float32 or float64. scores (Variable): Two types of scores are supported: 1. (Tensor) A 3-D Tensor with shape [N, C, M] represents the predicted confidence predictions. @@ -2812,11 +2817,11 @@ def multiclass_nms(bboxes, number of bounding boxes. For each category there are total M scores which corresponding M bounding boxes. Please note, M is equal to the 2nd dimension - of BBoxes. + of BBoxes.The data type is float32 or float64. 2. (LoDTensor) A 2-D LoDTensor with shape [M, C]. M is the number of bbox, C is the class number. In this case, input BBoxes should be the second - case with shape [M, C, 4]. + case with shape [M, C, 4].The data type is float32 or float64. background_label (int): The index of background label, the background label will be ignored. If set to -1, then all categories will be considered. Default: 0 @@ -2834,7 +2839,7 @@ def multiclass_nms(bboxes, name(str): Name of the multiclass nms op. Default: None. Returns: - Out(Variable): A 2-D LoDTensor with shape [No, 6] represents the detections. + Variable: A 2-D LoDTensor with shape [No, 6] represents the detections. Each row has 6 values: [label, confidence, xmin, ymin, xmax, ymax] or A 2-D LoDTensor with shape [No, 10] represents the detections. Each row has 10 values: @@ -2851,9 +2856,9 @@ def multiclass_nms(bboxes, import paddle.fluid as fluid - boxes = fluid.layers.data(name='bboxes', shape=[81, 4], + boxes = fluid.data(name='bboxes', shape=[None,81, 4], dtype='float32', lod_level=1) - scores = fluid.layers.data(name='scores', shape=[81], + scores = fluid.data(name='scores', shape=[None,81], dtype='float32', lod_level=1) out = fluid.layers.multiclass_nms(bboxes=boxes, scores=scores, diff --git a/python/paddle/fluid/layers/layer_function_generator.py b/python/paddle/fluid/layers/layer_function_generator.py index c7b58692d6f..5589dee2755 100755 --- a/python/paddle/fluid/layers/layer_function_generator.py +++ b/python/paddle/fluid/layers/layer_function_generator.py @@ -261,7 +261,7 @@ Examples: .. code-block:: python import paddle.fluid as fluid - data = fluid.layers.data(name="input", shape=[32, 784]) + data = fluid.layers.data(name="input", shape=[None, 32, 784]) result = fluid.layers.%s(data) """ % op_type return func -- GitLab