diff --git a/python/paddle/fluid/layer_helper.py b/python/paddle/fluid/layer_helper.py index e0fd44ae31e3e66adfb8d5dd8a21051c48d24afa..ea9953f5814207c569e799c2ffa11758e31699aa 100644 --- a/python/paddle/fluid/layer_helper.py +++ b/python/paddle/fluid/layer_helper.py @@ -405,7 +405,8 @@ class LayerHelper(object): """ size = list(input_var.shape[dim_start:dim_end]) bias_attr = self.bias_attr - assert bias_attr is not None + if not bias_attr: + return input_var b = self.create_parameter( attr=bias_attr, shape=size, dtype=input_var.dtype, is_bias=True)