简体   繁体   English

在 pytorch 中使用 DataLoader 时对批量大小感到困惑

[英]Confusion regarding batch size while using DataLoader in pytorch

I am new to pytorch.我是 pytorch 的新手。 I am training an ANN for classification on the MNIST dataset.我正在训练 ANN 对 MNIST 数据集进行分类。

train_loader = DataLoader(train_data,batch_size=200,shuffle=True)

I am confused.我很困惑。 The dataset is of 60,000 images and I have set batch size of 6000 and my model has 30 epochs.该数据集包含 60,000 张图像,我将批量大小设置为 6000,我的 model 有 30 个 epoch。 Will every epoch see only 6000 images or will every epoch see 10 batches of 6000 images?每个 epoch 会只看到 6000 张图像,还是每个 epoch 会看到 10 批 6000 张图像?

Every call to the dataset iterator will return batch of images of size batch_size .对数据集迭代器的每次调用都将返回一批大小为batch_size的图像。 Hence you will have 10 batches until you exhaust all the 60000 images.因此,您将有 10 个批次,直到用完所有60000张图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM