未验证 提交 b052149d 编写于 作者: K Kaipeng Deng 提交者: GitHub

remove BatchSampler type check (#29114)

* remove BatchSampler type check. test=develop
上级 63e90ee3
...@@ -366,9 +366,6 @@ class DataLoader(object): ...@@ -366,9 +366,6 @@ class DataLoader(object):
self.dataset_kind = _DatasetKind.MAP self.dataset_kind = _DatasetKind.MAP
if batch_sampler is not None: 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, \ assert batch_size == 1 and not shuffle and not drop_last, \
"batch_size/shuffle/drop_last should not be set when " \ "batch_size/shuffle/drop_last should not be set when " \
"batch_sampler is given" "batch_sampler is given"
......
...@@ -80,14 +80,6 @@ class TestDataLoaderAssert(unittest.TestCase): ...@@ -80,14 +80,6 @@ class TestDataLoaderAssert(unittest.TestCase):
except AssertionError: except AssertionError:
pass 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 # set batch_sampler and shuffle/batch_size/drop_last
try: try:
loader = DataLoader( loader = DataLoader(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册