test_split.py 20.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
import pytest
import mindspore.dataset as ds
17 18
from util import config_get_set_num_parallel_workers

19 20 21 22 23 24 25

# test5trainimgs.json contains 5 images whose un-decoded shape is [83554, 54214, 65512, 54214, 64631]
# the label of each image is [0,0,0,1,1] each image can be uniquely identified
# via the following lookup table (dict){(83554, 0): 0, (54214, 0): 1, (54214, 1): 2, (65512, 0): 3, (64631, 1): 4}
manifest_file = "../data/dataset/testManifestData/test5trainimgs.json"
manifest_map = {(172876, 0): 0, (54214, 0): 1, (54214, 1): 2, (173673, 0): 3, (64631, 1): 4}

26 27 28 29 30
text_file_dataset_path = "../data/dataset/testTextFileDataset/*"
text_file_data = ["This is a text file.", "Another file.", "Be happy every day.",
                  "End of file.", "Good luck to everyone."]

def split_with_invalid_inputs(d):
31
    with pytest.raises(ValueError) as info:
Y
Yang 已提交
32
        _, _ = d.split([])
33 34 35
    assert "sizes cannot be empty" in str(info.value)

    with pytest.raises(ValueError) as info:
Y
Yang 已提交
36
        _, _ = d.split([5, 0.6])
37 38 39
    assert "sizes should be list of int or list of float" in str(info.value)

    with pytest.raises(ValueError) as info:
Y
Yang 已提交
40
        _, _ = d.split([-1, 6])
L
liyong 已提交
41
    assert "there should be no negative or zero numbers" in str(info.value)
42 43

    with pytest.raises(RuntimeError) as info:
Y
Yang 已提交
44
        _, _ = d.split([3, 1])
45
    assert "Sum of split sizes 4 is not equal to dataset size 5" in str(info.value)
46 47

    with pytest.raises(RuntimeError) as info:
Y
Yang 已提交
48
        _, _ = d.split([5, 1])
49
    assert "Sum of split sizes 6 is not equal to dataset size 5" in str(info.value)
50 51

    with pytest.raises(RuntimeError) as info:
Y
Yang 已提交
52
        _, _ = d.split([0.15, 0.15, 0.15, 0.15, 0.15, 0.25])
53
    assert "Sum of calculated split sizes 6 is not equal to dataset size 5" in str(info.value)
54 55

    with pytest.raises(ValueError) as info:
Y
Yang 已提交
56
        _, _ = d.split([-0.5, 0.5])
L
liyong 已提交
57
    assert "there should be no numbers outside the range (0, 1]" in str(info.value)
58 59

    with pytest.raises(ValueError) as info:
Y
Yang 已提交
60
        _, _ = d.split([1.5, 0.5])
L
liyong 已提交
61
    assert "there should be no numbers outside the range (0, 1]" in str(info.value)
62 63

    with pytest.raises(ValueError) as info:
Y
Yang 已提交
64
        _, _ = d.split([0.5, 0.6])
65 66 67
    assert "percentages do not sum up to 1" in str(info.value)

    with pytest.raises(ValueError) as info:
Y
Yang 已提交
68
        _, _ = d.split([0.3, 0.6])
69 70 71
    assert "percentages do not sum up to 1" in str(info.value)

    with pytest.raises(RuntimeError) as info:
Y
Yang 已提交
72
        _, _ = d.split([0.05, 0.95])
73 74
    assert "percentage 0.05 is too small" in str(info.value)

75

76 77 78 79 80 81
def test_unmappable_invalid_input():
    d = ds.TextFileDataset(text_file_dataset_path)
    split_with_invalid_inputs(d)

    d = ds.TextFileDataset(text_file_dataset_path, num_shards=2, shard_id=0)
    with pytest.raises(RuntimeError) as info:
Y
Yang 已提交
82
        _, _ = d.split([4, 1])
83
    assert "Dataset should not be sharded before split" in str(info.value)
84

85

86
def test_unmappable_split():
87
    original_num_parallel_workers = config_get_set_num_parallel_workers(4)
88

