From 69ac73301cb91e58bacc24253587ae137bc47154 Mon Sep 17 00:00:00 2001 From: Double_V Date: Thu, 10 Oct 2019 17:43:47 +0800 Subject: [PATCH] [cherry-pick] update en doc for release 1.6 (#20397) * Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into api_fix * test=release/1.6, test=document_fix --- paddle/fluid/API.spec | 8 ++++---- paddle/fluid/operators/row_conv_op.cc | 6 ++---- python/paddle/fluid/initializer.py | 16 +++++++++------- python/paddle/fluid/layers/nn.py | 6 +++++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 2d368c80e79..4d5628a15c1 100755 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -105,7 +105,7 @@ paddle.fluid.io.PipeReader.get_line (ArgSpec(args=['self', 'cut_lines', 'line_br paddle.fluid.io.multiprocess_reader (ArgSpec(args=['readers', 'use_pipe', 'queue_size'], varargs=None, keywords=None, defaults=(True, 1000)), ('document', '7d8b3a96e592107c893d5d51ce968ba0')) paddle.fluid.io.Fake ('paddle.reader.decorator.Fake', ('document', '0d8f4847b99bed6d456ade0d903202e1')) paddle.fluid.io.Fake.__init__ (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) -paddle.fluid.initializer.ConstantInitializer ('paddle.fluid.initializer.ConstantInitializer', ('document', '798f1fd87cbe9798d001ffb6e616415d')) +paddle.fluid.initializer.ConstantInitializer ('paddle.fluid.initializer.ConstantInitializer', ('document', '911263fc30c516c55e89cd72086a23f8')) paddle.fluid.initializer.ConstantInitializer.__init__ (ArgSpec(args=['self', 'value', 'force_cpu'], varargs=None, keywords=None, defaults=(0.0, False)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.initializer.UniformInitializer ('paddle.fluid.initializer.UniformInitializer', ('document', '587b7035cd1d56f76f2ded617b92521d')) paddle.fluid.initializer.UniformInitializer.__init__ (ArgSpec(args=['self', 'low', 'high', 'seed', 'diag_num', 'diag_step', 'diag_val'], varargs=None, keywords=None, defaults=(-1.0, 1.0, 0, 0, 0, 1.0)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) @@ -115,9 +115,9 @@ paddle.fluid.initializer.TruncatedNormalInitializer ('paddle.fluid.initializer.T 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', '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', '8a40b54fe33c19c3edcf6624ffae5d03')) +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')) -paddle.fluid.initializer.MSRAInitializer ('paddle.fluid.initializer.MSRAInitializer', ('document', 'b99e0ee95e2fd02640cb4b08a7ae80cc')) +paddle.fluid.initializer.MSRAInitializer ('paddle.fluid.initializer.MSRAInitializer', ('document', '75c2699c9be56de9dd4e7fcc4c611f74')) paddle.fluid.initializer.MSRAInitializer.__init__ (ArgSpec(args=['self', 'uniform', 'fan_in', 'seed'], varargs=None, keywords=None, defaults=(True, None, 0)), ('document', '53c757bed9345f2ad3361902531e7cf5')) paddle.fluid.initializer.force_init_on_cpu (ArgSpec(args=[], varargs=None, keywords=None, defaults=None), ('document', '5f55553caf939d270c7fe8dc418084b2')) paddle.fluid.initializer.init_on_cpu (ArgSpec(args=[], varargs=None, keywords=None, defaults=None), ('document', 'eaa04fd68661a3af59abd0e19b3b6eda')) @@ -185,7 +185,7 @@ paddle.fluid.layers.nce (ArgSpec(args=['input', 'label', 'num_total_classes', 's paddle.fluid.layers.sampled_softmax_with_cross_entropy (ArgSpec(args=['logits', 'label', 'num_samples', 'num_true', 'remove_accidental_hits', 'use_customized_samples', 'customized_samples', 'customized_probabilities', 'seed'], varargs=None, keywords=None, defaults=(1, True, False, None, None, 0)), ('document', 'd4435a63d34203339831ee6a86ef9242')) paddle.fluid.layers.hsigmoid (ArgSpec(args=['input', 'label', 'num_classes', 'param_attr', 'bias_attr', 'name', 'path_table', 'path_code', 'is_custom', 'is_sparse'], varargs=None, keywords=None, defaults=(None, None, None, None, None, False, False)), ('document', 'b83e7dfa81059b39bb137922dc914f50')) paddle.fluid.layers.beam_search (ArgSpec(args=['pre_ids', 'pre_scores', 'ids', 'scores', 'beam_size', 'end_id', 'level', 'is_accumulated', 'name', 'return_parent_idx'], varargs=None, keywords=None, defaults=(0, True, None, False)), ('document', '1270395ce97a4e1b556104abbb14f096')) -paddle.fluid.layers.row_conv (ArgSpec(args=['input', 'future_context_size', 'param_attr', 'act'], varargs=None, keywords=None, defaults=(None, None)), ('document', '1d8a1c8b686b55631ba1b77805e4eacf')) +paddle.fluid.layers.row_conv (ArgSpec(args=['input', 'future_context_size', 'param_attr', 'act'], varargs=None, keywords=None, defaults=(None, None)), ('document', 'a6477957b44907787b3c74157400b80c')) paddle.fluid.layers.multiplex (ArgSpec(args=['inputs', 'index'], varargs=None, keywords=None, defaults=None), ('document', '2c4d1ae83da6ed35e3b36ba1b3b51d23')) paddle.fluid.layers.layer_norm (ArgSpec(args=['input', 'scale', 'shift', 'begin_norm_axis', 'epsilon', 'param_attr', 'bias_attr', 'act', 'name'], varargs=None, keywords=None, defaults=(True, True, 1, 1e-05, None, None, None, None)), ('document', '79797f827d89ae72c77960e9696883a9')) paddle.fluid.layers.group_norm (ArgSpec(args=['input', 'groups', 'epsilon', 'param_attr', 'bias_attr', 'act', 'data_layout', 'name'], varargs=None, keywords=None, defaults=(1e-05, None, None, None, 'NCHW', None)), ('document', '87dd4b818f102bc1a780e1804c28bd38')) diff --git a/paddle/fluid/operators/row_conv_op.cc b/paddle/fluid/operators/row_conv_op.cc index 1645c47e966..d66b0a65fe0 100644 --- a/paddle/fluid/operators/row_conv_op.cc +++ b/paddle/fluid/operators/row_conv_op.cc @@ -89,10 +89,8 @@ class RowConvOpMaker : public framework::OpProtoAndCheckerMaker { "future_context is the future context length and N is the data " "dimension."); AddOutput("Out", - "the output(Out) is a LodTensor, which supports " - "variable time-length input sequences. The underlying tensor " - "in this LodTensor is a matrix with shape T x N, i.e., the " - "same shape as X."); + "the output(Out) is a LodTensor or Tensor, which has same type" + " and same shape as X."); AddComment(R"DOC( :strong:`Row-convolution operator` diff --git a/python/paddle/fluid/initializer.py b/python/paddle/fluid/initializer.py index 208ac72b03a..a58f4efee80 100644 --- a/python/paddle/fluid/initializer.py +++ b/python/paddle/fluid/initializer.py @@ -130,13 +130,13 @@ class ConstantInitializer(Initializer): """Implements the constant initializer Args: - value (float): constant value to initialize the variable + value (float32): constant value to initialize the variable Examples: .. code-block:: python import paddle.fluid as fluid - x = fluid.layers.data(name="data", shape=[32, 32], dtype="float32") + x = fluid.data(name="data", shape=[8, 32, 32], dtype="float32") fc = fluid.layers.fc(input=x, size=10, param_attr=fluid.initializer.Constant(value=2.0)) @@ -627,9 +627,9 @@ class MSRAInitializer(Initializer): Args: uniform (bool): whether to use uniform or normal distribution - fan_in (float): fan_in for MSRAInitializer. If None, it is\ - inferred from the variable. - seed (int): random seed + fan_in (float32|None): fan_in for MSRAInitializer. If None, it is\ + inferred from the variable. default is None. + seed (int32): random seed Note: It is recommended to set fan_in to None for most cases. @@ -638,7 +638,7 @@ class MSRAInitializer(Initializer): .. code-block:: python import paddle.fluid as fluid - x = fluid.layers.data(name="data", shape=[32, 32], dtype="float32") + x = fluid.data(name="data", shape=[8, 32, 32], dtype="float32") fc = fluid.layers.fc(input=x, size=10, param_attr=fluid.initializer.MSRA(uniform=False)) @@ -744,11 +744,13 @@ class BilinearInitializer(Initializer): import paddle.fluid as fluid factor = 2 C = 2 + B = 8 + H = W = 32 w_attr = fluid.param_attr.ParamAttr( learning_rate=0., regularizer=fluid.regularizer.L2Decay(0.), initializer=fluid.initializer.Bilinear()) - x = fluid.layers.data(name="data", shape=[3, 32, 32], + x = fluid.data(name="data", shape=[B, 3, H, W], dtype="float32") conv_up = fluid.layers.conv2d_transpose( input=x, diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 91f31d605bb..0eb724bb4f6 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -7503,10 +7503,14 @@ def row_conv(input, future_context_size, param_attr=None, act=None): ${out_comment}. Examples: + >>> # for LodTensor inputs >>> import paddle.fluid as fluid - >>> x = fluid.layers.data(name='x', shape=[16], + >>> x = fluid.data(name='x', shape=[9, 16], >>> dtype='float32', lod_level=1) >>> out = fluid.layers.row_conv(input=x, future_context_size=2) + >>> # for Tensor inputs + >>> x = fluid.data(name='x', shape=[9, 4, 16], dtype='float32') + >>> out = fluid.layers.row_conv(input=x, future_context_size=2) """ helper = LayerHelper('row_conv', **locals()) dtype = helper.input_dtype() -- GitLab