def forgetting_to_bwt(f: Optional[Union[float, Dict[int, float]]]):
    """
    Convert forgetting to backward transfer.
    BWT = -1 * forgetting
    """
    if f is None:
        return f
    if isinstance(f, dict):
        return {k: -1 * v for k, v in f.items()}
    elif isinstance(f, float):
        return -1 * f
    else:
        raise ValueError(
            "Forgetting data type not recognized when converting"
            "to backward transfer."
        )

    Convert forgetting to backward transfer.
    BWT = -1 * forgetting
    
avalanche/evaluation/metrics/forgetting_bwt.py