Since this attribute is set to True
in your example, the input will be transformed.
Using it also yields the same results:
x = torch.randn(10, 3, 224, 224)
glnet = models.googlenet(pretrained=True)
glnet.eval()
res = glnet(x)
out = x
if glnet.transform_input:
out = glnet._transform_input(out)
for name, layer in glnet.named_children():
if name == 'fc':
out = nn.Flatten()(out)
out = layer(out)
print((out - res).abs().max())
> tensor(0., grad_fn=<MaxBackward1>)