Hi @Kreddy17,
One thing that comes to mind as a potential solution would be to write a custom autograd function that takes its forward method as your someotherfunc and the backward method would need to be customly implemented. The backward method would need to have the gradient of d(someotherfunc)/d(x) and d(someotherfunc)/d(learnable_param) as returned variables which you might be able to determine analytically (depending on your cv2 function). And example of a custom autograd function can be found here 2