Thank you help, i have change it. But a new error is thrown.
RuntimeError: 1D target tensor expected, multi-target not supported

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-20-cc88ea5f8bd3> in <module>()
      1 model_ft = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler,
----> 2                        num_epochs=25)

4 frames
<ipython-input-19-c34fb749b111> in train_model(model, criterion, optimizer, scheduler, num_epochs)
     35                     print(outputs)
     36                     _, preds = torch.max(outputs, 1)
---> 37                     loss = criterion(outputs, labels)
     38 
     39                     # backward + optimize only if in training phase

Is it because my loss function is set as a cross entropy loss function, and the cross entropy loss function does not apply to my dataset?
My dataset have 6 class.