s_n:

Is this error occurring because in the forward function of Conv2d_function class I am defining a tensor using .to(device)?


Yes, and since you are not specifying the device id, the default device will be used in each model replica.
You could use the device attribute of the incoming tensors instead:
y1 = torch.tensor([1,2,3]).to(x1.device)
y2 = torch.tensor([4,5,6]).to(x1.device)