import torch


def augment(image, ref, augmenters):
    """Apply augmentation (only if reference is given, i.e., not at test-time).
    """
    with torch.no_grad():        
        if ref is not None:
            for augmenter in augmenters:
                image, ref = augmenter(image, ref)
                
    return image, ref