89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
    d = ds.TextFileDataset(text_file_dataset_path, shuffle=False)
    s1, s2 = d.split([4, 1], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(item["text"].item().decode("utf8"))

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(item["text"].item().decode("utf8"))

    assert s1_output == text_file_data[0:4]
    assert s2_output == text_file_data[4:]

    # exact percentages
    s1, s2 = d.split([0.8, 0.2], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(item["text"].item().decode("utf8"))

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(item["text"].item().decode("utf8"))

    assert s1_output == text_file_data[0:4]
    assert s2_output == text_file_data[4:]

    # fuzzy percentages
    s1, s2 = d.split([0.33, 0.67], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(item["text"].item().decode("utf8"))

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(item["text"].item().decode("utf8"))

    assert s1_output == text_file_data[0:2]
    assert s2_output == text_file_data[2:]
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265

    # Restore configuration num_parallel_workers
    ds.config.set_num_parallel_workers(original_num_parallel_workers)


def test_unmappable_randomize_deterministic():
    original_num_parallel_workers = config_get_set_num_parallel_workers(4)

    # the labels outputted by ShuffleOp for seed 53 is [0, 2, 1, 4, 3]
    ds.config.set_seed(53)

    d = ds.TextFileDataset(text_file_dataset_path, shuffle=False)
    s1, s2 = d.split([0.8, 0.2])

    for _ in range(10):
        s1_output = []
        for item in s1.create_dict_iterator():
            s1_output.append(item["text"].item().decode("utf8"))

        s2_output = []
        for item in s2.create_dict_iterator():
            s2_output.append(item["text"].item().decode("utf8"))

        # note no overlap
        assert s1_output == [text_file_data[0], text_file_data[2], text_file_data[1], text_file_data[4]]
        assert s2_output == [text_file_data[3]]

    # Restore configuration num_parallel_workers
    ds.config.set_num_parallel_workers(original_num_parallel_workers)


def test_unmappable_randomize_repeatable():
    original_num_parallel_workers = config_get_set_num_parallel_workers(4)

    # the labels outputted by ShuffleOp for seed 53 is [0, 2, 1, 4, 3]
    ds.config.set_seed(53)

    d = ds.TextFileDataset(text_file_dataset_path, shuffle=False)
    s1, s2 = d.split([0.8, 0.2])

    num_epochs = 5
    s1 = s1.repeat(num_epochs)
    s2 = s2.repeat(num_epochs)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(item["text"].item().decode("utf8"))

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(item["text"].item().decode("utf8"))

    # note no overlap
    assert s1_output == [text_file_data[0], text_file_data[2], text_file_data[1], text_file_data[4]] * num_epochs
    assert s2_output == [text_file_data[3]] * num_epochs

    # Restore configuration num_parallel_workers
    ds.config.set_num_parallel_workers(original_num_parallel_workers)


def test_unmappable_get_dataset_size():
    d = ds.TextFileDataset(text_file_dataset_path, shuffle=False)
    s1, s2 = d.split([0.8, 0.2])

    assert d.get_dataset_size() == 5
    assert s1.get_dataset_size() == 4
    assert s2.get_dataset_size() == 1


def test_unmappable_multi_split():
    original_num_parallel_workers = config_get_set_num_parallel_workers(4)

    # the labels outputted by ShuffleOp for seed 53 is [0, 2, 1, 4, 3]
    ds.config.set_seed(53)

    d = ds.TextFileDataset(text_file_dataset_path, shuffle=False)
    s1, s2 = d.split([4, 1])

    s1_correct_output = [text_file_data[0], text_file_data[2], text_file_data[1], text_file_data[4]]

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(item["text"].item().decode("utf8"))
    assert s1_output == s1_correct_output

    # no randomize in second split
    s1s1, s1s2, s1s3 = s1.split([1, 2, 1], randomize=False)

    s1s1_output = []
    for item in s1s1.create_dict_iterator():
        s1s1_output.append(item["text"].item().decode("utf8"))

    s1s2_output = []
    for item in s1s2.create_dict_iterator():
        s1s2_output.append(item["text"].item().decode("utf8"))

    s1s3_output = []
    for item in s1s3.create_dict_iterator():
        s1s3_output.append(item["text"].item().decode("utf8"))

    assert s1s1_output == [s1_correct_output[0]]
    assert s1s2_output == [s1_correct_output[1], s1_correct_output[2]]
    assert s1s3_output == [s1_correct_output[3]]

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(item["text"].item().decode("utf8"))
    assert s2_output == [text_file_data[3]]

    # randomize in second split
    # the labels outputted by the ShuffleOp for seed 53 is [2, 3, 1, 0]
    shuffled_ids = [2, 3, 1, 0]

    s1s1, s1s2, s1s3 = s1.split([1, 2, 1])

    s1s1_output = []
    for item in s1s1.create_dict_iterator():
        s1s1_output.append(item["text"].item().decode("utf8"))

    s1s2_output = []
    for item in s1s2.create_dict_iterator():
        s1s2_output.append(item["text"].item().decode("utf8"))

    s1s3_output = []
    for item in s1s3.create_dict_iterator():
        s1s3_output.append(item["text"].item().decode("utf8"))

    assert s1s1_output == [s1_correct_output[shuffled_ids[0]]]
    assert s1s2_output == [s1_correct_output[shuffled_ids[1]], s1_correct_output[shuffled_ids[2]]]
    assert s1s3_output == [s1_correct_output[shuffled_ids[3]]]

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(item["text"].item().decode("utf8"))
    assert s2_output == [text_file_data[3]]

266 267 268
    # Restore configuration num_parallel_workers
    ds.config.set_num_parallel_workers(original_num_parallel_workers)

269 270 271 272 273 274 275

def test_mappable_invalid_input():
    d = ds.ManifestDataset(manifest_file)
    split_with_invalid_inputs(d)

    d = ds.ManifestDataset(manifest_file, num_shards=2, shard_id=0)
    with pytest.raises(RuntimeError) as info:
Y
Yang 已提交
276
        _, _ = d.split([4, 1])
277
    assert "Dataset should not be sharded before split" in str(info.value)
278

279

280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
def test_mappable_split_general():
    d = ds.ManifestDataset(manifest_file, shuffle=False)
    d = d.take(5)

    # absolute rows
    s1, s2 = d.split([4, 1], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1, 2, 3]
    assert s2_output == [4]

    # exact percentages
    s1, s2 = d.split([0.8, 0.2], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1, 2, 3]
    assert s2_output == [4]

    # fuzzy percentages
    s1, s2 = d.split([0.33, 0.67], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1]
    assert s2_output == [2, 3, 4]

326

327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
def test_mappable_split_optimized():
    d = ds.ManifestDataset(manifest_file, shuffle=False)

    # absolute rows
    s1, s2 = d.split([4, 1], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1, 2, 3]
    assert s2_output == [4]

    # exact percentages
    s1, s2 = d.split([0.8, 0.2], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1, 2, 3]
    assert s2_output == [4]

    # fuzzy percentages
    s1, s2 = d.split([0.33, 0.67], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1]
    assert s2_output == [2, 3, 4]

372

373
def test_mappable_randomize_deterministic():
374
    # the labels outputted by ManifestDataset for seed 53 is [0, 1, 3, 4, 2]
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
    ds.config.set_seed(53)

    d = ds.ManifestDataset(manifest_file, shuffle=False)
    s1, s2 = d.split([0.8, 0.2])

    for _ in range(10):
        s1_output = []
        for item in s1.create_dict_iterator():
            s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

        s2_output = []
        for item in s2.create_dict_iterator():
            s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

        # note no overlap
        assert s1_output == [0, 1, 3, 4]
        assert s2_output == [2]

393

394
def test_mappable_randomize_repeatable():
395
    # the labels outputted by ManifestDataset for seed 53 is [0, 1, 3, 4, 2]
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
    ds.config.set_seed(53)

    d = ds.ManifestDataset(manifest_file, shuffle=False)
    s1, s2 = d.split([0.8, 0.2])

    num_epochs = 5
    s1 = s1.repeat(num_epochs)
    s2 = s2.repeat(num_epochs)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    # note no overlap
    assert s1_output == [0, 1, 3, 4] * num_epochs
    assert s2_output == [2] * num_epochs

417

418 419
def test_mappable_sharding():
    # set arbitrary seed for repeatability for shard after split
420
    # the labels outputted by ManifestDataset for seed 53 is [0, 1, 3, 4, 2]
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
    ds.config.set_seed(53)

    num_epochs = 5
    first_split_num_rows = 4

    d = ds.ManifestDataset(manifest_file, shuffle=False)
    s1, s2 = d.split([first_split_num_rows, 1])

    distributed_sampler = ds.DistributedSampler(2, 0)
    s1.use_sampler(distributed_sampler)

    s1 = s1.repeat(num_epochs)

    # testing sharding, second dataset to simulate another instance
    d2 = ds.ManifestDataset(manifest_file, shuffle=False)
    d2s1, d2s2 = d2.split([first_split_num_rows, 1])

    distributed_sampler = ds.DistributedSampler(2, 1)
    d2s1.use_sampler(distributed_sampler)

    d2s1 = d2s1.repeat(num_epochs)

    # shard 0
    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    # shard 1
    d2s1_output = []
    for item in d2s1.create_dict_iterator():
        d2s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    rows_per_shard_per_epoch = 2
    assert len(s1_output) == rows_per_shard_per_epoch * num_epochs
    assert len(d2s1_output) == rows_per_shard_per_epoch * num_epochs

    # verify each epoch that
    #   1. shards contain no common elements
    #   2. the data was split the same way, and that the union of shards equal the split
    correct_sorted_split_result = [0, 1, 3, 4]
    for i in range(num_epochs):
        combined_data = []
        for j in range(rows_per_shard_per_epoch):
            combined_data.append(s1_output[i * rows_per_shard_per_epoch + j])
            combined_data.append(d2s1_output[i * rows_per_shard_per_epoch + j])

        assert sorted(combined_data) == correct_sorted_split_result

    # test other split
    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    d2s2_output = []
    for item in d2s2.create_dict_iterator():
        d2s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s2_output == [2]
    assert d2s2_output == [2]

481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556

def test_mappable_get_dataset_size():
    d = ds.ManifestDataset(manifest_file, shuffle=False)
    s1, s2 = d.split([4, 1])

    assert d.get_dataset_size() == 5
    assert s1.get_dataset_size() == 4
    assert s2.get_dataset_size() == 1


def test_mappable_multi_split():
    # the labels outputted by ManifestDataset for seed 53 is [0, 1, 3, 4, 2]
    ds.config.set_seed(53)

    d = ds.ManifestDataset(manifest_file, shuffle=False)
    s1, s2 = d.split([4, 1])

    s1_correct_output = [0, 1, 3, 4]

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])
    assert s1_output == s1_correct_output

    # no randomize in second split
    s1s1, s1s2, s1s3 = s1.split([1, 2, 1], randomize=False)

    s1s1_output = []
    for item in s1s1.create_dict_iterator():
        s1s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s1s2_output = []
    for item in s1s2.create_dict_iterator():
        s1s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s1s3_output = []
    for item in s1s3.create_dict_iterator():
        s1s3_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1s1_output == [s1_correct_output[0]]
    assert s1s2_output == [s1_correct_output[1], s1_correct_output[2]]
    assert s1s3_output == [s1_correct_output[3]]

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])
    assert s2_output == [2]

    # randomize in second split
    # the labels outputted by the RandomSampler for seed 53 is [3, 1, 2, 0]
    random_sampler_ids = [3, 1, 2, 0]

    s1s1, s1s2, s1s3 = s1.split([1, 2, 1])

    s1s1_output = []
    for item in s1s1.create_dict_iterator():
        s1s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s1s2_output = []
    for item in s1s2.create_dict_iterator():
        s1s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s1s3_output = []
    for item in s1s3.create_dict_iterator():
        s1s3_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1s1_output == [s1_correct_output[random_sampler_ids[0]]]
    assert s1s2_output == [s1_correct_output[random_sampler_ids[1]], s1_correct_output[random_sampler_ids[2]]]
    assert s1s3_output == [s1_correct_output[random_sampler_ids[3]]]

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])
    assert s2_output == [2]


