From ee46366b48c9dbe98ed8757e325153028eaa824e Mon Sep 17 00:00:00 2001 From: barrierye Date: Wed, 1 Jul 2020 11:10:25 +0800 Subject: [PATCH] support batch for DICT data type --- python/pipeline/channel.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/pipeline/channel.py b/python/pipeline/channel.py index a9540e1a..953f378a 100644 --- a/python/pipeline/channel.py +++ b/python/pipeline/channel.py @@ -92,7 +92,16 @@ class ChannelData(object): def check_dictdata(dictdata): ecode = ChannelDataEcode.OK.value error_info = None - if not isinstance(dictdata, dict): + if isinstance(dictdata, list): + # batch data + for sample in dictdata: + if not isinstance(sample, dict): + ecode = ChannelDataEcode.TYPE_ERROR.value + error_info = "the value of data must " \ + "be dict, but get {}.".format(type(sample)) + break + elif not isinstance(dictdata, dict): + # batch size = 1 ecode = ChannelDataEcode.TYPE_ERROR.value error_info = "the value of data must " \ "be dict, but get {}.".format(type(dictdata)) -- GitLab