Fix broken rst of torch.nn.utils.spectral_norm and others (#15995)
authorDerek Kim <bluewhale8202@gmail.com>
Mon, 14 Jan 2019 15:28:58 +0000 (07:28 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 14 Jan 2019 15:35:36 +0000 (07:35 -0800)
Summary:
- Currently, the [rst](https://pytorch.org/docs/stable/nn.html#torch.nn.utils.spectral_norm) looks broken, at least in my browser. So I fixed it.
- I thought a subscript may be needed to the left W in the definition.
- A few typos fixed.

crcrpar
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15995

Differential Revision: D13649888

Pulled By: soumith

fbshipit-source-id: 00a2c3b043c7c8ebdd9fc2bf77ba27ae695fee3f

torch/nn/utils/spectral_norm.py

index ceb6946..ed9a93d 100644 (file)
@@ -192,11 +192,11 @@ def spectral_norm(module, name='weight', n_power_iterations=1, eps=1e-12, dim=No
     r"""Applies spectral normalization to a parameter in the given module.
 
     .. math::
-         \mathbf{W} = \dfrac{\mathbf{W}}{\sigma(\mathbf{W})} \\
-         \sigma(\mathbf{W}) = \max_{\mathbf{h}: \mathbf{h} \ne 0} \dfrac{\|\mathbf{W} \mathbf{h}\|_2}{\|\mathbf{h}\|_2}
+        \mathbf{W}_{SN} = \dfrac{\mathbf{W}}{\sigma(\mathbf{W})},
+        \sigma(\mathbf{W}) = \max_{\mathbf{h}: \mathbf{h} \ne 0} \dfrac{\|\mathbf{W} \mathbf{h}\|_2}{\|\mathbf{h}\|_2}
 
     Spectral normalization stabilizes the training of discriminators (critics)
-    in Generaive Adversarial Networks (GANs) by rescaling the weight tensor
+    in Generative Adversarial Networks (GANs) by rescaling the weight tensor
     with spectral norm :math:`\sigma` of the weight matrix calculated using
     power iteration method. If the dimension of the weight tensor is greater
     than 2, it is reshaped to 2D in power iteration method to get spectral
@@ -211,7 +211,7 @@ def spectral_norm(module, name='weight', n_power_iterations=1, eps=1e-12, dim=No
         module (nn.Module): containing module
         name (str, optional): name of weight parameter
         n_power_iterations (int, optional): number of power iterations to
-            calculate spectal norm
+            calculate spectral norm
         eps (float, optional): epsilon for numerical stability in
             calculating norms
         dim (int, optional): dimension corresponding to number of outputs,
@@ -219,7 +219,7 @@ def spectral_norm(module, name='weight', n_power_iterations=1, eps=1e-12, dim=No
             ConvTranspose1/2/3d, when it is 1
 
     Returns:
-        The original module with the spectal norm hook
+        The original module with the spectral norm hook
 
     Example::