I want use the GoogLeNet model but something wrong

username: 111186
cooked: <p>I have two questions ：<br>
first：what’s the different between googlenet.py and inception.py if I want to use GoogLeNet model which is the suitable.</p>
<p>second：<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/b/2b215c3220fd52bb2a7180b9fd575d6a723677a6.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/2b215c3220fd52bb2a7180b9fd575d6a723677a6" title="QQ%E6%88%AA%E5%9B%BE20200102211630"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b215c3220fd52bb2a7180b9fd575d6a723677a6_2_690x241.jpeg" alt="QQ%E6%88%AA%E5%9B%BE20200102211630" data-base62-sha1="69y0jdvaoCtzpNll5d3aPQE9HXU" width="690" height="241" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b215c3220fd52bb2a7180b9fd575d6a723677a6_2_690x241.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b215c3220fd52bb2a7180b9fd575d6a723677a6_2_1035x361.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2b215c3220fd52bb2a7180b9fd575d6a723677a6_2_1380x482.jpeg 2x" data-dominant-color="2D3537"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">QQ%E6%88%AA%E5%9B%BE20200102211630</span><span class="informations">2421×849 87.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/0/d0ca4c8aeee475219dc8412410ca253124e29c4a.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/d0ca4c8aeee475219dc8412410ca253124e29c4a" title="QQ%E6%88%AA%E5%9B%BE20200102211648"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d0ca4c8aeee475219dc8412410ca253124e29c4a_2_690x55.jpeg" alt="QQ%E6%88%AA%E5%9B%BE20200102211648" data-base62-sha1="tN2JILg7amqpOhnj0N44Qa7P7vk" width="690" height="55" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d0ca4c8aeee475219dc8412410ca253124e29c4a_2_690x55.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d0ca4c8aeee475219dc8412410ca253124e29c4a_2_1035x82.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/d/0/d0ca4c8aeee475219dc8412410ca253124e29c4a_2_1380x110.jpeg 2x" data-dominant-color="343533"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">QQ%E6%88%AA%E5%9B%BE20200102211648</span><span class="informations">1803×145 24.2 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
I want konw if i want to get the output’s size which function is right. when i use the vgg model the shape is ok.<br>
thanks so much</p>

username: Eta_C
cooked: <aside class="onebox githubblob">
  <header class="source">
      <a href="https://github.com/pytorch/vision/blob/d2c763e14efe57e4bf3ebf916ec243ce8ce3315c/torchvision/models/googlenet.py#L19" target="_blank" rel="nofollow noopener">github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/vision/blob/d2c763e14efe57e4bf3ebf916ec243ce8ce3315c/torchvision/models/googlenet.py#L19" target="_blank" rel="nofollow noopener">pytorch/vision/blob/d2c763e14efe57e4bf3ebf916ec243ce8ce3315c/torchvision/models/googlenet.py#L19</a></h4>
<pre class="onebox"><code class="lang-py"><ol class="start lines" start="9" style="counter-reset: li-counter 8 ;">
<li>from torch import Tensor</li>
<li>from .utils import load_state_dict_from_url</li>
<li>
</li>
<li>__all__ = ['GoogLeNet', 'googlenet', "GoogLeNetOutputs", "_GoogLeNetOutputs"]</li>
<li>
</li>
<li>model_urls = {</li>
<li>    # GoogLeNet ported from TensorFlow</li>
<li>    'googlenet': 'https://download.pytorch.org/models/googlenet-1378be20.pth',</li>
<li>}</li>
<li>
</li>
<li class="selected">GoogLeNetOutputs = namedtuple('GoogLeNetOutputs', ['logits', 'aux_logits2', 'aux_logits1'])</li>
<li>GoogLeNetOutputs.__annotations__ = {'logits': Tensor, 'aux_logits2': Optional[Tensor],</li>
<li>                                    'aux_logits1': Optional[Tensor]}</li>
<li>
</li>
<li># Script annotations failed with _GoogleNetOutputs = namedtuple ...</li>
<li># _GoogLeNetOutputs set here for backwards compat</li>
<li>_GoogLeNetOutputs = GoogLeNetOutputs</li>
<li>
</li>
<li>
</li>
<li>def googlenet(pretrained=False, progress=True, **kwargs):</li>
<li>    r"""GoogLeNet (Inception v1) model architecture from</li>
</ol></code></pre>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>

<p>As you can see, <code>GoogleNetOutputs</code> is a namedtuple, not a tensor.</p>

username: Oli
cooked: <p>GoogLeNet returns a named tuple and thus behave differently than VGG. See <a href="https://pytorch.org/docs/stable/_modules/torchvision/models/googlenet.html#googlenet" rel="nofollow noopener">source</a></p>
<p><code>GoogLeNetOutputs = namedtuple('GoogLeNetOutputs', ['logits', 'aux_logits2', 'aux_logits1'])</code></p>
<p>Try</p>
<pre><code class="lang-auto">output = net(x)
output_logits = output.logits
print(output_logits.shape)
</code></pre>

username: 111186
cooked: <p>Thank you for your code it is OK. could you answer my first question .thanks again</p>

username: 111186
cooked: <p>Thank you so much:grinning:</p>

username: fbueller
cooked: <aside class="quote no-group" data-username="111186" data-post="1" data-topic="65591">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/111186/48/17819_2.png" class="avatar"> 111186:</div>
<blockquote>
<p>first：what’s the different between googlenet.py and inception.py</p>
</blockquote>
</aside>
<p>googlenet.py: GoogLeNet aka Inception v1<br>
inception.py: Inception v3</p>
<p>For more info:</p>
<pre><code class="lang-auto">import torchvision
help(torchvision.models.googlenet)
help(torchvision.models.inception_v3)
</code></pre>