def METHOD_NAME(mask, target_sparsity):
    # tests that the number of masked values is exactly the number expected
    expected_num_masked = round(target_sparsity * mask.numel())
    assert torch.sum(1 - mask).item() == expected_num_masked