I am not sure to understand exactly what you want.
But if you want to create a new function with custom forward (potentially inexact) and backward (potentially gradients of the true forward you wanted but couldn’t compute), you can check here 5 how to do it.