From b052149dcfc1113d73a9b66cf819b5151750aa9c Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Thu, 26 Nov 2020 14:00:29 +0800 Subject: [PATCH] remove BatchSampler type check (#29114) * remove BatchSampler type check. test=develop --- python/paddle/fluid/reader.py | 3 --- .../unittests/test_multiprocess_dataloader_exception.py | 8 -------- 2 files changed, 11 deletions(-) diff --git a/python/paddle/fluid/reader.py b/python/paddle/fluid/reader.py index 1cb76b1f390..84ccba98e60 100644 --- a/python/paddle/fluid/reader.py +++ b/python/paddle/fluid/reader.py @@ -366,9 +366,6 @@ class DataLoader(object): self.dataset_kind = _DatasetKind.MAP if batch_sampler is not None: - assert isinstance(batch_sampler, BatchSampler), \ - "batch_sampler should be None or subclass instance " \ - "of paddle.io.BatchSampler" assert batch_size == 1 and not shuffle and not drop_last, \ "batch_size/shuffle/drop_last should not be set when " \ "batch_sampler is given" diff --git a/python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_exception.py b/python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_exception.py index 74fe359cd7d..1bda6edfecf 100644 --- a/python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_exception.py +++ b/python/paddle/fluid/tests/unittests/test_multiprocess_dataloader_exception.py @@ -80,14 +80,6 @@ class TestDataLoaderAssert(unittest.TestCase): except AssertionError: pass - # batch_sampler is not instance of BatchSampler - try: - loader = DataLoader( - dataset=dataset, places=place, batch_sampler=dataset) - self.assertTrue(False) - except AssertionError: - pass - # set batch_sampler and shuffle/batch_size/drop_last try: loader = DataLoader( -- GitLab