プリンキピア

第4章分類のための線形ニューラルネットワーク

4.5. Concise Implementation of Softmax Regression4.5 ソフトマックス回帰の簡潔な実装

Just as high-level deep learning frameworks made it easier to implement linear regression (see Section 3.5), they are similarly convenient here.
英語のヒント
高水準の深層学習フレームワークが線形回帰の実装を楽にしてくれたのとちょうど同じように(3.5節を参照)、ここでも同様に便利である。
import torch
from torch import nn
from torch.nn import functional as F
from d2l import torch as d2l