From dafc7e3643798a13e32f20ee6c6014cfa40bbe0c Mon Sep 17 00:00:00 2001 From: emailweixu Date: Tue, 13 Feb 2018 09:52:18 -0800 Subject: [PATCH] Check data format consistency in data_feeder (#8417) --- python/paddle/v2/fluid/data_feeder.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/paddle/v2/fluid/data_feeder.py b/python/paddle/v2/fluid/data_feeder.py index f9e2f3e6a2..070bcadd71 100644 --- a/python/paddle/v2/fluid/data_feeder.py +++ b/python/paddle/v2/fluid/data_feeder.py @@ -107,6 +107,9 @@ class DataFeeder(object): dtype=dtype)) for each_sample in iterable: + assert len(each_sample) == len(converter), ( + "The number of fields in data (%s) does not match " + + "len(feed_list) (%s)") % (len(each_sample), len(converter)) for each_converter, each_slot in six.zip(converter, each_sample): each_converter.feed(each_slot) ret_dict = {} -- GitLab