I am making an image classifier and I have already used CNN and Transfer Learning to classify the images. Support Vector Machine gives a very good boundary with a solid margin, so now I would like to try the SVM into my project. Now I am using PyTorch for all my models. How can I make this model now?
I got this code for making an SVM Classifier -
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable

class SVM(nn.Module):
    def __init__(self):
        super().__init__()  # Call the init function of nn.Module
        
        self.fc1 = nn.Linear(25088, 12544)
        self.fc2 = nn.Linear(12544, 6272)
        self.fc3 = nn.Linear(6272, 3136)
        self.fc4 = nn.Linear(3136, 1568)
        self.fc5 = nn.Linear(1568, 4)
                
    def forward(self, x):
        
        #Flatten the Image
        x = x.view(x.size(0), -1)

        # add dropout layer
        x = self.dropout(x)
        
        # add 1st hidden layer, with relu activation function
        x = F.leaky_relu(self.fc1(x))
        # add dropout layer
        x = self.dropout(x)
        
        # add 2nd hidden layer, with relu activation function
        x = F.leaky_relu(self.fc2(x))
        # add dropout layer
        x = self.dropout(x)
        
        # add 3rd hidden layer, with relu activation function
        x = F.leaky_relu(self.fc3(x))
        # add dropout layer
        x = self.dropout(x)
        
        # add 4th hidden layer, with relu activation function
        x = F.leaky_relu(self.fc4(x))
        # add dropout layer
        x = self.dropout(x)
        
        # add 5th hidden layer, with relu activation function
        x = self.fc5(x)
       
        
        # add 2nd hidden layer, with relu activation function
        #x = self.fc2(x)
        return x

Is it the code for SVM? I am not sure about this, becasue this is only just some linear layers. Can you guys please throw some light in it? Thanks!