Adding doc for sums layer (#6857)

del_some_in_makelist
kavyasrinet 8 years ago committed by GitHub
parent 91911f4b56
commit a552385902
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,9 +56,28 @@ def concat(input, axis=0):
def sums(input, out=None): def sums(input, out=None):
""" """This function performs the sum operation on the input and returns the
This function takes in the input and performs the sum operation on it result as the output.
and returns that as the output.
Args:
input (Variable|list): The input tensor that has the elements
that need to be summed up.
Returns:
Variable: The tensor type variable that has the sum of input
written to it.
Examples:
.. code-block::python
tmp = fluid.layers.zeros(shape=[10], dtype='int32')
i = fluid.layers.fill_constant(shape=[1], dtype='int64', value=10)
a0 = layers.array_read(array=tmp, i=i)
i = layers.increment(x=i)
a1 = layers.array_read(array=tmp, i=i)
mean_a0 = layers.mean(x=a0)
mean_a1 = layers.mean(x=a1)
a_sum = layers.sums(input=[mean_a0, mean_a1])
""" """
helper = LayerHelper('sum', **locals()) helper = LayerHelper('sum', **locals())
if out is None: if out is None:
@ -99,9 +118,9 @@ def fill_constant(shape, dtype, value, out=None):
""" """
**fill_constant** **fill_constant**
This function creates a tensor of specified *shape* and This function creates a tensor of specified *shape* and
*dtype*, and initializes this with a constant supplied in *value*. *dtype*, and initializes this with a constant supplied in *value*.
It also sets *stop_gradient* to True. It also sets *stop_gradient* to True.
Args: Args:
@ -141,9 +160,9 @@ def fill_constant_batch_size_like(input,
""" """
**fill_constant_batch_size_like** **fill_constant_batch_size_like**
This function creates a tensor of specified *shape*, *dtype* and batch size, This function creates a tensor of specified *shape*, *dtype* and batch size,
and initializes this with a constant supplied in *value*. The batch size is and initializes this with a constant supplied in *value*. The batch size is
obtained from the `input` tensor. obtained from the `input` tensor.
It also sets *stop_gradient* to True. It also sets *stop_gradient* to True.

Loading…
Cancel
Save