Sure, here is the code snippet I use:
	batch = 3
	channels = 2

	# Define a sample image (the **same** image is batched 3 times)
	f_img = torch.zeros((batch, channels, 5, 10))
	# pattern is a small 3x3 pattern for which I'm looking for with my cross-correlation
	# pattern content and position are arbitrary for the tests
	f_img[:, :, 2:5, 6:9] = pattern 
	f_img[:, :, 1:4, 1:4] = pattern * 2

	# Define 3 **different** kernel
	f_krn = torch.zeros((batch, channels, 3, 3))
	f_krn[0, :, :, :] = pattern
	f_krn[1, :, :, :] = pattern * 2
	f_krn[2, :, :, :] = pattern * 3

	print(f_img.shape, f_krn.shape)
	# Image shape: [3, 2, 5, 10] / Kernel shape: [3, 2, 3, 3]

	# Perform cross-correlation
	f_img = f_img.view(1, batch * channels, f_img.shape[2], f_img.shape[3])
	f_krn = f_krn.view(batch, channels, 3, 3)

	result = F.conv2d(f_img, f_krn, groups=batch)

	print(result)

Thanks