Created
July 2, 2021 13:27
-
-
Save dongqifong/caec9bbcb5e3636cdc29679e7df19fe4 to your computer and use it in GitHub Desktop.
validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model.eval() # 取消dropout or batch normalization | |
with torch.no_grad(): # 不計算梯度 | |
predict = [] | |
for data, labels in test_loader: | |
# Forward | |
out = model(data) | |
predict.append(out.numpy()) | |
model.train() # 重新開啟dropout or batch normalization |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment