def _load_op_durations_from_file(input: Union[str, Path]) -> Dict[str, float]:
    """
    Loads benchmarking results produced with a profiler from a .json file.
    """

    if isinstance(input, str):
        input_path = Path(input)
    elif isinstance(input, Path):
        input_path = input
    else:
        raise ValueError("str or Path is needed as an input argument")

    # load the file with the profile.
    with input_path.open("r") as f:
        perf_per_op_str = f.read()

    # parse file
    perf_per_op_str_dict = json.loads(perf_per_op_str)

    op_durations: Dict[str, float] = {}
    for op_name, op_data in perf_per_op_str_dict.items():
        op_durations[op_name] = op_data["ms_per_iter"]

    # done
    return op_durations

    Loads benchmarking results produced with a profiler from a .json file.
    
python/aitemplate/utils/graph_utils.py