1.nn.Linear(32, 64):
input can be any shape but the last dimension must be 32 e.g. (10, 32), (10, 5, 32), (1, 1, 3, 32),
2. Cuda Out of Memory
solution:The batch size of data is too large to fit in the GPU. Reduce the batch size.
3.labels = torch.Tensor([1,2,3,4,0])默认创建的tensor.dtype为float,但是label得改为long才能传入crossentropyloss
labels = labels.long()#64int
L = nn.CrossEntropyLoss()#该函数内部实现了softmax,只需要直接传入outvector和labels即可