batch = np.array([1,1,1,1,1])
batch = tuple(t for t in batch)#转换为元组形式
# print(batch)
inputs = {'slot_labels_ids': batch}
out_slot_labels_ids = np.array([2,2,2,2,2])
for i in range(5):
out_slot_labels_ids = np.append(out_slot_labels_ids, inputs["slot_labels_ids"], axis=0)
out_slot_label_list = [[] for _ in range(out_slot_labels_ids.shape[0])]
a = out_slot_labels_ids.shape[0]
print(a)
print(out_slot_label_list)
输出:
30
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]