How does DataLoader() know which dl is for training/validation?

In lecture 4

the code

dls = DataLoaders(dl, valid_dl)

passes through the training dl “dl” and the target dl “valid_dl”.

when we run the following code:

learn = Learner(dls, nn.Linear(28*28,1), opt_func=SGD,
loss_func=mnist_loss, metrics=batch_accuracy)

How does Learner() know which dataloader is where our training dataset is?

If I understand your question, the first parameter to Dataloaders (with an s) is the training Dataloader. The second parameter is the validation Dataloader. Both Dataloader’s yield both the input and corresponding target.

Hopefully you can sort it out from these hints.