Computes a matrix norm.
Support input of float, double, cfloat and cdouble dtypes. Also supports batches of matrices: the norm will be computed over the dimensions specified by the 2-tuple dim
and the other dimensions will be treated as batch dimensions. The output will have the same batch dimensions.
where inf refers to float(‘inf’), NumPy’s inf object, or any equivalent object.
>>> from torch import linalg as LA >>> A = torch.arange(9, dtype=torch.float).reshape(3, 3) >>> A tensor([[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]]) >>> LA.matrix_norm(A) tensor(14.2829) >>> LA.matrix_norm(A, ord=-1) tensor(9.) >>> B = A.expand(2, -1, -1) >>> B tensor([[[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]], [[0., 1., 2.], [3., 4., 5.], [6., 7., 8.]]]) >>> LA.matrix_norm(B) tensor([14.2829, 14.2829]) >>> LA.matrix_norm(B, dim=(0, 2)) tensor([ 3.1623, 10.0000, 17.2627])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4