I changed the code as follows:
Now I want to give the output to the self.Global_1 convolution layer, but the output size of vgg is [3,100] but the input for self.Global_2 is  [128, 512, 3, 3].How can I fix it?
errpr:
RuntimeError: Expected 4-dimensional input for 4-dimensional weight [128, 512, 3, 3], but got 2-dimensional input of size [3, 1000] instead
class Identity(nn.Module):
def __init__(self):

    super(Identity, self).__init__()     

def forward(self, x):

    return x

vgg16 = models.vgg16(pretrained=True)
vgg16.fc = Identity()
vgg16.to(device)
for param in vgg16.features.parameters():
param.requires_grad = False
print(vgg16)
class attention_block(nn.Module):
def init(self):
super(attention_block, self).init()
self.Global_1 = nn.Conv2d(512,128,kernel_size=3, padding=1)
self.conv2_bn6= nn.BatchNorm2d(128)
self.Global_2 = nn.Conv2d(128,128,kernel_size=3, padding=1)
self.conv2_bn7= nn.BatchNorm2d(128)
self.Global_features = nn.Conv2d(128,128,kernel_size=1, padding=1)
self.Global_Score = nn.Conv2d(128,2,kernel_size=1, padding=1)


#fully connected

self.fc1 = nn.Linear(10*10* 208, 64)
self.fc2 = nn.Linear(64,32)
self.fc3 = nn.Linear(32,2)
########################################################################

def forward(self, x):
out = vgg16(x)
print(out.shape)
Global_Score = self.Global_Score(self.Global_features(F.relu(self.Global_2(F.relu(self.Glo bal_1(out))))))
Global_Score = Global_Score.repeat(1, 64, 1, 1)

final_out= torch.sigmoid(F.dropout(self.fc3(torch.sigmoid(F.dropout(self.fc2(torch.sigmoid(F.dropout(self.fc1(Global_Score .view(Global_Score .size(0),-1))))))))))



return final_out