C extension function with learnable parameters

Hi,

I want to implement a custom function/layer in C/CUDA extension. This function/layer contains learnable parameters. Is there any tutorial for this task? I have browsed some source code of pytorch and an C extension example maskrcnn but I did not get the point to implement my custom function.

Any help will be appreciated. Thank you.