Fast Differentiable Matrix Square Root

Yue Song, Nicu Sebe, Wei Wang
1/21/2022
cs.CVcs.LGcs.MS

No official code found. Best implementation: KingJamesSong/DifferentiableSVD (82 stars, Python, Apache-2.0, PyTorch, last commit 2023-10-20).

Abstract

Computing the matrix square root or its inverse in a differentiable manner is important in a variety of computer vision tasks. Previous methods either adopt the Singular Value Decomposition (SVD) to explicitly factorize the matrix or use the Newton-Schulz iteration (NS iteration) to derive the approximate solution.

Show full abstract

However, both methods are not computationally efficient enough in either the forward pass or in the backward pass. In this paper, we propose two more efficient variants to compute the differentiable matrix square root. For the forward propagation, one method is to use Matrix Taylor Polynomial (MTP), and the other method is to use Matrix Padé Approximants (MPA). The backward gradient is computed by iteratively solving the continuous-time Lyapunov equation using the matrix sign function. Both methods yield considerable speed-up compared with the SVD or the Newton-Schulz iteration. Experimental results on the de-correlated batch normalization and second-order vision transformer demonstrate that our methods can also achieve competitive and even slightly better performances. The code is available at \href{https://github.com/KingJamesSong/FastDifferentiableMatSqrt}{https://github.com/KingJamesSong/FastDifferentiableMatSqrt}.

View on arXivView PDF

Code Implementations(1)

PyTorchApache-2.0

A collection of differentiable SVD methods and ICCV21 "Why Approximate Matrix Square Root Outperforms Accurate SVD in Global Covariance Pooling?"

824Python, ShellJul 23, 20213 years agoApache-2.0
deep-learningdifferentiable-svdend-to-end-svdfine-grained-classificationfine-grained-visual-categorization+8 more

Similar Papers

Cite this paper

@article{song2022fast,
  title  = {Fast Differentiable Matrix Square Root},
  author = {Yue Song and Nicu Sebe and Wei Wang},
  year   = {2022},
  eprint = {2201.08663},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2201.08663}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2201.08663.svg)](https://codeofpaper.com/paper/2201.08663)

Discussion