def initialize_heap(offsets, weights):
all_heaps = []
[n, k] = offsets.shape
for i in range(0,n):
h = []
for j in range(0, k):
heapq.heappush(h, (weights[i, j], offsets[i, j]))
all_heaps.append(h)
return all_heaps
评论列表
文章目录