Skip to content

Commit cd12b9a

Browse files
ekagra-ranjanfmassa
authored andcommitted
Modifying the comments of inceptionV3 dimensions (#748)
* Modifying the comments of inceptionV3 dimensions Modifying the comments of inceptionV3 dimensions to match the pytorch convention. Relevant (#719 (review)) * Added Batch size in comment * Update inception.py
1 parent 813576b commit cd12b9a

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

torchvision/models/inception.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def inception_v3(pretrained=False, **kwargs):
1919
2020
.. note::
2121
**Important**: In contrast to the other models the inception_v3 expects tensors with a size of
22-
299x299x3, so ensure your images are sized accordingly.
22+
N x 3 x 299 x 299, so ensure your images are sized accordingly.
2323
2424
Args:
2525
pretrained (bool): If True, returns a model pre-trained on ImageNet
@@ -78,55 +78,55 @@ def forward(self, x):
7878
x_ch1 = torch.unsqueeze(x[:, 1], 1) * (0.224 / 0.5) + (0.456 - 0.5) / 0.5
7979
x_ch2 = torch.unsqueeze(x[:, 2], 1) * (0.225 / 0.5) + (0.406 - 0.5) / 0.5
8080
x = torch.cat((x_ch0, x_ch1, x_ch2), 1)
81-
# 299 x 299 x 3
81+
# N x 3 x 299 x 299
8282
x = self.Conv2d_1a_3x3(x)
83-
# 149 x 149 x 32
83+
# N x 32 x 149 x 149
8484
x = self.Conv2d_2a_3x3(x)
85-
# 147 x 147 x 32
85+
# N x 32 x 147 x 147
8686
x = self.Conv2d_2b_3x3(x)
87-
# 147 x 147 x 64
87+
# N x 64 x 147 x 147
8888
x = F.max_pool2d(x, kernel_size=3, stride=2)
89-
# 73 x 73 x 64
89+
# N x 64 x 73 x 73
9090
x = self.Conv2d_3b_1x1(x)
91-
# 73 x 73 x 80
91+
# N x 80 x 73 x 73
9292
x = self.Conv2d_4a_3x3(x)
93-
# 71 x 71 x 192
93+
# N x 192 x 71 x 71
9494
x = F.max_pool2d(x, kernel_size=3, stride=2)
95-
# 35 x 35 x 192
95+
# N x 192 x 35 x 35
9696
x = self.Mixed_5b(x)
97-
# 35 x 35 x 256
97+
# N x 256 x 35 x 35
9898
x = self.Mixed_5c(x)
99-
# 35 x 35 x 288
99+
# N x 288 x 35 x 35
100100
x = self.Mixed_5d(x)
101-
# 35 x 35 x 288
101+
# N x 288 x 35 x 35
102102
x = self.Mixed_6a(x)
103-
# 17 x 17 x 768
103+
# N x 768 x 17 x 17
104104
x = self.Mixed_6b(x)
105-
# 17 x 17 x 768
105+
# N x 768 x 17 x 17
106106
x = self.Mixed_6c(x)
107-
# 17 x 17 x 768
107+
# N x 768 x 17 x 17
108108
x = self.Mixed_6d(x)
109-
# 17 x 17 x 768
109+
# N x 768 x 17 x 17
110110
x = self.Mixed_6e(x)
111-
# 17 x 17 x 768
111+
# N x 768 x 17 x 17
112112
if self.training and self.aux_logits:
113113
aux = self.AuxLogits(x)
114-
# 17 x 17 x 768
114+
# N x 768 x 17 x 17
115115
x = self.Mixed_7a(x)
116-
# 8 x 8 x 1280
116+
# N x 1280 x 8 x 8
117117
x = self.Mixed_7b(x)
118-
# 8 x 8 x 2048
118+
# N x 2048 x 8 x 8
119119
x = self.Mixed_7c(x)
120-
# 8 x 8 x 2048
120+
# N x 2048 x 8 x 8
121121
# Adaptive average pooling
122122
x = F.adaptive_avg_pool2d(x, (1, 1))
123-
# 1 x 1 x 2048
123+
# N x 2048 x 1 x 1
124124
x = F.dropout(x, training=self.training)
125-
# 1 x 1 x 2048
125+
# N x 2048 x 1 x 1
126126
x = x.view(x.size(0), -1)
127-
# 2048
127+
# N x 2048
128128
x = self.fc(x)
129-
# 1000 (num_classes)
129+
# N x 1000 (num_classes)
130130
if self.training and self.aux_logits:
131131
return x, aux
132132
return x
@@ -305,20 +305,20 @@ def __init__(self, in_channels, num_classes):
305305
self.fc.stddev = 0.001
306306

307307
def forward(self, x):
308-
# 17 x 17 x 768
308+
# N x 768 x 17 x 17
309309
x = F.avg_pool2d(x, kernel_size=5, stride=3)
310-
# 5 x 5 x 768
310+
# N x 768 x 5 x 5
311311
x = self.conv0(x)
312-
# 5 x 5 x 128
312+
# N x 128 x 5 x 5
313313
x = self.conv1(x)
314-
# 1 x 1 x 768
314+
# N x 768 x 1 x 1
315315
# Adaptive average pooling
316316
x = F.adaptive_avg_pool2d(x, (1, 1))
317-
# 1 x 1 x 768
317+
# N x 768 x 1 x 1
318318
x = x.view(x.size(0), -1)
319-
# 768
319+
# N x 768
320320
x = self.fc(x)
321-
# 1000
321+
# N x 1000
322322
return x
323323

324324

0 commit comments

Comments
 (0)