Browse Source

repair get_sampler_size problem

tags/v0.5.0-beta
ms_yan 5 years ago
parent
commit
de31113771
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      mindspore/dataset/engine/datasets.py

+ 4
- 1
mindspore/dataset/engine/datasets.py View File

@@ -1227,7 +1227,10 @@ class MappableDataset(SourceDataset):

def _get_sampler_dataset_size(self):
if self.sampler is not None:
return self.sampler.get_dataset_size()
if hasattr(self.sampler, 'get_dataset_size'):
return self.sampler.get_dataset_size()
if hasattr(self.sampler, '__len__'):
return len(self.sampler)

return None



Loading…
Cancel
Save