From 302427170ff218c18f68c5268f3b4ad8afa9b44c Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Wed, 3 Feb 2021 20:12:15 +0800 Subject: [PATCH] remove numpy array check in single-process dataloader. test=develop (#30861) --- python/paddle/fluid/dataloader/dataloader_iter.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/python/paddle/fluid/dataloader/dataloader_iter.py b/python/paddle/fluid/dataloader/dataloader_iter.py index f55ea1d9637..9756936f579 100644 --- a/python/paddle/fluid/dataloader/dataloader_iter.py +++ b/python/paddle/fluid/dataloader/dataloader_iter.py @@ -320,7 +320,6 @@ class _DataLoaderIterSingleProcess(_DataLoaderIterBase): array = core.LoDTensorArray() for slot in batch: if not isinstance(slot, core.LoDTensor): - self._check_input_array(slot) # FIXME(dkp): blocking_queue only support # core.LoDTensorArray as input now, read # numpy data into a LoDTensorArray here, @@ -346,19 +345,6 @@ class _DataLoaderIterSingleProcess(_DataLoaderIterBase): logging.warning("DataLoader reader thread raised an exception.") six.reraise(*sys.exc_info()) - @classmethod - def _check_input_array(cls, item): - if isinstance(item, paddle.Tensor): - return - arr = np.array(item) - if arr.dtype == np.object: - raise TypeError(( - "\n\tFaild to convert input data to a regular ndarray :\n\t* Usually " - "this means the input data contains nested lists with different lengths. " - "\n\t* Check the reader function passed to 'decorate_batch_generator'" - " to locate the data causes this issue.\n\t* Please consider using " - "'fluid.create_lod_tensor' to convert it to a LoD-Tensor.")) - def __next__(self): try: if in_dygraph_mode(): -- GitLab