Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8351f902
提交
8351f902
authored
11月 07, 2023
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
11月 11, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename test Op to not confuse pytest
上级
9cf2d181
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
test_blockwise.py
tests/tensor/test_blockwise.py
+10
-10
没有找到文件。
tests/tensor/test_blockwise.py
浏览文件 @
8351f902
...
@@ -88,7 +88,7 @@ def test_runtime_broadcast(mode):
...
@@ -88,7 +88,7 @@ def test_runtime_broadcast(mode):
check_blockwise_runtime_broadcasting
(
mode
)
check_blockwise_runtime_broadcasting
(
mode
)
class
TestOp
(
Op
):
class
My
TestOp
(
Op
):
def
make_node
(
self
,
*
inputs
):
def
make_node
(
self
,
*
inputs
):
return
Apply
(
self
,
inputs
,
[
i
.
type
()
for
i
in
inputs
])
return
Apply
(
self
,
inputs
,
[
i
.
type
()
for
i
in
inputs
])
...
@@ -96,7 +96,7 @@ class TestOp(Op):
...
@@ -96,7 +96,7 @@ class TestOp(Op):
raise
NotImplementedError
(
"Test Op should not be present in final graph"
)
raise
NotImplementedError
(
"Test Op should not be present in final graph"
)
test_op
=
TestOp
()
test_op
=
My
TestOp
()
def
test_vectorize_node_default_signature
():
def
test_vectorize_node_default_signature
():
...
@@ -106,12 +106,12 @@ def test_vectorize_node_default_signature():
...
@@ -106,12 +106,12 @@ def test_vectorize_node_default_signature():
vect_node
=
vectorize_node
(
node
,
mat
,
mat
)
vect_node
=
vectorize_node
(
node
,
mat
,
mat
)
assert
isinstance
(
vect_node
.
op
,
Blockwise
)
and
isinstance
(
assert
isinstance
(
vect_node
.
op
,
Blockwise
)
and
isinstance
(
vect_node
.
op
.
core_op
,
TestOp
vect_node
.
op
.
core_op
,
My
TestOp
)
)
assert
vect_node
.
op
.
signature
==
(
"(i00),(i10,i11)->(o00),(o10,o11)"
)
assert
vect_node
.
op
.
signature
==
(
"(i00),(i10,i11)->(o00),(o10,o11)"
)
with
pytest
.
raises
(
with
pytest
.
raises
(
ValueError
,
match
=
"Signature not provided nor found in core_op TestOp"
ValueError
,
match
=
"Signature not provided nor found in core_op
My
TestOp"
):
):
Blockwise
(
test_op
)
Blockwise
(
test_op
)
...
@@ -138,7 +138,7 @@ def test_blockwise_shape():
...
@@ -138,7 +138,7 @@ def test_blockwise_shape():
shape_fn
=
pytensor
.
function
([
inp
],
out
.
shape
)
shape_fn
=
pytensor
.
function
([
inp
],
out
.
shape
)
assert
not
any
(
assert
not
any
(
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
TestOp
)
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
My
TestOp
)
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
)
)
assert
tuple
(
shape_fn
(
inp_test
))
==
(
5
,
3
,
4
)
assert
tuple
(
shape_fn
(
inp_test
))
==
(
5
,
3
,
4
)
...
@@ -150,13 +150,13 @@ def test_blockwise_shape():
...
@@ -150,13 +150,13 @@ def test_blockwise_shape():
shape_fn
=
pytensor
.
function
([
inp
],
out
.
shape
)
shape_fn
=
pytensor
.
function
([
inp
],
out
.
shape
)
assert
any
(
assert
any
(
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
TestOp
)
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
My
TestOp
)
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
)
)
shape_fn
=
pytensor
.
function
([
inp
],
out
.
shape
[:
-
1
])
shape_fn
=
pytensor
.
function
([
inp
],
out
.
shape
[:
-
1
])
assert
not
any
(
assert
not
any
(
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
TestOp
)
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
My
TestOp
)
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
)
)
assert
tuple
(
shape_fn
(
inp_test
))
==
(
5
,
4
)
assert
tuple
(
shape_fn
(
inp_test
))
==
(
5
,
4
)
...
@@ -174,20 +174,20 @@ def test_blockwise_shape():
...
@@ -174,20 +174,20 @@ def test_blockwise_shape():
shape_fn
=
pytensor
.
function
([
inp1
,
inp2
],
[
out
.
shape
for
out
in
outs
])
shape_fn
=
pytensor
.
function
([
inp1
,
inp2
],
[
out
.
shape
for
out
in
outs
])
assert
any
(
assert
any
(
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
TestOp
)
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
My
TestOp
)
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
)
)
shape_fn
=
pytensor
.
function
([
inp1
,
inp2
],
outs
[
0
]
.
shape
)
shape_fn
=
pytensor
.
function
([
inp1
,
inp2
],
outs
[
0
]
.
shape
)
assert
not
any
(
assert
not
any
(
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
TestOp
)
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
My
TestOp
)
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
)
)
assert
tuple
(
shape_fn
(
inp1_test
,
inp2_test
))
==
(
7
,
5
,
3
,
4
)
assert
tuple
(
shape_fn
(
inp1_test
,
inp2_test
))
==
(
7
,
5
,
3
,
4
)
shape_fn
=
pytensor
.
function
([
inp1
,
inp2
],
[
outs
[
0
]
.
shape
,
outs
[
1
]
.
shape
[:
-
1
]])
shape_fn
=
pytensor
.
function
([
inp1
,
inp2
],
[
outs
[
0
]
.
shape
,
outs
[
1
]
.
shape
[:
-
1
]])
assert
not
any
(
assert
not
any
(
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
TestOp
)
isinstance
(
getattr
(
n
.
op
,
"core_op"
,
n
.
op
),
My
TestOp
)
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
for
n
in
shape_fn
.
maker
.
fgraph
.
apply_nodes
)
)
assert
tuple
(
shape_fn
(
inp1_test
,
inp2_test
)[
0
])
==
(
7
,
5
,
3
,
4
)
assert
tuple
(
shape_fn
(
inp1_test
,
inp2_test
)[
0
])
==
(
7
,
5
,
3
,
4
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论