プリンキピア

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

4.3. The Base Classification Model4.3 基底となる分類モデル

You may have noticed that the implementations from scratch and the concise implementation using framework functionality were quite similar in the case of regression. The same is true for classification. Since many models in this book deal with classification, it is worth adding functionalities to support this setting specifically. This section provides a base class for classification models to simplify future code.
英語のヒント
回帰の場合、ゼロからの実装と、フレームワークの機能を使った簡潔な実装とがかなり似ていたことに気づいたかもしれない。分類でも同じことが言える。この本の多くのモデルは分類を扱うので、この設定に特化して支える機能を加えておく価値がある。この節では、今後のコードを簡単にするため、分類モデルのための基底クラスを用意する。
import torch
from d2l import torch as d2l