這確實是更多的美學,但它一直在嘮叨我。我似乎無法理解我的 jupyter notebook 中的這部分輸出來自哪里(圖中用紅色箭頭標記)它幾乎像口吃一樣出現在每個紀元之前。任何提示或解決方案將不勝感激。這是我的代碼的摘錄。for epoch in range(epochs): start_time = time.time() epochs_left = epochs - epoch print('training model over %d epochs... There are %d epochs left...' % (epochs,epochs_left)) learning_rate = learning_rate_final + (learning_rate_... train_loss, train_acc = 0, 0 for image_path, label in tqdm(train_list, 'training for epoch %d' % epoch): loss_, acc = train(sess, image_path, label, learning_rate) train_loss += loss_ train_acc += acc train_loss, train_acc = train_loss / ...謝謝。
1 回答

婷婷同學_
TA貢獻1844條經驗 獲得超8個贊
正如我在評論中所寫,您可以刷新緩沖區,以便在打印進度條之前打印消息。
print('training model over %d epochs... There are %d epochs left...' % (epochs,epochs_left), flush=True)
您還可以使用 f-strings 縮短此行。
print(f"training model over {epochs} epochs... There are {epochs_left} epochs left...", flush=True)
- 1 回答
- 0 關注
- 106 瀏覽
添加回答
舉報
0/150
提交
取消