What does “kernel” in trained_kernel in the code below mean? Is it different from the kernel often expressed in convolution? Also, is the operation of torch.stack ([torch.mean (trained_kernel, 1)] * 6, dim = 1) a general operation? Is there a reference somewhere?
from torchvision.models import resnet34

# get resnet34 model with 6 channels
def get_model(pretrained=False):
    model = resnet34(pretrained=pretrained)
    model.fc = nn.Linear(512, n_class)
    trained_kernel = model.conv1.weight
    new_conv = nn.Conv2d(6, 64, kernel_size=7, stride=2, padding=3, bias=False)
    with torch.no_grad():
        new_conv.weight[:,:] = torch.stack([torch.mean(trained_kernel, 1)]*6, dim=1)
    model.conv1 = new_conv
    return model