-
Notifications
You must be signed in to change notification settings - Fork 547
Description
🐛 Bug
The captum.attr.visualization module is missing the link to its source code. I traced the issue with Sphinx's viewcode extension, and discovered that it gives the following warning.
No module named 'captum.attr.visualization'
In viewcode extension, the _get_full_modname function inside doctree_read returns None, and then skips generating the source docs. Inside the _get_full_modname function, a function called get_full_modname is run and it attempts to use importlib's import_module function to get the paths to the files
https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/viewcode.py#L116
https://github.com/sphinx-doc/sphinx/blob/master/sphinx/util/__init__.py#L242.
from importlib import import_module
module = import_module("captum.attr.visualization") # Fails
You can see that its missing it's link to the source code here: https://captum.ai/api/utilities.html#visualization
And the file being used is here: https://github.com/pytorch/captum/blob/master/captum/attr/_utils/visualization.py
I discovered this issue while trying to figure out why it's happening in the Optim module code.
Possible solutions for this issue are:
- Using an exact path in the API docs, like what was done for the Linear Models: https://captum.ai/api/utilities.html#linear-models
- Changing the file path so that the
visualization.pyfile's location matches the way it's called:captum/attr/visualization.py - Importing the needed functions in
visualization.pydirectly, though this would remove thevisualizationpart of the import path.