From d993a4f58b7e2be4a76fda406e964229edff2dcb Mon Sep 17 00:00:00 2001 From: yangyaming Date: Tue, 19 Dec 2017 11:19:24 +0800 Subject: [PATCH] Change default value for bias_attr. --- python/paddle/v2/fluid/layers/nn.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/paddle/v2/fluid/layers/nn.py b/python/paddle/v2/fluid/layers/nn.py index 9728adba735..31a0a312dbe 100644 --- a/python/paddle/v2/fluid/layers/nn.py +++ b/python/paddle/v2/fluid/layers/nn.py @@ -866,7 +866,7 @@ def lstm_unit(x_t, cell_t_prev, forget_bias=0.0, param_attr=None, - bias_attr=ParamAttr(), + bias_attr=None, main_program=None, startup_program=None): """Lstm unit layer. The equation of a lstm step is: @@ -909,8 +909,8 @@ def lstm_unit(x_t, forget_bias (float): The forget bias of lstm unit. param_attr (ParamAttr): The attributes of parameter weights, used to set initializer, name etc. - bias_attr (ParamAttr): The attributes of bias weights, used to set - initializer, name etc. + bias_attr (ParamAttr): The attributes of bias weights, if not False, + bias weights will be created and be set to default value. main_program (Program): The main program. startup_program (Program): the startup program. @@ -949,6 +949,9 @@ def lstm_unit(x_t, raise ValueError("The 1s dimension of x_t, hidden_t_prev and " "cell_t_prev must be the same.") + if bias_attr is None: + bias_attr = ParamAttr() + size = cell_t_prev.shape[1] concat_out = concat( input=[x_t, hidden_t_prev], -- GitLab