.. autofunction:: logdet
.. autofunction:: slogdet
.. autofunction:: lu
+.. autofunction:: lu_unpack
.. autofunction:: matmul
.. autofunction:: matrix_power
.. autofunction:: matrix_rank
@skipIfRocm
@unittest.skipIf(not TEST_MAGMA, "no MAGMA library detected")
- def test_btriunpack(self):
- _TestTorchMixin._test_btriunpack(self, lambda t: t.cuda())
+ def test_lu_unpack(self):
+ _TestTorchMixin._test_lu_unpack(self, lambda t: t.cuda())
def test_dim_reduction(self):
_TestTorchMixin._test_dim_reduction(self, lambda t: t.cuda())
a_LU_info_nopiv, nopiv, info_nopiv = a.lu(pivot=False, get_infos=True)
self.assertEqual(nopiv, cast(torch.zeros(a.shape[:-1], dtype=torch.int32)))
self.assertEqual(info_, info_nopiv)
- P, L, U = torch.btriunpack(a_LU, pivots)
+ P, L, U = torch.lu_unpack(a_LU, pivots)
self.assertEqual(P.matmul(L.matmul(U)), a)
for ms, batch in product([3, 5, 7], [(), (2,), (3,), (3, 5)]):
self._test_btrisolve(self, lambda t: t)
@staticmethod
- def _test_btriunpack(self, cast):
+ def _test_lu_unpack(self, cast):
def run_test(shape, cast):
a = cast(torch.randn(*shape))
a_lu, p = torch.lu(a)
- p_ref, l_ref, u_ref = torch.btriunpack(a_lu, p)
+ p_ref, l_ref, u_ref = torch.lu_unpack(a_lu, p)
self.assertEqual(p_ref.matmul(l_ref.matmul(u_ref)), a)
run_test((3, 3), cast)
run_test((7, 5, 3, 3, 3), cast)
@skipIfNoLapack
- def test_btriunpack(self):
- self._test_btriunpack(self, lambda t: t)
+ def test_lu_unpack(self):
+ self._test_lu_unpack(self, lambda t: t)
def test_bmm(self):
num_batches = 10
self.assertEqual(ret1.V, ret[2])
# test gesv
- ret = a.gesv(a)
+ ret = a.solve(a)
self.assertEqual(ret.solution, ret[0])
self.assertEqual(ret.LU, ret[1])
- ret1 = torch.gesv(a, a, out=tuple(ret))
+ ret1 = torch.solve(a, a, out=tuple(ret))
self.assertEqual(ret1.solution, ret1[0])
self.assertEqual(ret1.LU, ret1[1])
self.assertEqual(ret1.solution, ret[0])
'isfinite',
'isinf',
'lu',
+ 'lu_unpack',
'norm',
'meshgrid',
'potrf',
return tensor.split(split_size_or_sections, dim)
-def btriunpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True):
+def lu_unpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True):
r"""Unpacks the data and pivots from a LU factorization of a tensor.
Returns a tuple of tensors as ``(the pivots, the L tensor, the U tensor)``.
>>> A = torch.randn(2, 3, 3)
>>> A_LU, pivots = A.lu()
- >>> P, A_L, A_U = torch.btriunpack(A_LU, pivots)
+ >>> P, A_L, A_U = torch.lu_unpack(A_LU, pivots)
>>>
>>> # can recover A from factorization
>>> A_ = torch.bmm(P, torch.bmm(A_L, A_U))
return lu(A, pivot=pivot, get_infos=True, out=out)
+def btriunpack(LU_data, LU_pivots, unpack_data=True, unpack_pivots=True):
+ r"""Unpacks the data and pivots from a LU factorization of a tensor.
+
+ For more information regarding :func:`torch.btriunpack`, please check :func:`torch.lu_unpack`.
+
+ .. warning::
+ :func:`torch.btriunpack` is deprecated in favour of :func:`torch.lu_unpack` and will be
+ removed in the next release. Please use :func:`torch.lu_unpack` instead.
+ """
+ warnings.warn("torch.btriunpack is deprecated in favour of torch.lu_unpack and will be "
+ "removed in the next release. Please use torch.lu_unpack instead.", stacklevel=2)
+ return lu_unpack(LU_data=LU_data, LU_pivots=LU_pivots,
+ unpack_data=unpack_data, unpack_pivots=unpack_pivots)
+
+
def lu(A, pivot=True, get_infos=False, out=None):
r"""Computes the LU factorization of a square matrix or batches of square matrices
:attr:`A`. Returns a tuple containing the LU factorization and pivots of :attr:`A`.