Skip to content

Commit 3ab53ae

Browse files
authored
Improve docs for Sphinx (#550)
* Update common.py * Update reducer.py * Update __init__.py
1 parent ef48587 commit 3ab53ae

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

captum/optim/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""optim submodule."""
22

3-
from captum.optim import models
3+
from captum.optim import models # noqa: F401
44
from captum.optim._core import loss, optimization # noqa: F401
55
from captum.optim._core.optimization import InputOptimization # noqa: F401
66
from captum.optim._param.image import images, transforms # noqa: F401

captum/optim/_utils/image/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def make_grid_image(
7070

7171
def show(
7272
x: torch.Tensor,
73-
figsize: Optional[Tuple[int, int]] = (10, 10),
73+
figsize: Optional[Tuple[int, int]] = (8, 8),
7474
scale: float = 255.0,
7575
images_per_row: Optional[int] = None,
7676
padding: int = 2,
@@ -84,7 +84,7 @@ def show(
8484
x (torch.Tensor): The tensor you want to display as an image.
8585
figsize (Tuple[int, int], optional): height & width to use
8686
for displaying the image figure.
87-
Default: ``(10, 10)``
87+
Default: ``(8, 8)``
8888
scale (float, optional): Value to multiply the input tensor by so that
8989
it's value range is [0-255] for display.
9090
Default: ``255.0``

captum/optim/_utils/reducer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ChannelReducer:
2828
reduction_alg (str or callable, optional): The desired dimensionality
2929
reduction algorithm to use. The default ``reduction_alg`` is set to NMF
3030
from sklearn, which requires users to put inputs on CPU before passing them
31-
to ``fit_transform``.
31+
to :func:`ChannelReducer.fit_transform`.
3232
Default: ``NMF``
3333
**kwargs (optional): Arbitrary keyword arguments used by the specified
3434
reduction_alg.
@@ -76,14 +76,14 @@ def fit_transform(
7676
7777
Args:
7878
79-
tensor (tensor): A tensor to perform dimensionality reduction on.
79+
tensor (torch.Tensor): A tensor to perform dimensionality reduction on.
8080
swap_2nd_and_last_dims (bool, optional): If ``True``, input channels are
8181
expected to be in the second dimension unless the input tensor has a
8282
shape of CHW.
8383
Default: ``True``.
8484
8585
Returns:
86-
*tensor*: A tensor with one of it's dimensions reduced.
86+
tensor: A tensor with one of it's dimensions reduced.
8787
"""
8888

8989
if x.dim() == 3 and swap_2nd_and_last_dims:
@@ -138,12 +138,12 @@ def posneg(x: torch.Tensor, dim: int = 0) -> torch.Tensor:
138138
139139
Args:
140140
141-
x (tensor): A tensor to make positive.
141+
x (torch.Tensor): A tensor to make positive.
142142
dim (int, optional): The dimension to concatinate the two tensor halves at.
143143
Default: ``0``
144144
145145
Returns:
146-
tensor (torch.tensor): A positive tensor for one-sided dimensionality
146+
tensor (torch.Tensor): A positive tensor for one-sided dimensionality
147147
reduction.
148148
"""
149149

0 commit comments

Comments
 (0)