From db6c1eb48f875c0f6cdd8353e1780346c5a47501 Mon Sep 17 00:00:00 2001 From: wangchaochaohu Date: Wed, 25 Sep 2019 13:12:37 +0800 Subject: [PATCH] fix fill_constant_batch_size_like doc (#1238) * fix fill_constant_batch_like doc test=develop * fix doc test=develop * fix typo test=develop * fix according reviewer advice test=develop * fix according review advice test=develop --- .../fill_constant_batch_size_like_cn.rst | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/doc/fluid/api_cn/layers_cn/fill_constant_batch_size_like_cn.rst b/doc/fluid/api_cn/layers_cn/fill_constant_batch_size_like_cn.rst index 25dd85459..9083a63e4 100644 --- a/doc/fluid/api_cn/layers_cn/fill_constant_batch_size_like_cn.rst +++ b/doc/fluid/api_cn/layers_cn/fill_constant_batch_size_like_cn.rst @@ -5,33 +5,26 @@ fill_constant_batch_size_like .. py:function:: paddle.fluid.layers.fill_constant_batch_size_like(input,shape,dtype,value,input_dim_idx=0,output_dim_idx=0) -该功能创建一个张量,含有具体的shape,dtype和batch尺寸。并用 ``Value`` 中提供的常量初始化该张量。该批尺寸从输入张量中获取。它还将stop_gradient设置为True. +该OP创建一个形状为shape并且数据类型为dtype的Tensor,同时用 ``value`` 中提供的常量初始化该Tensor。在输入为LoDTensor并且input_dim_idx为0的 +时候将输出output_dim_idx维度的大小设置为input输入的batch_size的值,创建的Tensor的stop_gradient属性默认为False。 参数: - - **input** (Variable)-张量,其第input_dim_idx维可指定batch_size - - **shape** (INTS)-输出的形状 - - **dtype** (INT)-可以为numpy.dtype。输出数据类型。默认为float32 - - **value** (FLOAT)-默认为0.将要被填充的值 - - **input_dim_idx** (INT)-默认为0.输入批尺寸维的索引 - - **output_dim_idx** (INT)-默认为0.输出批尺寸维的索引 + - **input** (Variable)- 输入的Tensor或者LoDTensor,支持数据类型为 float32, float64, int32, int64。 + - **shape** (list)- 创建Tensor的shape,最后创建的LoDTensor的shape可能会依据input发生变动。 + - **dtype** (np.dtype|core.VarDesc.VarType|str)- 创建Tensor的数据类型,支持数据类型为 float32, float64, int32, int64。 + - **value** (float|int)- 用于初始化输出Tensor的常量数据的值。 + - **input_dim_idx** (int)- 当值为0并且输入为LoDTensor的时候,创建Tensor的output_dim_idx维度会设置为input的batch_size值,默认值为0。 + - **output_dim_idx** (int) -用于指定创建的Tensor哪个维度设置为输入batch_size的值,默认值为0。 -返回:具有特定形状和值的张量 +返回:创建的Tensor, 数据类型为dtype。 + +返回类型:(Variable) **代码示例**: .. code-block:: python import paddle.fluid as fluid - like = fluid.layers.data(name='like', shape=[1], dtype='float32') + like = fluid.layers.fill_constant(shape=[1,2], value=10, dtype='int64') #like=[[10, 10]] data = fluid.layers.fill_constant_batch_size_like( - input=like, shape=[1], value=0, dtype='int64') - - - - - - - - - - + input=like, shape=[1], value=0, dtype='int64') #like=[[10, 10]] data=[0] \ No newline at end of file -- GitLab