def can_next_input_access_swap_in(i, all_access_of_tensor, swap_out_task, swap_scheduler):
    access = all_access_of_tensor[i]
    swap_in_task = SwapTask(access.tensor, access.time, access.tensor.swap_time, TaskType.swap_in, front_boundary=(swap_out_task.end_time if (swap_out_task.end_time > all_access_of_tensor[(i - 1)].end_time) else all_access_of_tensor[(i - 1)].end_time), back_boundary=access.time)
    return try_swap_in(swap_in_task, swap_scheduler, tensor_access_by_tensor[swap_in_task.tensor.job_id][swap_in_task.tensor])
def can_next_input_access_swap_in(i, all_access_of_tensor, swap_out_task, swap_scheduler):
    access = all_access_of_tensor[i]
    swap_in_task = SwapTask(access.tensor, access.time, access.tensor.swap_time, TaskType.swap_in, front_boundary=(swap_out_task.end_time if (swap_out_task.end_time > all_access_of_tensor[(i - 1)].end_time) else all_access_of_tensor[(i - 1)].end_time), back_boundary=access.time)
    return try_swap_in(swap_in_task, swap_scheduler, tensor_access_by_tensor[swap_in_task.tensor.job_id][swap_in_task.tensor])