Custom conv2d filter results in error because of different input type tensors
I want to write a custom conv2d layer for my Pytorch model. Running the code below results in
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.DoubleTensor) should be the same

It somehow say &quot;torch.cuda.FloatTensor&quot; even if i don't send it to the GPU. Can somebody explain what causes this error, please?
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from torchsummary import summary


class exampleNet(nn.Module):

    def filters(self):
        w = np.ones([2,2])
        w = torch.tensor(w)
        w = w.view(1, 1, 2, 2)
        return w

    def __init__(self):
        super(exampleNet, self).__init__()   
    
    def forward(self, x):
    
        w = self.filters()
        x = F.conv2d(x, w)
        return x
    
model = exampleNet()
summary(model, (1,10,10))


The summary() function of torchsummary has an argument named device=.. which is set to cuda:0 by default. Just change it to whichever device you want
summary(model, (1,10,10), device=torch.device('cpu'))


Edit (see comments below): Consider using torchinfo instead of torchsummary.
