Skip to content

Commit 89c4e83

Browse files
committed
Updates docstrings
1 parent 79a3784 commit 89c4e83

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

docs/source/losses.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ Reconstruction Losses
9999
.. autoclass:: monai.losses.ssim_loss.SSIMLoss
100100
:members:
101101

102+
`PatchAdversarialLoss`
103+
~~~~~~~~~~~~~~~~~~~~~~
104+
.. autoclass:: PatchAdversarialLoss
105+
:members:
106+
107+
`PerceptualLoss`
108+
~~~~~~~~~~~~~~~~~
109+
.. autoclass:: PerceptualLoss
110+
:members:
111+
112+
`JukeboxLoss`
113+
~~~~~~~~~~~~~~
114+
.. autoclass:: JukeboxLoss
115+
:members:
116+
102117

103118
Loss Wrappers
104119
-------------

monai/losses/adversarial_loss.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ class PatchAdversarialLoss(_Loss):
3434
mustn't be passed to a final activation layer. That is taken care of internally within the loss.
3535
3636
Args:
37-
reduction: {``"none"``, ``"mean"``, ``"sum"``} Specifies the reduction to apply to the output.
38-
Defaults to ``"mean"``.
39-
- ``"none"``: no reduction will be applied.
40-
- ``"mean"``: the sum of the output will be divided by the number of elements in the output.
41-
- ``"sum"``: the output will be summed.
37+
reduction: {``"none"``, ``"mean"``, ``"sum"``}
38+
Specifies the reduction to apply to the output. Defaults to ``"mean"``.
39+
40+
- ``"none"``: no reduction will be applied.
41+
- ``"mean"``: the sum of the output will be divided by the number of elements in the output.
42+
- ``"sum"``: the output will be summed.
43+
4244
criterion: which criterion (hinge, least_squares or bce) you want to use on the discriminators outputs.
43-
Depending on the criterion, a different activation layer will be used. Make sure you don't run the outputs
44-
through an activation layer prior to calling the loss.
45+
Depending on the criterion, a different activation layer will be used. Make sure you don't run the outputs
46+
through an activation layer prior to calling the loss.
4547
no_activation_leastsq: if True, the activation layer in the case of least-squares is removed.
4648
"""
4749

@@ -112,14 +114,14 @@ def forward(
112114
"""
113115
114116
Args:
115-
input: output of Multi-Scale Patch Discriminator or Patch Discriminator; being a list of
116-
tensors or a tensor; they shouldn't have gone through an activation layer.
117+
input: output of Multi-Scale Patch Discriminator or Patch Discriminator; being a list of tensors
118+
or a tensor; they shouldn't have gone through an activation layer.
117119
target_is_real: whereas the input corresponds to discriminator output for real or fake images
118120
for_discriminator: whereas this is being calculated for discriminator or generator loss. In the last
119-
case, target_is_real is set to True, as the generator wants the input to be dimmed as real.
121+
case, target_is_real is set to True, as the generator wants the input to be dimmed as real.
120122
Returns: if reduction is None, returns a list with the loss tensors of each discriminator if multi-scale
121-
discriminator is active, or the loss tensor if there is just one discriminator. Otherwise, it returns the
122-
summed or mean loss over the tensor and discriminator/s.
123+
discriminator is active, or the loss tensor if there is just one discriminator. Otherwise, it returns the
124+
summed or mean loss over the tensor and discriminator/s.
123125
124126
"""
125127

monai/losses/spectral_loss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class JukeboxLoss(_Loss):
2424
Calculate spectral component based on the magnitude of Fast Fourier Transform (FFT).
2525
2626
Based on:
27-
Dhariwal, et al. 'Jukebox: A generative model for music.'https://arxiv.org/abs/2005.00341
27+
Dhariwal, et al. 'Jukebox: A generative model for music.' https://arxiv.org/abs/2005.00341
2828
2929
Args:
3030
spatial_dims: number of spatial dimensions.

0 commit comments

Comments
 (0)