'Show Source' for PyTorch docs

Syed_S: <p>Hi, can someone tell me how the ‘Show Source‘ feature on PyTorch docs? Sometimes, it shows me the actual documentation on Github, while other times it just brings me to a bare-bones rst page, as seen here:</p>
<h1><a name="p-475580-torchcudacan_device_access_peer-1" class="anchor" href="#p-475580-torchcudacan_device_access_peer-1"></a>torch.cuda.can\_device\_access\_peer</h1>
<p>.. currentmodule:: torch.cuda</p>
<p>.. autofunction:: can_device_access_peer</p>
<p>Is there any plan to link things like these to the actual source code on github? I’m willing to help or make sure there is consistency here if so.</p>

valerian.rey: <p>If you wanna investigate, I think these links are generated in the <code>linkcode_resolve</code> function of <code>docs/source/conf.py</code> (<a href="https://github.com/pytorch/pytorch/blob/main/docs%2Fsource%2Fconf.py#L3169-L3204" rel="noopener nofollow ugc">link</a>).</p>
<p>Can you give a link to a documentation page with a broken source code link? The link in <a href="https://docs.pytorch.org/docs/stable/generated/torch.cuda.can_device_access_peer.html" rel="noopener nofollow ugc">torch.cuda.can_device_access_peer</a> (the example you gave) doesn’t seem broken.</p>

Syed_S: <p>Thanks for the reply! Maybe it’s an issue on my system. I’m not sure how, but when I click view source for torch.cuda.can_device_access_peer, I get to this link instead of the source: <a href="https://docs.pytorch.org/docs/stable/%5C_sources/generated/torch.cuda.can_device_access_peer.rst.txt" rel="noopener nofollow ugc">https://docs.pytorch.org/docs/stable/\_sources/generated/torch.cuda.can_device_access_peer.rst.txt</a></p>

valerian.rey: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/8/0/80c3f625fc513617a51cbbf2eb6e4cf368135051.png" data-download-href="https://discuss.pytorch.org/uploads/default/80c3f625fc513617a51cbbf2eb6e4cf368135051" title="show_source"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/8/0/80c3f625fc513617a51cbbf2eb6e4cf368135051_2_690x365.png" alt="show_source" data-base62-sha1="in6XDhoJQmeXtjdc30wNbWmjAch" width="690" height="365" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/8/0/80c3f625fc513617a51cbbf2eb6e4cf368135051_2_690x365.png, https://discuss.pytorch.org/uploads/default/optimized/3X/8/0/80c3f625fc513617a51cbbf2eb6e4cf368135051_2_1035x547.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/8/0/80c3f625fc513617a51cbbf2eb6e4cf368135051_2_1380x730.png 2x" data-dominant-color="EFEFEE"><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">show_source</span><span class="informations">2914×1543 367 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></p>
<p>Oh I think I understand. If I click “Show Source” (circled in red on the screenshot), I do end up in the same page as you (the source rst file), but if I click on “[source]” (circled in green), I end up to the source code.</p>
<p>I think that’s normal behavior, though. Like, this seems to be the case for all pages.</p>
<p>However, some pages don’t have this “[source]” link, so I think the confusion comes from here. You’d be enticed to click on “Show source” in those cases.</p>

Syed_S: <p>Ah got it, thanks so much!</p>