If there is no pytorch implementation, I’m afraid you’ll have to do one of the following:

reimplement a new version with pytorch operators to use the autograd
write a custom Function (https://pytorch.org/docs/stable/notes/extending.html 2) that uses the original library in the forward and for which you will specify the backward.