!48937 Provide len() method for the minddata dataset class interface

Merge pull request !48937 from 刘勇琪/master-decrypt-column
This commit is contained in:
i-robot 2023-02-25 13:25:03 +00:00 committed by Gitee
commit f27abc1e06
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 9 additions and 0 deletions

View File

@ -1853,6 +1853,15 @@ class Dataset:
def parse(self, children=None): def parse(self, children=None):
raise NotImplementedError("Dataset has to implement parse method.") 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 @staticmethod
def _update_data_shard(num_shards, shard_id): def _update_data_shard(num_shards, shard_id):
""" """