def train(model,dataloader,validloader,criterion,optimizer,epochs=50):
    max_valid_acc = 0
    train_acc,val_acc = 0,0
    for e in range(epochs):
        train_loss = 0.0
        model.train()     # Optional when not using Model Specific layer
        for data, labels in dataloader:
#             print(labels.shape[0])
            data, labels = data.to(device), labels.to(device)
#             print(data.shape)
            optimizer.zero_grad()
            target = model(data)
#             print(target.shape)
            loss = criterion(target.float(),labels.long())
            loss.backward()
            optimizer.step()
            train_loss = loss.item() * data.size(0)
            train_acc += torch.sum((torch.max(target, 1)[1] == labels.data),0)
            
        valid_loss = 0.0
        model.eval()     # Optional when not using Model Specific layer
        for data, labels in validloader:
            
            data, labels = data.to(device), labels.to(device)

            target = model(data)
            loss = criterion(target.float(),labels.long())
            valid_loss = loss.item() * data.size(0)
            val_acc += torch.sum((torch.max(target, 1)[1] == labels.data),0)
            
            
        print(f'Epoch {e+1} \t\t Training Loss: {train_loss / len(dataloader)} \t\t Validation Loss: {valid_loss / len(validloader)}')
        print("Validation Accuracy ... :",val_acc/(len(validloader)))
        print("Train Accuracy ... :",train_acc/(len(X_train_tensor)))
        
        if val_acc > max_valid_acc:
            print(f'Validation Acc Increased({max_valid_acc:.6f}--->{val_acc:.6f}) \t Saving The Model')
            max_valid_acc = val_acc
            # Saving State Dict
            torch.save(model.state_dict(), 'saved_model.pth')
        train_acc = 0
        val_acc = 0
    return model

How can I check that a few examples are overfitting? I’m beginner