How to invert affine matrix?

Can I invert the affine matrix and apply it to my landmarks while keeping the autograd?

Do you have a minimal reproducible example?

I can’t public code for some reason. The following is my problem. I have list of landmarks (location of pixels on image) which transformed by affine matrix M, and now i want to invert M and inverse transform the list of landmarks. How can i do that?