Where is the C/C++ code for torch.nn.functional.fold()?

Hi,
I’m new to Pytorch C/C++ extention. My question is naive: Where is the C/C++ code for torch.nn.functional.fold()?

Thank you!

Ok, I’ve found it.

Just incase if you want to dig deeper on col2im:

Native C++: pytorch/Col2Im.cpp at master · pytorch/pytorch · GitHub

Cuda code:
pytorch/Col2Im.cu at master · pytorch/pytorch · GitHub,
pytorch/im2col.cuh at master · pytorch/pytorch · GitHub

1 Like

Thanks for the useful information!
A follow-up question is: If I want to write a modified version of col2im() with a different name, can I write it in C++ extensions? Or must I write it inside the ATen library and recompile?

I haven’t tried it. In my understanding, it should be possible to write a modified version of col2im in a standalone way than inside ATen.

1 Like

Good, thanks for the info!