Using the Python backend one can create custom functions by subclassing from Function and implementing the forward and backward methods, as explained in https://pytorch.org/docs/stable/notes/extending.html
However in my work I am trying to use Pytorch using the C++ API which is working great for the moment. Nevertheless the implementation of custom functions (so extending torch.autograd) is not clear using the C++ API. Creating a C++ class which inherits from torch::autograd::Function and implements the forward and backward passes seems to not be the solution as the Function class in function.h seems to lack the forward and backward methods to begin with.
What would be the best way to write custom functions using the C++ API? I understand that this new frontend is only in an initial stage and we can expect changes to it but it would be great if there could be a way (even if more verbose) to somehow create custom functions in which we can define our own computation and gradients.