3737# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3838# SOFTWARE.
3939#
40+ """Jacobian Regularization for CEBRA.
41+
42+ This implementation is adapted from the Jacobian regularization described in [1]_.
43+
44+ .. [1] Judy Hoffman, Daniel A. Roberts, and Sho Yaida,
45+ "Robust Learning with Jacobian Regularization," 2019.
46+ `arxiv:1908.02729 <https://arxiv.org/abs/1908.02729>`_
47+ """
4048
4149from __future__ import division
4250
@@ -52,12 +60,6 @@ class JacobianReg(nn.Module):
5260 of the output space and projection is non-random and orthonormal, yielding the exact
5361 result. For any reasonable batch size, the default (n=1) should be sufficient.
5462 |Default:| ``1``
55-
56- Note:
57- This implementation is adapted from the Jacobian regularization described in [1].
58- [1] Judy Hoffman, Daniel A. Roberts, and Sho Yaida,
59- "Robust Learning with Jacobian Regularization," 2019.
60- [arxiv:1908.02729](https://arxiv.org/abs/1908.02729)
6163 """
6264
6365 def __init__ (self , n : int = 1 ):
@@ -66,7 +68,7 @@ def __init__(self, n: int = 1):
6668 super (JacobianReg , self ).__init__ ()
6769
6870 def forward (self , x : torch .Tensor , y : torch .Tensor ) -> torch .Tensor :
69- """Computes (1/2) tr |dy/dx|^2.
71+ """Computes (1/2) tr \\ |dy/dx\\ |^2.
7072
7173 Args:
7274 x: Input tensor
0 commit comments