1. Training Loop Step
|
2. Mode To Label
-
go from raw model output to predict label;
-
logits → prediction probability → prediction label;
-
在训练循环步骤之前,看看在前向传递过程中模型会产生啥结果,
前向传递由forward()定义,为此想模型传递数据:
# view the frist 5 output of forward pass on test data
y_logit = model_0(X_test.to(device))[:5]
y_logit
tensor([[0.2625],
[0.2737],
[0.3577],
[0.2350],
[0.5554]], grad_fn=<SliceBackward0>)
-
模型没经过训练,这些输出是随机的,它们是forward()的输出,
已实现两层nn.Linear(),内部调用以下等式: -
y = X * WeightT + bias