1. The implementation of Softmax regression from scratch
The input is a vector 784, which is the pixel length x width of the image.
784 = 28 * 28
keepdim means keep dimension. Adding in the direction of 0 means removing the dimension of row, that is, the result is 1row; adding in the direction of 1 means removing the dimension of col, that is, the result is 1col.
X.reshape((-1, W.shape[0])), the dimension is changed to bathSize * 784
,bathSize = 256
2. A concise implementation of Softmax regression in pytorch
refer to
https://www.bilibili.com/video/BV1K64y1Q7wu