What is kernel in conv2d

hi i want to use conv2d on my random tensor =when use conv = nn.Conv2d(3, 1, kernel_size=3, padding=1) what is the entity of kernel i mean what is inside my 3*3 kernel?

The weights or the kernel in this case is implicitly created when the Conv layer is declared and randomly initialized. Here, it would be a CPU tensor accessible as conv.weight.

1 Like

For nn.Conv2d, check conv.weight and conv.bias.

If you want to custom the kernel. See nn.init or nn.functional.conv2d.

1 Like