From dbb8d0788645066a0f06dacd72ba58b9817cdf4a Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Sat, 2 Mar 2019 22:39:02 +0800 Subject: [PATCH] fix doc statement. test=develop --- paddle/fluid/operators/spectral_norm_op.cc | 11 ++++++----- python/paddle/fluid/layers/nn.py | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/paddle/fluid/operators/spectral_norm_op.cc b/paddle/fluid/operators/spectral_norm_op.cc index d4ff660a96..b32a916658 100644 --- a/paddle/fluid/operators/spectral_norm_op.cc +++ b/paddle/fluid/operators/spectral_norm_op.cc @@ -101,9 +101,10 @@ class SpectralNormOpMaker : public framework::OpProtoAndCheckerMaker { "This tensor is in same shape with Input(Weight)."); AddAttr("dim", - "dimension corresponding to number of outputs, " - "it should be set as 0 if Input(Weight) is the " - "weight of fc layer, and should be set as 1 if " + "The index of dimention which should be permute " + "to the first before reshape Input(Weight) to " + "matrix, it should be set as 0 if Input(Weight) is " + "the weight of fc layer, and should be set as 1 if " "Input(Weight) is the weight of conv layer, " "default 0.") .SetDefault(0); @@ -112,12 +113,12 @@ class SpectralNormOpMaker : public framework::OpProtoAndCheckerMaker { "spectral norm, default 1.") .SetDefault(1); AddAttr("eps", - "epsilob for numerical stability in " + "epsilon for numerical stability in " "calculating norms") .SetDefault(1e-12); AddComment(R"DOC( - This layer calculates the spectral normalize value of weight of + This layer calculates the spectral normalization value of weight of fc, conv1d, conv2d, conv3d layers which should be 2-D, 3-D, 4-D, 5-D tensor. diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index a3d22499fe..f78ce432b0 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -3353,14 +3353,14 @@ def spectral_norm(weight, dim=0, power_iters=1, eps=1e-12, name=None): """ **Spectral Normalization Layer** - This layer calculate the spectral normalize value of weight parameters of + This layer calculates the spectral normalization value of weight parameters of fc, conv1d, conv2d, conv3d layers which should be 2-D, 3-D, 4-D, 5-D - Parameters. Calculations are showed as followings. + Parameters. Calculations are showed as follows. Step 1: Generate vector U in shape of [H], and V in shape of [W]. While H is the :attr:`dim` th dimension of the input weights, - and W is the product result of remain dimensions. + and W is the product result of remaining dimensions. Step 2: :attr:`power_iters` shoule be a positive interger, do following @@ -3373,7 +3373,7 @@ def spectral_norm(weight, dim=0, power_iters=1, eps=1e-12, name=None): \mathbf{u} := \\frac{\mathbf{W}^{T} \mathbf{v}}{\|\mathbf{W}^{T} \mathbf{v}\|_2} Step 3: - Calculate :math:`\sigma(\mathbf{W})` and scale weight values. + Calculate :math:`\sigma(\mathbf{W})` and normalize weight values. .. math:: @@ -3392,7 +3392,7 @@ def spectral_norm(weight, dim=0, power_iters=1, eps=1e-12, name=None): name (str): The name of this layer. It is optional. Returns: - Variable: A tensor variable of weight after spetral normalization. + Variable: A tensor variable of weight parameters after spectral normalization. Examples: -- GitLab