Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d6f0185b
提交
d6f0185b
authored
6月 21, 2023
作者:
Ricardo Vieira
提交者:
Thomas Wiecki
9月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove duplicated `Inv` Op
上级
1492d3f7
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
1 行增加
和
53 行删除
+1
-53
nlinalg.py
pytensor/link/numba/dispatch/nlinalg.py
+0
-13
nlinalg.py
pytensor/tensor/nlinalg.py
+1
-20
test_nlinalg.py
tests/link/numba/test_nlinalg.py
+0
-20
没有找到文件。
pytensor/link/numba/dispatch/nlinalg.py
浏览文件 @
d6f0185b
...
@@ -14,7 +14,6 @@ from pytensor.tensor.nlinalg import (
...
@@ -14,7 +14,6 @@ from pytensor.tensor.nlinalg import (
Det
,
Det
,
Eig
,
Eig
,
Eigh
,
Eigh
,
Inv
,
MatrixInverse
,
MatrixInverse
,
MatrixPinv
,
MatrixPinv
,
QRFull
,
QRFull
,
...
@@ -125,18 +124,6 @@ def numba_funcify_Eigh(op, node, **kwargs):
...
@@ -125,18 +124,6 @@ def numba_funcify_Eigh(op, node, **kwargs):
return
eigh
return
eigh
@numba_funcify.register
(
Inv
)
def
numba_funcify_Inv
(
op
,
node
,
**
kwargs
):
out_dtype
=
node
.
outputs
[
0
]
.
type
.
numpy_dtype
inputs_cast
=
int_to_float_fn
(
node
.
inputs
,
out_dtype
)
@numba_basic.numba_njit
(
inline
=
"always"
)
def
inv
(
x
):
return
np
.
linalg
.
inv
(
inputs_cast
(
x
))
.
astype
(
out_dtype
)
return
inv
@numba_funcify.register
(
MatrixInverse
)
@numba_funcify.register
(
MatrixInverse
)
def
numba_funcify_MatrixInverse
(
op
,
node
,
**
kwargs
):
def
numba_funcify_MatrixInverse
(
op
,
node
,
**
kwargs
):
out_dtype
=
node
.
outputs
[
0
]
.
type
.
numpy_dtype
out_dtype
=
node
.
outputs
[
0
]
.
type
.
numpy_dtype
...
...
pytensor/tensor/nlinalg.py
浏览文件 @
d6f0185b
...
@@ -78,25 +78,6 @@ def pinv(x, hermitian=False):
...
@@ -78,25 +78,6 @@ def pinv(x, hermitian=False):
return
MatrixPinv
(
hermitian
=
hermitian
)(
x
)
return
MatrixPinv
(
hermitian
=
hermitian
)(
x
)
class
Inv
(
Op
):
"""Computes the inverse of one or more matrices."""
def
make_node
(
self
,
x
):
x
=
as_tensor_variable
(
x
)
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
def
perform
(
self
,
node
,
inputs
,
outputs
):
(
x
,)
=
inputs
(
z
,)
=
outputs
z
[
0
]
=
np
.
linalg
.
inv
(
x
)
.
astype
(
x
.
dtype
)
def
infer_shape
(
self
,
fgraph
,
node
,
shapes
):
return
shapes
inv
=
Inv
()
class
MatrixInverse
(
Op
):
class
MatrixInverse
(
Op
):
r"""Computes the inverse of a matrix :math:`A`.
r"""Computes the inverse of a matrix :math:`A`.
...
@@ -169,7 +150,7 @@ class MatrixInverse(Op):
...
@@ -169,7 +150,7 @@ class MatrixInverse(Op):
return
shapes
return
shapes
matrix_inverse
=
MatrixInverse
()
inv
=
matrix_inverse
=
MatrixInverse
()
def
matrix_dot
(
*
args
):
def
matrix_dot
(
*
args
):
...
...
tests/link/numba/test_nlinalg.py
浏览文件 @
d6f0185b
...
@@ -352,26 +352,6 @@ def test_Eigh(x, uplo, exc):
...
@@ -352,26 +352,6 @@ def test_Eigh(x, uplo, exc):
None
,
None
,
(),
(),
),
),
(
nlinalg
.
Inv
,
set_test_value
(
at
.
dmatrix
(),
(
lambda
x
:
x
.
T
.
dot
(
x
))(
rng
.
random
(
size
=
(
3
,
3
))
.
astype
(
"float64"
)),
),
None
,
(),
),
(
nlinalg
.
Inv
,
set_test_value
(
at
.
lmatrix
(),
(
lambda
x
:
x
.
T
.
dot
(
x
))(
rng
.
integers
(
1
,
10
,
size
=
(
3
,
3
))
.
astype
(
"int64"
)
),
),
None
,
(),
),
(
(
nlinalg
.
MatrixPinv
,
nlinalg
.
MatrixPinv
,
set_test_value
(
set_test_value
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论