From a3f75315009a4814549cf262996a85be2a9951be Mon Sep 17 00:00:00 2001 From: ms_yan <6576637+ms_yan@user.noreply.gitee.com> Date: Mon, 1 Jun 2020 16:37:28 +0800 Subject: [PATCH] repair format and type problem in split --- mindspore/dataset/engine/datasets.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/mindspore/dataset/engine/datasets.py b/mindspore/dataset/engine/datasets.py index 04d6a6e11d..8d05aebbd1 100644 --- a/mindspore/dataset/engine/datasets.py +++ b/mindspore/dataset/engine/datasets.py @@ -613,7 +613,7 @@ class Dataset: # if we still need more rows, give them to the first split. # if we have too many rows, remove the extras from the first split that has # enough rows. - size_difference = dataset_size - absolute_sizes_sum + size_difference = int(dataset_size - absolute_sizes_sum) if size_difference > 0: absolute_sizes[0] += size_difference else: @@ -647,10 +647,14 @@ class Dataset: Datasets of size round(f1*K), round(f2*K), …, round(fn*K) where K is the size of the original dataset. If after rounding: - -Any size equals 0, an error will occur. - -The sum of split sizes < K, the difference will be added to the first split. - -The sum of split sizes > K, the difference will be removed from the first large - enough split such that it will have atleast 1 row after removing the difference. + + - Any size equals 0, an error will occur. + + - The sum of split sizes < K, the difference will be added to the first split. + + - The sum of split sizes > K, the difference will be removed from the first large + enough split such that it will have atleast 1 row after removing the difference. + randomize (bool, optional): determines whether or not to split the data randomly (default=True). If true, the data will be randomly split. Otherwise, each split will be created with consecutive rows from the dataset. @@ -1282,10 +1286,14 @@ class MappableDataset(SourceDataset): Datasets of size round(f1*K), round(f2*K), …, round(fn*K) where K is the size of the original dataset. If after rounding: - -Any size equals 0, an error will occur. - -The sum of split sizes < K, the difference will be added to the first split. - -The sum of split sizes > K, the difference will be removed from the first large - enough split such that it will have atleast 1 row after removing the difference. + + - Any size equals 0, an error will occur. + + - The sum of split sizes < K, the difference will be added to the first split. + + - The sum of split sizes > K, the difference will be removed from the first large + enough split such that it will have atleast 1 row after removing the difference. + randomize (bool, optional): determines whether or not to split the data randomly (default=True). If true, the data will be randomly split. Otherwise, each split will be created with consecutive rows from the dataset.