mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
documentation for torch.inverse
This commit is contained in:
parent
4397f709be
commit
1a03adebb4
|
|
@ -1352,6 +1352,37 @@ u,s,v = torch.svd(a)
|
|||
|
||||
</file>
|
||||
|
||||
==== torch.inverse([res,] x) ====
|
||||
{{anchor:torch.inverse}}
|
||||
|
||||
Computes the inverse of square matrix ''x''.
|
||||
|
||||
''=torch.inverse(x)'' returns the result as a new matrix.
|
||||
|
||||
''torch.inverse(y,x)'' puts the result in ''y''.
|
||||
|
||||
<file lua>
|
||||
x=torch.rand(10,10)
|
||||
y=torch.inverse(x)
|
||||
z=x*y
|
||||
print(z)
|
||||
1.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 0.0000
|
||||
0.0000 1.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000
|
||||
0.0000 -0.0000 1.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000 0.0000
|
||||
0.0000 -0.0000 -0.0000 1.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000
|
||||
0.0000 -0.0000 0.0000 -0.0000 1.0000 0.0000 0.0000 -0.0000 -0.0000 0.0000
|
||||
0.0000 -0.0000 0.0000 -0.0000 0.0000 1.0000 0.0000 -0.0000 -0.0000 0.0000
|
||||
0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 1.0000 -0.0000 0.0000 0.0000
|
||||
0.0000 -0.0000 -0.0000 -0.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000
|
||||
0.0000 -0.0000 -0.0000 -0.0000 0.0000 0.0000 -0.0000 -0.0000 1.0000 0.0000
|
||||
0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 1.0000
|
||||
[torch.DoubleTensor of dimension 10x10]
|
||||
|
||||
print('Max nonzero = ', torch.max(torch.abs(z-torch.eye(10))))
|
||||
Max nonzero = 2.3092638912203e-14
|
||||
|
||||
</file>
|
||||
|
||||
===== Logical Operations on Tensors =====
|
||||
{{anchor:torch.logical.dok}}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user