From 0999347910609334e06caddc5a010ce1af568d5e Mon Sep 17 00:00:00 2001 From: guosheng Date: Fri, 9 Feb 2018 11:04:28 +0800 Subject: [PATCH] Fix python wrapper for layer_norm --- paddle/operators/layer_norm_op.cc | 2 -- python/paddle/v2/fluid/layers/nn.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/paddle/operators/layer_norm_op.cc b/paddle/operators/layer_norm_op.cc index 76d5d571c31..d9b774272cb 100644 --- a/paddle/operators/layer_norm_op.cc +++ b/paddle/operators/layer_norm_op.cc @@ -116,8 +116,6 @@ class LayerNormGradOp : public framework::OperatorWithKernel { // check input PADDLE_ENFORCE(ctx->HasInput("X"), "Input(X) of LayerNormOp should not be null."); - PADDLE_ENFORCE(ctx->HasInput("Scale"), - "Input(Scale) of LayerNormOp should not be null."); PADDLE_ENFORCE(ctx->HasInput("Mean"), "Input(Mean) of LayerNormOp should not be null."); PADDLE_ENFORCE(ctx->HasInput("Variance"), diff --git a/python/paddle/v2/fluid/layers/nn.py b/python/paddle/v2/fluid/layers/nn.py index e8455a8b41e..0b64e09cd35 100644 --- a/python/paddle/v2/fluid/layers/nn.py +++ b/python/paddle/v2/fluid/layers/nn.py @@ -1637,7 +1637,7 @@ def layer_norm(input, dtype=dtype, default_initializer=Constant(1.0)) inputs['Scale'] = scale - if center: + if shift: assert bias_attr is not False bias = helper.create_parameter( attr=helper.bias_attr, shape=param_shape, dtype=dtype, is_bias=True) -- GitLab