Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b6804245
提交
b6804245
authored
11月 13, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up FunctionGraph str and repr implementation
上级
55ca059a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
test_destroyhandler.py
tests/gof/test_destroyhandler.py
+7
-4
test_opt.py
tests/gof/test_opt.py
+0
-0
test_basic.py
tests/scalar/test_basic.py
+2
-2
test_opt.py
tests/tensor/test_opt.py
+0
-0
fg.py
theano/gof/fg.py
+1
-4
没有找到文件。
tests/gof/test_destroyhandler.py
浏览文件 @
b6804245
...
@@ -144,12 +144,12 @@ def test_misc():
...
@@ -144,12 +144,12 @@ def test_misc():
g
=
Env
([
x
,
y
,
z
],
[
e
])
g
=
Env
([
x
,
y
,
z
],
[
e
])
assert
g
.
consistent
()
assert
g
.
consistent
()
PatternOptimizer
((
transpose_view
,
(
transpose_view
,
"x"
)),
"x"
)
.
optimize
(
g
)
PatternOptimizer
((
transpose_view
,
(
transpose_view
,
"x"
)),
"x"
)
.
optimize
(
g
)
assert
str
(
g
)
==
"
[x]
"
assert
str
(
g
)
==
"
FunctionGraph(x)
"
new_e
=
add
(
x
,
y
)
new_e
=
add
(
x
,
y
)
g
.
replace_validate
(
x
,
new_e
)
g
.
replace_validate
(
x
,
new_e
)
assert
str
(
g
)
==
"
[Add(x, y)]
"
assert
str
(
g
)
==
"
FunctionGraph(Add(x, y))
"
g
.
replace
(
new_e
,
dot
(
add_in_place
(
x
,
y
),
transpose_view
(
x
)))
g
.
replace
(
new_e
,
dot
(
add_in_place
(
x
,
y
),
transpose_view
(
x
)))
assert
str
(
g
)
==
"
[Dot(AddInPlace(x, y), TransposeView(x))]
"
assert
str
(
g
)
==
"
FunctionGraph(Dot(AddInPlace(x, y), TransposeView(x)))
"
assert
not
g
.
consistent
()
assert
not
g
.
consistent
()
...
@@ -325,7 +325,10 @@ def test_long_destroyers_loop():
...
@@ -325,7 +325,10 @@ def test_long_destroyers_loop():
OpSubOptimizer
(
add
,
add_in_place
)
.
optimize
(
g
)
OpSubOptimizer
(
add
,
add_in_place
)
.
optimize
(
g
)
assert
g
.
consistent
()
assert
g
.
consistent
()
# we don't want to see that!
# we don't want to see that!
assert
str
(
g
)
!=
"[Dot(Dot(AddInPlace(x, y), AddInPlace(y, z)), AddInPlace(z, x))]"
assert
(
str
(
g
)
!=
"FunctionGraph(Dot(Dot(AddInPlace(x, y), AddInPlace(y, z)), AddInPlace(z, x)))"
)
e2
=
dot
(
dot
(
add_in_place
(
x
,
y
),
add_in_place
(
y
,
z
)),
add_in_place
(
z
,
x
))
e2
=
dot
(
dot
(
add_in_place
(
x
,
y
),
add_in_place
(
y
,
z
)),
add_in_place
(
z
,
x
))
with
pytest
.
raises
(
InconsistencyError
):
with
pytest
.
raises
(
InconsistencyError
):
Env
(
*
graph
.
clone
([
x
,
y
,
z
],
[
e2
]))
Env
(
*
graph
.
clone
([
x
,
y
,
z
],
[
e2
]))
...
...
tests/gof/test_opt.py
浏览文件 @
b6804245
差异被折叠。
点击展开。
tests/scalar/test_basic.py
浏览文件 @
b6804245
...
@@ -173,12 +173,12 @@ class TestComposite:
...
@@ -173,12 +173,12 @@ class TestComposite:
gof
.
DualLinker
()
.
accept
(
g
)
.
make_function
()
gof
.
DualLinker
()
.
accept
(
g
)
.
make_function
()
assert
str
(
g
)
==
(
assert
str
(
g
)
==
(
"
[
*1 -> Composite{((i0 + i1) + i2),"
"
FunctionGraph(
*1 -> Composite{((i0 + i1) + i2),"
" (i0 + (i1 * i2)), (i0 / i1), "
" (i0 + (i1 * i2)), (i0 / i1), "
"(i0 // Constant{5}), "
"(i0 // Constant{5}), "
"(-i0), (i0 - i1), ((i0 ** i1) + (-i2)),"
"(-i0), (i0 - i1), ((i0 ** i1) + (-i2)),"
" (i0
%
Constant{3})}(x, y, z), "
" (i0
%
Constant{3})}(x, y, z), "
"*1::1, *1::2, *1::3, *1::4, *1::5, *1::6, *1::7
]
"
"*1::1, *1::2, *1::3, *1::4, *1::5, *1::6, *1::7
)
"
)
)
def
test_make_node_continue_graph
(
self
):
def
test_make_node_continue_graph
(
self
):
...
...
tests/tensor/test_opt.py
浏览文件 @
b6804245
差异被折叠。
点击展开。
theano/gof/fg.py
浏览文件 @
b6804245
...
@@ -812,11 +812,8 @@ class FunctionGraph(utils.object2):
...
@@ -812,11 +812,8 @@ class FunctionGraph(utils.object2):
"Inconsistent clients list."
,
variable
,
node
.
inputs
[
i
]
"Inconsistent clients list."
,
variable
,
node
.
inputs
[
i
]
)
)
def
__str__
(
self
):
return
f
"[{', '.join(graph.as_string(self.inputs, self.outputs))}]"
def
__repr__
(
self
):
def
__repr__
(
self
):
return
self
.
__str__
()
return
f
"FunctionGraph({', '.join(graph.as_string(self.inputs, self.outputs))})"
def
clone
(
self
,
check_integrity
=
True
):
def
clone
(
self
,
check_integrity
=
True
):
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论