def to_cpu(output): buf_id = buf_queue.get() output_cpu = buffer_pool[buf_id] output_cpu.copy_(output, non_blocking=True) return output_cpu, buf_id