def METHOD_NAME(tensor_shapes, mask_creator, sparsity_val, device):
    tensors = [torch.randn(tensor_shape).to(device) for tensor_shape in tensor_shapes]
    update_masks = mask_creator.create_sparsity_masks(tensors, sparsity_val)
    if isinstance(sparsity_val, float):
        sparsity_val = [sparsity_val] * len(update_masks)
    for update_mask, target_sparsity in zip(update_masks, sparsity_val):
        assert abs(tensor_sparsity(update_mask) - target_sparsity) < 1e-2
        if not isinstance(mask_creator, GroupedPruningMaskCreator):
            _test_num_masked(update_mask, target_sparsity)
    if isinstance(mask_creator, GroupedPruningMaskCreator):
        grouped_masks_test(update_masks, mask_creator, sparsity_val)
    return update_masks