Okay, I changed it and also this line:    train_dataset=(torch.tensor(train_images), torch.tensor(b_tr), torch.tensor(b_label_tr))  to convert the data from numpy.ndarray to tensor.
Now for this line I get the following error: ValueError: expected sequence of length 1 at dim 1 (got 2). How I can solve that?