if you are using torch::Tensor as input to your C++ function, and you are only doing PyTorch operations on it, no backward function is necessary (just like in Python you dont write one).
However, if you are doing some custom calls, such as going into OpenCV and editing the contents, then custom backward call is necessary, as we dont know how to differentiate through those calls.