def give_dataloaders(dataset, trainset, testset, opt, cluster_path=""):
    """
    Args:
        dataset: string, name of dataset for which the dataloaders should be returned.
        opt:     argparse.Namespace, contains all training-specific parameters.
    Returns:
        dataloaders: dict of dataloaders for training, testing and evaluation on training.
    """
    # Dataset selection
    if opt.dataset == "Inaturalist":
        if opt.finetune:
            datasets = give_inat_datasets_finetune_1head(
                testset, cluster_path, opt
            )
        else:
            if opt.get_features:
                datasets = give_inaturalist_datasets_for_features(opt)
            else:
                datasets = give_inaturalist_datasets(opt)
    else:
        raise Exception("No Dataset >{}< available!".format(dataset))

    # Move datasets to dataloaders.
    dataloaders = {}

    for key, dataset in datasets.items():
        if (
            isinstance(dataset, TrainDatasetsmoothap)
            or isinstance(dataset, TrainDatasetsmoothap1Head)
        ) and key in ["training", "clustering"]:
            dataloaders[key] = torch.utils.data.DataLoader(
                dataset,
                batch_size=opt.bs,
                num_workers=opt.kernels,
                sampler=torch.utils.data.SequentialSampler(dataset),
                pin_memory=True,
                drop_last=True,
            )
        else:
            is_val = dataset.is_validation
            if key == "training" or key == "clustering":
                dataloaders[key] = torch.utils.data.DataLoader(
                    dataset,
                    batch_size=opt.bs,
                    num_workers=opt.kernels,
                    shuffle=not is_val,
                    pin_memory=True,
                    drop_last=not is_val,
                )
            else:
                dataloaders[key] = torch.utils.data.DataLoader(
                    dataset,
                    batch_size=opt.bs,
                    num_workers=6,
                    shuffle=not is_val,
                    pin_memory=True,
                    drop_last=not is_val,
                )
    return dataloaders

    Args:
        dataset: string, name of dataset for which the dataloaders should be returned.
        opt:     argparse.Namespace, contains all training-specific parameters.
    Returns:
        dataloaders: dict of dataloaders for training, testing and evaluation on training.
    
examples/pytorch/hilander/PSS/Smooth_AP/src/datasets.py