報錯資訊:
Implicit dimension choice for soft max has been deprecated. Change the call to include D_out = interp(model_D(F.softmax(pred)))
錯誤原因:
版本相容問題。pytorch較高版本會出現此錯誤,在高版本中,softmax的隐式次元選擇已棄用 。需要調用包含dim=X作為參數。
源碼:
D_out = interp(model_D(F.softmax(pred)))
修改:
D_out = interp(model_D(F.softmax(pred, dim=1)))
報錯資訊:
IndexError: too many indices for array.
錯誤原因:
版本相容問題。loss函數出錯。
源碼:
loss_semi_adv_value += loss_semi_adv.data.cpu().numpy()[0]/args.lambda_semi_adv
修改:
loss_semi_adv_value += loss_semi_adv.data.cpu().numpy()/args.lambda_semi_adv