def liveness_analysis(tensor_access_list):
    global tensor_access_by_tensor
    for job_id in range(len(tensor_access_list)):
        tmp = set()
        for i in range((len(tensor_access_list[job_id]) - 1), (- 1), (- 1)):
            tensor_access = tensor_access_list[job_id][i]
            accesses_of_tensor = tensor_access_by_tensor[tensor_access.tensor.job_id][tensor_access.tensor]
            if ((tensor_access.tensor not in tmp) and (len(accesses_of_tensor) > 1) and (tensor_access == accesses_of_tensor[(- 1)])):
                if (not tensor_access.tensor.is_parameter):
                    tmp.add(tensor_access.tensor)
                    tensor_access.release_flag = True
def liveness_analysis(tensor_access_list):
    global tensor_access_by_tensor
    for job_id in range(len(tensor_access_list)):
        tmp = set()
        for i in range((len(tensor_access_list[job_id]) - 1), (- 1), (- 1)):
            tensor_access = tensor_access_list[job_id][i]
            accesses_of_tensor = tensor_access_by_tensor[tensor_access.tensor.job_id][tensor_access.tensor]
            if ((tensor_access.tensor not in tmp) and (len(accesses_of_tensor) > 1) and (tensor_access == accesses_of_tensor[(- 1)])):
                if (not tensor_access.tensor.is_parameter):
                    tmp.add(tensor_access.tensor)
                    tensor_access.release_flag = True