Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8616d398
提交
8616d398
authored
7月 19, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
8月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename aesara.sparse.opt to aesara.sparse.rewriting
上级
f5af3cb4
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
14 行增加
和
11 行删除
+14
-11
__init__.py
aesara/sparse/__init__.py
+1
-1
opt.py
aesara/sparse/opt.py
+0
-0
rewriting.py
aesara/sparse/rewriting.py
+0
-0
test_basic.py
tests/sparse/test_basic.py
+7
-2
test_rewriting.py
tests/sparse/test_rewriting.py
+6
-8
没有找到文件。
aesara/sparse/__init__.py
浏览文件 @
8616d398
...
...
@@ -13,7 +13,7 @@ from aesara.sparse.type import SparseTensorType, _is_sparse
if
enable_sparse
:
from
aesara.sparse
import
opt
,
sharedvar
from
aesara.sparse
import
rewriting
,
sharedvar
from
aesara.sparse.basic
import
*
from
aesara.sparse.sharedvar
import
sparse_constructor
as
shared
...
...
aesara/sparse/opt.py
浏览文件 @
8616d398
差异被折叠。
点击展开。
aesara/sparse/rewriting.py
0 → 100644
浏览文件 @
8616d398
差异被折叠。
点击展开。
tests/sparse/test_basic.py
浏览文件 @
8616d398
...
...
@@ -84,7 +84,12 @@ from aesara.sparse.basic import (
_is_sparse_variable
,
_mtypes
,
)
from
aesara.sparse.opt
import
CSMGradC
,
StructuredDotCSC
,
UsmmCscDense
from
aesara.sparse.rewriting
import
(
AddSD_ccode
,
CSMGradC
,
StructuredDotCSC
,
UsmmCscDense
,
)
from
aesara.tensor.basic
import
MakeVector
from
aesara.tensor.elemwise
import
DimShuffle
,
Elemwise
from
aesara.tensor.math
import
sum
as
at_sum
...
...
@@ -491,7 +496,7 @@ class TestSparseInferShape(utt.InferShapeTester):
sp
.
sparse
.
csr_matrix
(
random_lil
((
10
,
40
),
config
.
floatX
,
3
)),
np
.
random
.
standard_normal
((
10
,
40
))
.
astype
(
config
.
floatX
),
],
(
AddSD
,
sparse
.
opt
.
AddSD_ccode
),
(
AddSD
,
AddSD_ccode
),
)
def
test_mul_ss
(
self
):
...
...
tests/sparse/test_
opt
.py
→
tests/sparse/test_
rewriting
.py
浏览文件 @
8616d398
import
pytest
sp
=
pytest
.
importorskip
(
"scipy"
,
minversion
=
"0.7.0"
)
import
numpy
as
np
import
pytest
import
scipy
as
sp
import
aesara
from
aesara
import
sparse
from
aesara.compile.mode
import
Mode
,
get_default_mode
from
aesara.configdefaults
import
config
from
aesara.sparse.rewriting
import
SamplingDotCSR
,
sd_csc
from
aesara.tensor.basic
import
as_tensor_variable
from
aesara.tensor.math
import
sum
as
at_sum
from
aesara.tensor.type
import
ivector
,
matrix
,
vector
...
...
@@ -38,7 +36,7 @@ def test_local_csm_properties_csm():
f
(
v
.
data
,
v
.
indices
,
v
.
indptr
,
v
.
shape
)
@pytest.mark.skip
(
reason
=
"
Opt
disabled as it don't support unsorted indices"
)
@pytest.mark.skip
(
reason
=
"
Rewrite
disabled as it don't support unsorted indices"
)
@pytest.mark.skipif
(
not
aesara
.
config
.
cxx
,
reason
=
"G++ not available, so we need to skip this test."
)
...
...
@@ -143,7 +141,7 @@ def test_local_sampling_dot_csr():
# SamplingDotCSR's C implementation needs blas, so it should not
# be inserted
assert
not
any
(
isinstance
(
node
.
op
,
sparse
.
opt
.
SamplingDotCSR
)
isinstance
(
node
.
op
,
SamplingDotCSR
)
for
node
in
f
.
maker
.
fgraph
.
toposort
()
)
...
...
@@ -174,6 +172,6 @@ def test_sd_csc():
nrows
=
as_tensor_variable
(
np
.
int32
(
A
.
shape
[
0
]))
b
=
as_tensor_variable
(
b
)
res
=
aesara
.
sparse
.
opt
.
sd_csc
(
a_val
,
a_ind
,
a_ptr
,
nrows
,
b
)
.
eval
()
res
=
sd_csc
(
a_val
,
a_ind
,
a_ptr
,
nrows
,
b
)
.
eval
()
utt
.
assert_allclose
(
res
,
target
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论