How to create a new torch.function() method?

I’ll chime in with a bit of additional detail:
I think aten/src/ATen/native/native_functions.yaml is probably central and cumsum in particular is in the same directory in ReduceOps.cpp - but only a few wrappers for dealing with the accumulation type. The definition itself is - as @albanD said - in TH/THC. When you start a feature request, it might be worth discussing with the devs if that might be moved to native in that context, too.

I wrote up a short guide about how to go from Python function to the C++ implementation, maybe it can be useful as a start (it focuses on native, though, but I think the derivative bits may be relevant to cumsum). I’ll try to flesh out some bits about functions implemented directly in CPU and CUDA.

Best regards

Thomas

2 Likes