vision icon indicating copy to clipboard operation
vision copied to clipboard

automatic xref links in the galleries are wrong

Open pmeier opened this issue 2 years ago • 3 comments

sphinx-gallery seems to automatically create xref links for stuff that we use in the code blocks. However, these links seem to be wrong.

For example, all the transforms in https://pytorch.org/vision/0.14/auto_examples/plot_transforms.html#sphx-glr-auto-examples-plot-transforms-py link to https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.

Not available in the stable documentation yet, but datasets.CocoDetection from #7302 links to https://pytorch.org/docs/stable/data.html#torch.utils.data.Dataset

At the same time, there seem to be no xref links for "pure" torchvision stuff. For example, no xref is generated for read_image from torchvision.io in https://pytorch.org/vision/0.14/auto_examples/plot_scripted_tensor_transforms.html#sphx-glr-auto-examples-plot-scripted-tensor-transforms-py although there is documentation for it: https://pytorch.org/vision/0.14/generated/torchvision.io.read_image.html?highlight=read_image#torchvision.io.read_image

Curiously, this xref seems to work the other way around. For example, the documentation for read_image correctly identifies that it is used in multiple examples.

Given that the links are either non-existent or point to the PyTorch base class, maybe sphinx-gallery just has a problem with the package that the galleries belong to?

pmeier avatar Feb 23 '23 10:02 pmeier

Thanks for opening the issue Philip.

Curiously, this xref seems to work the other way around. For example, the documentation for read_image correctly identifies that it is used in multiple examples.

I think this is because the links are only wrong from the code blocks. On the text blocks when we manually link like a normal sphinx reference, they work fine. E.g. that one below correctly points to its doc page

image

NicolasHug avatar Feb 23 '23 11:02 NicolasHug

I don't think that is true. In #7302 only two transforms are mentioned outside the code blocks but all of them are linked back to the gallery from their API documentation.

pmeier avatar Feb 23 '23 13:02 pmeier

Hi @pmeier @NicolasHug, is this issue beginner friendly? If yes, can i work on it? If not, can you please refer me to some issue which would be a good starting point for me to understand the pytorch vision codebase and make contributions? I would love to work on the vision repo. Thanks

Bhavay-2001 avatar Feb 14 '24 15:02 Bhavay-2001