From 65d375a09fc78c1b5bef1accfd299977fe5a1958 Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Wed, 27 Feb 2019 19:59:11 +0800 Subject: [PATCH] fix format. test=develop --- paddle/fluid/operators/spectral_norm_op.cc | 4 ++-- paddle/fluid/operators/spectral_norm_op.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/spectral_norm_op.cc b/paddle/fluid/operators/spectral_norm_op.cc index 32b8a41ca8..087d97fde6 100644 --- a/paddle/fluid/operators/spectral_norm_op.cc +++ b/paddle/fluid/operators/spectral_norm_op.cc @@ -94,7 +94,7 @@ class SpectralNormOpMaker : public framework::OpProtoAndCheckerMaker { "W is the 2nd dimentions of Weight after reshape" "corresponding by Attr(dim). As for Attr(dim) = 1" "in conv2d layer with weight shape [M, C, K1, K2]" - "Weight will be reshape to [C, M*K1*Kw], V will" + "Weight will be reshape to [C, M*K1*K2], V will" "be in shape [M*K1*K2, 1]."); AddOutput("Out", "The output weight tensor of spectral_norm operator, " @@ -105,7 +105,7 @@ class SpectralNormOpMaker : public framework::OpProtoAndCheckerMaker { "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 is 0." + "default is 0.") .SetDefault(0); AddAttr("power_iters", "number of power iterations to calculate" diff --git a/paddle/fluid/operators/spectral_norm_op.h b/paddle/fluid/operators/spectral_norm_op.h index de6e894c1c..eb48e3b784 100644 --- a/paddle/fluid/operators/spectral_norm_op.h +++ b/paddle/fluid/operators/spectral_norm_op.h @@ -73,13 +73,13 @@ static inline void CalcMatrixSigmaAndNormWeight( const int w = weight->dims()[1]; for (int i = 0; i < power_iters; i++) { - // V = W^T * U / ||W^T * U||_2 + // V = W^T * U / ||W^T * U||_2 blas.MatMul(*weight, true, *u, false, T(1), v, T(0)); auto v_t_norm = v_t.square().sum().sqrt().eval().reshape(Array1(1)).broadcast( Array1(w)); v_t.device(place) = v_t / (v_t_norm + v_t_norm.constant(eps)); - // U = W^T * V / ||W^T * V||_2 + // U = W^T * V / ||W^T * V||_2 blas.MatMul(*weight, false, *v, false, T(1), u, T(0)); auto u_t_norm = u_t.square().sum().sqrt().eval().reshape(Array1(1)).broadcast( -- GitLab