forked from mindspore-Ecosystem/mindspore
Provide len() method for the minddata dataset class interface
This commit is contained in:
parent
42fa3f67af
commit
cf083546aa
|
@ -1853,6 +1853,15 @@ class Dataset:
|
|||
def parse(self, children=None):
|
||||
raise NotImplementedError("Dataset has to implement parse method.")
|
||||
|
||||
def __len__(self):
|
||||
"""
|
||||
Get the length of dataset.
|
||||
|
||||
Returns:
|
||||
int, the length of dataset.
|
||||
"""
|
||||
return self.get_dataset_size()
|
||||
|
||||
@staticmethod
|
||||
def _update_data_shard(num_shards, shard_id):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue