Pytorch Workflow: (4) Making predictions with a trained model

Yul Kang·2022년 12월 5일
0

PyTorch Workflow

목록 보기
4/5
post-thumbnail

This content is from: https://www.youtube.com/@mrdbourke, specifically, https://www.youtube.com/watch?v=Z_ikDlimN6A&ab_channel=DanielBourke

Step 1: Make predictions on the test data

# Turn model into evaluation mode
model_1.eval()

# Make predictions on the test data
with torch.inference_mode():
  y_preds = model_1(X_test)
y_preds

Result

tensor([[0.8600],
        [0.8739],
        [0.8878],
        [0.9018],
        [0.9157],
        [0.9296],
        [0.9436],
        [0.9575],
        [0.9714],
        [0.9854]], device='cuda:0')

Step 2: Check model predictions visually

# Check out our model predictions visually
plot_predictions(predictions=y_preds.cpu())

Result

profile
A coder who wants to be a programmer

0개의 댓글