The shape of the weights is the size of the train dataset, which is a torch.Size[(23903)] and the num_samples size is 23903.
I saw once again the example that you linked and I think I am doing this right but I have to admit that when I start to get into multi-threading (the python version of multi-threading) I get lost.