What do i, batch, and step represent? what differences are there?
for i, batch in enumerate(dataloader):
real_A = Variable(batch["A"].type(Tensor))
real_B = Variable(batch["B"].type(Tensor))
for step, (x, y) in enumerate(data_loader):
images = make_variable(x)
labels = make_variable(y.squeeze_())
step represent the same variable returned by
enumerate (the counter of the current loop).
The return value of the
dataloader seems to be a
dict in the first example, so
batch will contain the keys
data_loader will return a
tuple which is unpacked to
In Example 1, A and B respectively represent two image data sets. So does batch here refer to batches of images?Is batch and batchsize related here?
In Example 2, ImageFolder is used. Do x and y refer to the images in the folder and the folder name under the path?
Your code snippets just show the usage of the return value of the
I assume that no custom collate functions etc. were used, but the “standard” approach of creating a
Dataset and wrapping it into a
batch is the name of the returned variable from the
DataLoader. Based on the following lines of code, it seems that it’s a
dict containing batches of
'B', which both seem to be tensors.
A batch contains
batch_size number of samples.
ImageFolder will return the loaded image and the corresponding target, not the folder name.
The subfolders will be sorted and
ImageFolder will assign a class index to each folder.
Thank you very much for your answers!