Source Code: F.conv2d() Definition Location

I keep trying to find WHERE F.conv2d() is defined, like where all of it is ACTUALLY written out logically. Does anyone know where it hides?

Under torch/nn/modules/ line 339 calls F.conv2d() but as I go to torch/nn/ to where it supposed to be defined all i get are comments about it at line 48.

The call is eventually calling into Convolution.cpp, where some checks are applied to further dispatch the call to the proper backend (MKL, cudnn, native implementation etc.).

1 Like

Thanks! It’s close, but only shows a call to some other function…sigh… I suppose it’s the secret sauce.

The native implementation are not closed source and the CPU version can be found here, while the CUDA version is here.

Ptrblck, you’re awesome! Thank you for your dedication!


@ptrblck Is aten/src/THCUNN/generic/ still the CUDA convolution implementation that pytorch uses? When I clone the pytorch repository with git clone --recursive that file isn’t even included.

You can find the current implementation here as it was moved to the ATen namespace.