diff --git a/python/paddle/fluid/layer_helper_base.py b/python/paddle/fluid/layer_helper_base.py index e9738b6660eea..c2de5670eb42c 100644 --- a/python/paddle/fluid/layer_helper_base.py +++ b/python/paddle/fluid/layer_helper_base.py @@ -312,6 +312,10 @@ def create_parameter(self, if not attr: return None assert isinstance(attr, ParamAttr) + for i, size in enumerate(shape): + assert size > 0, ( + "Expected every dim's size to be larger than 0, " + "but the size of the {}-th dim is {}".format(i, size)) # set global dtype if not dtype: dtype = self.__dtype