I already did what you have suggested.
def forward(self, x):
        out = self.cnn1(x)
        out = self.relu1(out)
       
        out = self.maxpool1(out)
       
        out = self.cnn2(out)
        out = self.relu2(out)

        out = self.maxpool2(out)

        out = out.view(out.size(0), -1)

        out = self.fc1(out)
       
        return out

This is my architecture. Now (using what you have suggested), I will extract the features from the layer previous to the last (which is what I wanted):
out = out.view(out.size(0), -1)

The output shape is: torch.Size([1, 1568])
Converting to numpy array: (1, 1568)
Using this features, do you have any idea of what can I do now to apply traditional ML methods and get an output of ( -918.5343,  -532.8511,  -771.1676,  -722.4738,  -863.3235,  -838.9160,
-1015.9191,  -593.9412,  -680.5461,  -670.0557) (Class Activations).
How can I apply this array of (1,1568) to get a 10 class output?
Thank you for your answers and time