def draw(tensor_access_list, swap_schedule):
    df = []
    id_color = {'OTA': 'rgb(255, 0, 102)', 'ITA': 'rgb(68, 114, 196)', 'Swap In': 'rgb(237, 137, 69)', 'Swap Out': 'rgb(112, 173, 71)'}
    for tensor_access in tensor_access_list:
        df.append(dict(Task=f'tensor_id:{tensor_access.tensor.tensor_id}, size:{tensor_access.tensor.size}', Start=tensor_access.start_time, Finish=tensor_access.end_time, Resource=('OTA' if (tensor_access.access_type == AccessType.output) else 'ITA')))
    for task in swap_schedule:
        df.append(dict(Task=f'tensor_id:{task.tensor.tensor_id}, size:{task.tensor.size}', Start=task.start_time, Finish=task.end_time, Resource=('Swap In' if (task.task_type == TaskType.swap_in) else 'Swap Out')))
    fig = ff.create_gantt(df, colors=id_color, index_col='Resource', group_tasks=True, show_colorbar=True, showgrid_x=True, showgrid_y=True, title=f'ratio={ratio}')
    fig['layout']['xaxis'].update({'type': None})
    fig.update_layout(height=900, width=1600)
    pyplt(fig, filename=f'../../pic/job{tensor_access_list[0].tensor.job_id}.html', auto_open=True)
def draw(tensor_access_list, swap_schedule):
    df = []
    id_color = {'OTA': 'rgb(255, 0, 102)', 'ITA': 'rgb(68, 114, 196)', 'Swap In': 'rgb(237, 137, 69)', 'Swap Out': 'rgb(112, 173, 71)'}
    for tensor_access in tensor_access_list:
        df.append(dict(Task=f'tensor_id:{tensor_access.tensor.tensor_id}, size:{tensor_access.tensor.size}', Start=tensor_access.start_time, Finish=tensor_access.end_time, Resource=('OTA' if (tensor_access.access_type == AccessType.output) else 'ITA')))
    for task in swap_schedule:
        df.append(dict(Task=f'tensor_id:{task.tensor.tensor_id}, size:{task.tensor.size}', Start=task.start_time, Finish=task.end_time, Resource=('Swap In' if (task.task_type == TaskType.swap_in) else 'Swap Out')))
    fig = ff.create_gantt(df, colors=id_color, index_col='Resource', group_tasks=True, show_colorbar=True, showgrid_x=True, showgrid_y=True, title=f'ratio={ratio}')
    fig['layout']['xaxis'].update({'type': None})
    fig.update_layout(height=900, width=1600)
    pyplt(fig, filename=f'../../pic/job{tensor_access_list[0].tensor.job_id}.html', auto_open=True)