557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593
def test_rounding():
    d = ds.ManifestDataset(manifest_file, shuffle=False)

    # under rounding
    s1, s2 = d.split([0.5, 0.5], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0, 1, 2]
    assert s2_output == [3, 4]

    # over rounding
    s1, s2, s3 = d.split([0.15, 0.55, 0.3], randomize=False)

    s1_output = []
    for item in s1.create_dict_iterator():
        s1_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s2_output = []
    for item in s2.create_dict_iterator():
        s2_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    s3_output = []
    for item in s3.create_dict_iterator():
        s3_output.append(manifest_map[(item["image"].shape[0], item["label"].item())])

    assert s1_output == [0]
    assert s2_output == [1, 2]
    assert s3_output == [3, 4]


594 595 596
if __name__ == '__main__':
    test_unmappable_invalid_input()
    test_unmappable_split()
597 598 599 600
    test_unmappable_randomize_deterministic()
    test_unmappable_randomize_repeatable()
    test_unmappable_get_dataset_size()
    test_unmappable_multi_split()
601 602 603 604 605 606
    test_mappable_invalid_input()
    test_mappable_split_general()
    test_mappable_split_optimized()
    test_mappable_randomize_deterministic()
    test_mappable_randomize_repeatable()
    test_mappable_sharding()
607 608
    test_mappable_get_dataset_size()
    test_mappable_multi_split()
609
    test_rounding()