Your code snippets just show the usage of the return value of the DataLoaders.
I assume that no custom collate functions etc. were used, but the “standard” approach of creating a Dataset and wrapping it into a DataLoader.
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 'A' and '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.