提交 ffa88a6b authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Rename aesara.tensor.nlinalg.lstsq class to Lstsq and create Op instance

上级 86282bdd
......@@ -591,7 +591,7 @@ def svd(a, full_matrices=1, compute_uv=1):
return SVD(full_matrices, compute_uv)(a)
class lstsq(Op):
class Lstsq(Op):
__props__ = ()
......@@ -618,6 +618,9 @@ class lstsq(Op):
outputs[3][0] = zz[3]
lstsq = Lstsq()
def matrix_power(M, n):
r"""Raise a square matrix, ``M``, to the (integer) power ``n``.
......
......@@ -16,6 +16,7 @@ from aesara.tensor.nlinalg import (
det,
eig,
eigh,
lstsq,
matrix_dot,
matrix_inverse,
matrix_power,
......@@ -372,7 +373,7 @@ class TestLstsq:
x = lmatrix()
y = lmatrix()
z = lscalar()
b = aesara.tensor.nlinalg.lstsq()(x, y, z)
b = lstsq(x, y, z)
f = function([x, y, z], b)
TestMatrix1 = np.asarray([[2, 1], [3, 4]])
TestMatrix2 = np.asarray([[17, 20], [43, 50]])
......@@ -385,7 +386,7 @@ class TestLstsq:
x = vector()
y = vector()
z = scalar()
b = aesara.tensor.nlinalg.lstsq()(x, y, z)
b = lstsq(x, y, z)
f = function([x, y, z], b)
with pytest.raises(np.linalg.linalg.LinAlgError):
f([2, 1], [2, 1], 1)
......@@ -394,7 +395,7 @@ class TestLstsq:
x = vector()
y = vector()
z = vector()
b = aesara.tensor.nlinalg.lstsq()(x, y, z)
b = lstsq(x, y, z)
f = function([x, y, z], b)
with pytest.raises(np.linalg.LinAlgError):
f([2, 1], [2, 1], [2, 1])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论