我該怎麼做?拆分生成器,獨立處理並再次壓縮
sample_generator = get_sample_generator() # This generator yields tuples (label(i), data(i))
label_generator = ???
data_generator = ???
processed_data_generator = process_data_generator(data_generator)
processed_sample_generator = zip(label_generator, processed_data_generator) # Labels and corresponding data again as tupel (label(i), processed_data(i))
很明顯,我不能只是映射()的sample_generator到標籤和數據生成因爲兩者會向前移動sample_generator ...
是太大了,從它創建一個列表? – njzk2
從這個意義上講,你不能分裂一臺發電機。要訪問你的兩個元素元組的每一個第二項,你需要使用'sample_generator' –
爲什麼你想這樣做? –