记录:
使用DataLoader时drop_last默认为False,其代表最后一个batch的数据不足一个size大小则保留该batch,为True时则不保留不满足size大小的batch。
在默认为False时运行出现mat1 and mat2 shapes cannot be multiplied,表示形状不能相乘,将drop_last设置为True,运行时正常无错误。
官方解释:drop_last (bool, optional) – set to True
to drop the last incomplete batch, if the dataset size is not divisible by the batch size. If False
and the size of dataset is not divisible by the batch size, then the last batch will be smaller.