pytorch / vision

Datasets, Transforms and Models specific to Computer Vision
https://pytorch.org/vision
BSD 3-Clause "New" or "Revised" License
16k stars 6.92k forks source link

automatic xref links in the galleries are wrong #7307

Open pmeier opened 1 year ago

pmeier commented 1 year ago

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?

NicolasHug commented 1 year ago

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

pmeier commented 1 year ago

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.

Bhavay-2001 commented 7 months ago

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