diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 9d0ee10b1973bd78d49cb4e938988a9a164fc874..62ef52ec196d4ace832804ce25ea1f044f4c4205 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -55,8 +55,8 @@ paddle.fluid.create_random_int_lodtensor (ArgSpec(args=['recursive_seq_lens', 'b paddle.fluid.DataFeedDesc ('paddle.fluid.data_feed_desc.DataFeedDesc', ('document', '43877a0d9357db94d3dbc7359cbe8c73')) paddle.fluid.DataFeedDesc.__init__ (ArgSpec(args=['self', 'proto_file'], varargs=None, keywords=None, defaults=None), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.DataFeedDesc.desc (ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None), ('document', '9c6615854b61caa5f0d3e6ccc5e51338')) -paddle.fluid.DataFeedDesc.set_batch_size (ArgSpec(args=['self', 'batch_size'], varargs=None, keywords=None, defaults=None), ('document', 'a34790bff4a2891713ddd644db56418d')) -paddle.fluid.DataFeedDesc.set_dense_slots (ArgSpec(args=['self', 'dense_slots_name'], varargs=None, keywords=None, defaults=None), ('document', 'fdd07ce63e72bed57f2c0db5bec5720f')) +paddle.fluid.DataFeedDesc.set_batch_size (ArgSpec(args=['self', 'batch_size'], varargs=None, keywords=None, defaults=None), ('document', '4e4652f098a9c7bb0a10cf623108015b')) +paddle.fluid.DataFeedDesc.set_dense_slots (ArgSpec(args=['self', 'dense_slots_name'], varargs=None, keywords=None, defaults=None), ('document', '0b7a04bf99ed8983ad7ad4fda19be061')) paddle.fluid.DataFeedDesc.set_use_slots (ArgSpec(args=['self', 'use_slots_name'], varargs=None, keywords=None, defaults=None), ('document', 'c23a79dfa04edd014b477bd4b183da06')) paddle.fluid.CompiledProgram ('paddle.fluid.compiler.CompiledProgram', ('document', 'c49ba191cbbbdf7c02b7ac978c06d7e0')) paddle.fluid.CompiledProgram.__init__ (ArgSpec(args=['self', 'program_or_graph', 'build_strategy'], varargs=None, keywords=None, defaults=(None,)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) @@ -300,7 +300,7 @@ paddle.fluid.layers.kldiv_loss (ArgSpec(args=['x', 'target', 'reduction', 'name' paddle.fluid.layers.npair_loss (ArgSpec(args=['anchor', 'positive', 'labels', 'l2_reg'], varargs=None, keywords=None, defaults=(0.002,)), ('document', '3828c4bd81c25af0ab955f52d453c587')) paddle.fluid.layers.pixel_shuffle (ArgSpec(args=['x', 'upscale_factor'], varargs=None, keywords=None, defaults=None), ('document', '7e5cac851fd9bad344230e1044b6a565')) paddle.fluid.layers.fsp_matrix (ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None), ('document', '3a4eb7cce366f5fd8bc38b42b6af5ba1')) -paddle.fluid.layers.continuous_value_model (ArgSpec(args=['input', 'cvm', 'use_cvm'], varargs=None, keywords=None, defaults=(True,)), ('document', 'c03490ffaa1b78258747157c313db4cd')) +paddle.fluid.layers.continuous_value_model (ArgSpec(args=['input', 'cvm', 'use_cvm'], varargs=None, keywords=None, defaults=(True,)), ('document', 'b335b531931cc8b2d19c65980eadfc1e')) paddle.fluid.layers.where (ArgSpec(args=['condition'], varargs=None, keywords=None, defaults=None), ('document', '68810eedf448f2cb3abd46518dd46c39')) paddle.fluid.layers.sign (ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None), ('document', '9f19288d9a8dabcfd0bbb4fc032fa521')) paddle.fluid.layers.deformable_conv (ArgSpec(args=['input', 'offset', 'mask', 'num_filters', 'filter_size', 'stride', 'padding', 'dilation', 'groups', 'deformable_groups', 'im2col_step', 'param_attr', 'bias_attr', 'modulated', 'name'], varargs=None, keywords=None, defaults=(1, 0, 1, None, None, None, None, None, True, None)), ('document', '3e090f9e90b9c24d07348243bf137b56')) diff --git a/python/paddle/fluid/data_feed_desc.py b/python/paddle/fluid/data_feed_desc.py index fa4e35a44c46c7d01b939b1790e33fd3c829cc11..eca9543c60a3a4f676a7bffe91cf975efac49437 100644 --- a/python/paddle/fluid/data_feed_desc.py +++ b/python/paddle/fluid/data_feed_desc.py @@ -92,7 +92,7 @@ class DataFeedDesc(object): def set_batch_size(self, batch_size): """ - Set batch size. Will be effective during training + Set :attr:`batch_size` in :ref:`api_fluid_DataFeedDesc` . :attr:`batch_size` can be changed during training. Example: .. code-block:: python @@ -120,16 +120,20 @@ class DataFeedDesc(object): data_feed.set_batch_size(128) Args: - batch_size: batch size + batch_size (int): The number of batch size. + + Returns: + None. """ self.proto_desc.batch_size = batch_size def set_dense_slots(self, dense_slots_name): """ - Set if a specific slot will be dense. Will be effective during training. - features for a dense slot will be fed into a Tensor, while those for a - sparse slot will be fed into a LoDTensor + Set slots in :attr:`dense_slots_name` as dense slots. **Note: In default, all slots are sparse slots.** + + Features for a dense slot will be fed into a Tensor, while those for a + sparse slot will be fed into a LoDTensor. Example: .. code-block:: python @@ -157,10 +161,11 @@ class DataFeedDesc(object): data_feed.set_dense_slots(['words']) Args: - dense_slots_name: a list of slot names which will be set dense + dense_slots_name (list(str)): a list of slot names which will be set dense. + + Returns: + None. - Note: - Default is sparse for all slots """ if self.proto_desc.name != "MultiSlotDataFeed": raise ValueError( diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index eddc90f46afc11dd5f93dce439988c17c791c980..564a4aee3a4016fbf25ced328b51ba9d5d6cc2b7 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -15055,32 +15055,34 @@ def continuous_value_model(input, cvm, use_cvm=True): **continuous_value_model layers** - continuous value model(cvm). Now, it only considers show and click value in CTR project. - We assume that input is an embedding vector with cvm_feature, whose shape is [N * D] (D is 2 + embedding dim). - If use_cvm is True, it will log(cvm_feature), and output shape is [N * D]. - If use_cvm is False, it will remove cvm_feature from input, and output shape is [N * (D - 2)]. - - This layer accepts a tensor named input which is ID after embedded(lod level is 1), cvm is a show_click info. + Now, this OP is used in CTR project to remove or dispose show and click value in :attr:`input`. - Args: + :attr:`input` is an embedding vector including show and click value, whose shape is :math:`[N, D]` (N is batch size. D is `2 + embedding dim` ). + Show and click at first two dims of embedding vector D. + If :attr:`use_cvm` is True, it will caculate :math:`log(show)` and :math:`log(click)` , and output shape is :math:`[N, D]` . + If :attr:`use_cvm` is False, it will remove show and click from :attr:`input` , and output shape is :math:`[N, D - 2]` . + :attr:`cvm` is show_click info, whose shape is :math:`[N, 2]` . - input (Variable): a 2-D LodTensor with shape [N x D], where N is the batch size, D is 2 + the embedding dim. lod level = 1. - cvm (Variable): a 2-D Tensor with shape [N x 2], where N is the batch size, 2 is show and click. - use_cvm (bool): use cvm or not. if use cvm, the output dim is the same as input - if don't use cvm, the output dim is input dim - 2(remove show and click) - (cvm op is a customized op, which input is a sequence has embed_with_cvm default, so we need an op named cvm to decided whever use it or not.) + Args: + input (Variable): The input variable. A 2-D LoDTensor with shape :math:`[N, D]` , where N is the batch size, D is `2 + the embedding dim` . `lod level = 1` . + A Tensor with type float32, float64. + cvm (Variable): Show and click variable. A 2-D Tensor with shape :math:`[N, 2]` , where N is the batch size, 2 is show and click. + A Tensor with type float32, float64. + use_cvm (bool): Use show_click or not. if use, the output dim is the same as input. + if not use, the output dim is `input dim - 2` (remove show and click) Returns: - Variable: A 2-D LodTensor with shape [N x D], if use cvm, D is equal to input dim, if don't use cvm, D is equal to input dim - 2. + Variable: A 2-D LodTensor with shape :math:`[N, M]` . if :attr:`use_cvm` = True, M is equal to input dim D. if False, M is equal to `D - 2`. \ + A Tensor with same type as input. Examples: .. code-block:: python import paddle.fluid as fluid - input = fluid.layers.data(name="input", shape=[-1, 1], lod_level=1, append_batch_size=False, dtype="int64")#, stop_gradient=False) - label = fluid.layers.data(name="label", shape=[-1, 1], append_batch_size=False, dtype="int64") + input = fluid.data(name="input", shape=[64, 1], dtype="int64") + label = fluid.data(name="label", shape=[64, 1], dtype="int64") embed = fluid.layers.embedding( input=input, size=[100, 11],