Hi,
I have tried doing inference with the trained parameter values (from Normie_net) in my custom model defined under class Net. But the accuracy is very low. And the time taken is also pretty high over the test data.

I am not sure if it is because of my implementation of the convolution operation under the forward() of MBM_conv2d class.
for b in range(batch_size):
	for o in range(out_channel):
		for L in range(patches.size(1)):
			x = convolve(patches[b][L], k[o])
			result[b][o][L//orig_h][L%orig_w] = x

And the file containing convolve() is defined below:
import torch
import torchvision as tv
from torch import nn
import torch.nn.functional as F

def convolve(inp, kernel):
	
	result = 0.0
	for i in range(len(inp)):
		result += MBM_func(inp[i], kernel[i]) #Custom multiplication algorithm

	return result

def MBM_func(a, b):
	return a*b

Is there a way to improve the efficiency of convolution computation? I was wondering if I could implement this operation in the manner in which it is done in the C++ backend of nn.conv2d class.
Any suggestions or leads would be really helpful.
Also a link to the code to the C++ back-end implementation of the convolution operation done in pytorch would be really helpful!
TIA