Thanks.
I have another problem, when I execute the code with validation data, at the end of the first epoch, this error ends.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:166: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
Epoch [1/10], Step [50/220], Loss: 0.6466
Epoch [1/10], Step [100/220], Loss: 0.6466
Epoch [1/10], Step [150/220], Loss: 0.5845
Epoch [1/10], Step [200/220], Loss: 1.0444
RuntimeError                              Traceback (most recent call last)
 in ()
21
22         # forward pass
—> 23         outputs = model(images)
24         loss = criterion(outputs, labels)
25
1 frames
 in forward(self, x)
173     # print(main_out.shape)
174     # print(Attentiom_map.shape)
 → 175     out1 = torch.matmul(main_out, Attentiom_map)
176     max_pool1 = self.pool(torch.add(main_out, out1))
177     # print(max_pool1.shape)
RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 0