You cannot train these classifiers end-to-end.
Once you leave PyTorch and use numpy tensors, Autograd cannot track the operations anymore and you would need to implement all backward methods yourself.
You could train the CNN in Pytorch first, store all outputs of it after training, and train your SVM on these outputs (completely detached from PyTorch).
Alternatively, you could use the hinge loss, which (if I’m not mistaken) some researches refer to in papers if they say “we trained on SVM on top of the CNN feature classifier”.