I’m using torch.nn.functional.conv2d to convolve an input with a custom non learning kernel, as follows:
input = torch.randn([1,3,300,300], requires_grad=False)
output = torch.nn.functional.conv2d(input, weight=torch.randn([6,3,5,5]))

What steps do I need to take to prevent gradient from being calculated as I’m trying to save memory.
I’ve declared my input tensor with requires_grad=false.
Is this enough or was this unnecessary?
Thanks,
Barak.