Okay, so here I am making a classifier of 4 classes and now I want to use SVM, for that I got this reference - SVM using PyTorch in Github 898. I have seen this scikit learn SVM, but I am not able to find out how to use this and print the loss and accuracy per epoch. I want to do it in PyTorch. This is the code after printing the model of SVM -
learning_rate = 0.1  # Learning rate
epoch = 10  # Number of epochs
batch_size = 32  # Batch size

#X = torch.FloatTensor(X)  # Convert X and Y to FloatTensors
#Y = torch.FloatTensor(Y)
#N = len(Y)  # Number of samples, 500

#model = SVM()  # Our model
optimizer = optim.SGD(model.parameters(), lr=learning_rate)  # Our optimizer

target = torch.randint(0, n_classes, (batch_size,)) # labels

for epoch in range(1, epoch+1):
  
  train_loss = 0
  model.train()
  for images, labels in dataloader_train:
    
    #steps += 1
    images, labels = images.to(device), labels.to(device)
    
    optimizer.zero_grad()
    
    output = model.forward(images)
    conf_matrix = confusion_matrix(output, labels, conf_matrix)
    p = torch.nn.functional.softmax(output, dim=1)
    prediction = torch.argmax(p, dim=1)
    #loss = torch.nn.functional.nll_loss(torch.log(p), y)
    loss = criterion(output, labels)
    loss.backward()
    optimizer.step()
    
    train_loss += loss.item()*images.size(0)
    
    #vis.line(X=torch.ones((1,1)).cpu()*epoch, Y=torch.Tensor([train_loss]).unsqueeze(0).cpu(),win=loss_window,update='append')    
    
  #if steps % print_every == 0:
  valid_loss = 0
  accuracy = 0
  model.eval()
  for images, labels in dataloader_test:
    optimizer.zero_grad()
    with torch.no_grad():
       
      images, labels = images.to(device), labels.to(device)
      #if train_on_gpu:
      #      images, labels = data.cuda(), target.cuda()

      output = model.forward(images)
      conf_matrix = confusion_matrix(output, labels, conf_matrix)
      p = torch.nn.functional.softmax(output, dim=1)
      prediction = torch.argmax(p, dim=1)
      loss = criterion(output, labels)
          
      valid_loss += loss.item()*images.size(0)
      
      ps = torch.exp(output)
         
      top_p, top_class = ps.topk(1, dim = 1)
      equals = top_class == labels.view(*top_class.shape)
      accuracy += torch.mean(equals.type(torch.FloatTensor))
      
  # calculate average losses
  train_loss = train_loss/len(dataloader_train.dataset)
  valid_loss = valid_loss/len(dataloader_test.dataset)

How to proceed with SVM, there is almost no clue in the net, or I am not able to find out. Thanks.