Avoid calling torch._C._cudnn_convolution_forward

Hi, everyone!

I want to avoid calling the function “torch._C._cudnn_convolution_forward” which exists in pytorch 0.1.12.
But, I don’t know another function that plays a similar role to the function.

help me plz.


Why don’t you want to call it?
You can disable cudnn with torch.backends.cudnn.enabled=False if your goal is not to use cudnn.

1 Like

I am implementing a new type of convolution layer. Therefore, we need to rewrite the forward and backward functions. However, if it is similar to an existing convolution operation, I will try to accelerate the part using cuDNN.

Now, I am referring to ConvND in torch 0.1.12 (Link),
and this function is being used for torch._C._cudnn_convolution. If you have any other code to refer to, can you recommend it?

Thanks! :slight_smile:

If your goal is to create a new operations, you don’t think to change anything in pytorch’s code.
Just create a new function with your operations. If they are all differentiable, then you will get the gradients automatically.
If they are not differentiable (or you implement the forward in low level code that the autograd cannot work with), you can create an autograd.Function.

1 Like

You’re right!!!
I decided to use F.conv2d!

Thanks. :slight_smile: