Where is the torch.nn.functional.conv1d code?

Hi
I searched torch files but did not find the main body codes of “torch.nn.functional.conv1d” . Is this code available to the public?

Hi,

Yes there is a cpu and gpu.
Note that if you use the gpu, by default, cudnn is used and that one is provided by nvidia and is closed source.

1 Like

Thank you so much,and Another question is coming to me.So I can not apply my own changes to GPU version?

If you set torch.backends.cudnn.enabled = False, then it will use the version that I linked above and so if you make your own changes in this code it will run.
Note though that this implementation is not as fast as the one from cudnn as it implements a single algorithm for all cases.

1 Like

I’m sorry but I couldn’t find SpatialConvolutionMM.c in my computer!
I have the torch on Anaconda
I have a small change in the part where the input and weights of the mask do the cross-correlation operator, and I can’t find this part.

It is easier to write a cpp extension for cuda, than changing the source.

1 Like

To modify the c code, you will need to download the souce, modify it then install from source to get those changes.
As @dashesy mentionned, if you want to create a new op, it will be simpler to use cpp extensions.

1 Like