From 8b88960dcec6076a205c07ebbbd69e5f90e78bdb Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Sat, 9 Mar 2019 17:24:45 +0800 Subject: [PATCH] fix doc. test=develop --- paddle/fluid/operators/softmax_op.cc | 8 ++++---- python/paddle/fluid/layers/nn.py | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/operators/softmax_op.cc b/paddle/fluid/operators/softmax_op.cc index f04c5db9e11..3592f20dbf9 100644 --- a/paddle/fluid/operators/softmax_op.cc +++ b/paddle/fluid/operators/softmax_op.cc @@ -86,7 +86,7 @@ class SoftmaxOpMaker : public framework::OpProtoAndCheckerMaker { void Make() override { AddInput("X", "The input tensor of softmax, " - "whose :attr:`axis` dimension is the input_feature_dimensions."); + "whose dimension :attr:`axis` is the input_feature_dimensions."); AddOutput("Out", "The normalized values with the same shape as X."); AddAttr("axis", "The dimension index of Input(x) to perform softmax," @@ -116,13 +116,13 @@ Softmax Operator. The input of the softmax operator is a tensor of any rank. The output tensor has the same shape as the input. -The :attr:`axis` th dimension of the input tensor will be permuted to the last. +The dimension :attr:`axis` of the input tensor will be permuted to the last. Then the input tensor will be logically flattened to a 2-D matrix. The matrix's -second dimension(row length) is as same as the :attr:`axis` dimension of the input +second dimension(row length) is as same as the dimension :attr:`axis` of the input tensor, and the first dimension(column length) is the product of all other dimensions of the input tensor. For each row of the matrix, the softmax operator squashes the K-dimensional(K is the width of the matrix, which is also the size -of the input tensor's :attr:`axis` dimension) vector of arbitrary real values to a +of the input tensor's dimension :attr:`axis`) vector of arbitrary real values to a K-dimensional vector of real values in the range [0, 1] that add up to 1. It computes the exponential of the given dimension and the sum of exponential values of all the other dimensions in the K-dimensional vector input. diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 276344df58e..19c9734a9e0 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -1824,13 +1824,13 @@ def softmax(input, use_cudnn=False, name=None, axis=-1): The input of the softmax operator is a tensor of any rank. The output tensor has the same shape as the input. - The :attr:`axis` th dimension of the input tensor will be permuted to the last. + The dimension :attr:`axis` of the input tensor will be permuted to the last. Then the input tensor will be logically flattened to a 2-D matrix. The matrix's - second dimension(row length) is as same as the :attr:`axis` th dimension of the input + second dimension(row length) is as same as the dimension :attr:`axis` of the input tensor, and the first dimension(column length) is the product of all other dimensions of the input tensor. For each row of the matrix, the softmax operator squashes the K-dimensional(K is the width of the matrix, which is also the size - of the input tensor's :attr:`axis` th dimension) vector of arbitrary real values to a + of the input tensor's dimension :attr:`axis`) vector of arbitrary real values to a K-dimensional vector of real values in the range [0, 1] that add up to 1. It computes the exponential of the given dimension and the sum of exponential @@ -1852,7 +1852,9 @@ def softmax(input, use_cudnn=False, name=None, axis=-1): False by default. Default: False name (str|None): A name for this layer(optional). If set None, the layer will be named automatically. Default: None. - axis (int): The index of dimension to perform softmax calculation. Default: -1. + axis (int): The index of dimension to perform softmax calculations, it should + be in range :math:`[-1, rank - 1]`, while :math:`rank` is the rank of + input variable. Default: -1. Returns: Variable: output of softmax -- GitLab