mindspore.dataset.Dataset.take
- Dataset.take(count=- 1)[source]
Takes at most given numbers of elements from the dataset.
Note
If count is greater than the number of elements in the dataset or equal to -1, all the elements in dataset will be taken.
The order of using take and batch matters. If take is before batch operation, then take the given number of rows; otherwise take the given number of batches.
- Parameters
count (int, optional) – Number of elements to be taken from the dataset. Default: -1.
- Returns
Dataset, dataset taken.
Examples
>>> # dataset is an instance object of Dataset >>> # Create a dataset where the dataset includes 50 elements. >>> dataset = dataset.take(50)