Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7736732d
提交
7736732d
authored
1月 19, 2021
作者:
Brandon T. Willard
提交者:
Thomas Wiecki
1月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Print type name in theano.graph.basic.__str__
上级
808136d7
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
40 行增加
和
40 行删除
+40
-40
test_basic.py
tests/scalar/test_basic.py
+2
-2
test_printing.py
tests/test_printing.py
+37
-37
basic.py
theano/graph/basic.py
+1
-1
没有找到文件。
tests/scalar/test_basic.py
浏览文件 @
7736732d
...
@@ -176,9 +176,9 @@ class TestComposite:
...
@@ -176,9 +176,9 @@ class TestComposite:
assert
str
(
g
)
==
(
assert
str
(
g
)
==
(
"FunctionGraph(*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 //
Scalar
Constant{5}), "
"(-i0), (i0 - i1), ((i0 ** i1) + (-i2)),"
"(-i0), (i0 - i1), ((i0 ** i1) + (-i2)),"
" (i0
%
Constant{3})}(x, y, z), "
" (i0
%
Scalar
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)"
)
)
...
...
tests/test_printing.py
浏览文件 @
7736732d
...
@@ -284,17 +284,17 @@ def test_scan_debugprint1():
...
@@ -284,17 +284,17 @@ def test_scan_debugprint1():
| | | | | | |A [id M]
| | | | | | |A [id M]
| | | | | | |InplaceDimShuffle{x} [id N] ''
| | | | | | |InplaceDimShuffle{x} [id N] ''
| | | | | | |TensorConstant{1.0} [id O]
| | | | | | |TensorConstant{1.0} [id O]
| | | | | |Constant{0} [id P]
| | | | | |
Scalar
Constant{0} [id P]
| | | | |Subtensor{int64} [id Q] ''
| | | | |Subtensor{int64} [id Q] ''
| | | | |Shape [id R] ''
| | | | |Shape [id R] ''
| | | | | |Rebroadcast{0} [id J] ''
| | | | | |Rebroadcast{0} [id J] ''
| | | | |Constant{1} [id S]
| | | | |
Scalar
Constant{1} [id S]
| | | |Rebroadcast{0} [id J] ''
| | | |Rebroadcast{0} [id J] ''
| | | |ScalarFromTensor [id T] ''
| | | |ScalarFromTensor [id T] ''
| | | |Subtensor{int64} [id H] ''
| | | |Subtensor{int64} [id H] ''
| | |A [id M]
| | |A [id M]
| |Constant{1} [id U]
| |
Scalar
Constant{1} [id U]
|Constant{-1} [id V]
|
Scalar
Constant{-1} [id V]
Inner graphs of the scan ops:
Inner graphs of the scan ops:
...
@@ -334,8 +334,8 @@ def test_scan_debugprint2():
...
@@ -334,8 +334,8 @@ def test_scan_debugprint2():
| | |Shape [id E] ''
| | |Shape [id E] ''
| | | |Subtensor{int64::} [id F] 'coefficients[0:]'
| | | |Subtensor{int64::} [id F] 'coefficients[0:]'
| | | |coefficients [id G]
| | | |coefficients [id G]
| | | |Constant{0} [id H]
| | | |
Scalar
Constant{0} [id H]
| | |Constant{0} [id I]
| | |
Scalar
Constant{0} [id I]
| |Subtensor{int64} [id J] ''
| |Subtensor{int64} [id J] ''
| |Shape [id K] ''
| |Shape [id K] ''
| | |Subtensor{int64::} [id L] ''
| | |Subtensor{int64::} [id L] ''
...
@@ -343,8 +343,8 @@ def test_scan_debugprint2():
...
@@ -343,8 +343,8 @@ def test_scan_debugprint2():
| | | |TensorConstant{0} [id N]
| | | |TensorConstant{0} [id N]
| | | |TensorConstant{10000} [id O]
| | | |TensorConstant{10000} [id O]
| | | |TensorConstant{1} [id P]
| | | |TensorConstant{1} [id P]
| | |Constant{0} [id Q]
| | |
Scalar
Constant{0} [id Q]
| |Constant{0} [id R]
| |
Scalar
Constant{0} [id R]
|Subtensor{:int64:} [id S] ''
|Subtensor{:int64:} [id S] ''
| |Subtensor{int64::} [id F] 'coefficients[0:]'
| |Subtensor{int64::} [id F] 'coefficients[0:]'
| |ScalarFromTensor [id T] ''
| |ScalarFromTensor [id T] ''
...
@@ -413,8 +413,8 @@ def test_scan_debugprint3():
...
@@ -413,8 +413,8 @@ def test_scan_debugprint3():
| | |Shape [id E] ''
| | |Shape [id E] ''
| | | |Subtensor{int64::} [id F] 'coefficients[0:]'
| | | |Subtensor{int64::} [id F] 'coefficients[0:]'
| | | |coefficients [id G]
| | | |coefficients [id G]
| | | |Constant{0} [id H]
| | | |
Scalar
Constant{0} [id H]
| | |Constant{0} [id I]
| | |
Scalar
Constant{0} [id I]
| |Subtensor{int64} [id J] ''
| |Subtensor{int64} [id J] ''
| |Shape [id K] ''
| |Shape [id K] ''
| | |Subtensor{int64::} [id L] ''
| | |Subtensor{int64::} [id L] ''
...
@@ -422,8 +422,8 @@ def test_scan_debugprint3():
...
@@ -422,8 +422,8 @@ def test_scan_debugprint3():
| | | |TensorConstant{0} [id N]
| | | |TensorConstant{0} [id N]
| | | |TensorConstant{10} [id O]
| | | |TensorConstant{10} [id O]
| | | |TensorConstant{1} [id P]
| | | |TensorConstant{1} [id P]
| | |Constant{0} [id Q]
| | |
Scalar
Constant{0} [id Q]
| |Constant{0} [id R]
| |
Scalar
Constant{0} [id R]
|Subtensor{:int64:} [id S] ''
|Subtensor{:int64:} [id S] ''
| |Subtensor{int64::} [id F] 'coefficients[0:]'
| |Subtensor{int64::} [id F] 'coefficients[0:]'
| |ScalarFromTensor [id T] ''
| |ScalarFromTensor [id T] ''
...
@@ -459,17 +459,17 @@ def test_scan_debugprint3():
...
@@ -459,17 +459,17 @@ def test_scan_debugprint3():
> | | | | | | | |A_copy [id BO] -> [id W]
> | | | | | | | |A_copy [id BO] -> [id W]
> | | | | | | | |InplaceDimShuffle{x} [id BP] ''
> | | | | | | | |InplaceDimShuffle{x} [id BP] ''
> | | | | | | | |TensorConstant{1.0} [id BQ]
> | | | | | | | |TensorConstant{1.0} [id BQ]
> | | | | | | |Constant{0} [id BR]
> | | | | | | |
Scalar
Constant{0} [id BR]
> | | | | | |Subtensor{int64} [id BS] ''
> | | | | | |Subtensor{int64} [id BS] ''
> | | | | | |Shape [id BT] ''
> | | | | | |Shape [id BT] ''
> | | | | | | |Rebroadcast{0} [id BL] ''
> | | | | | | |Rebroadcast{0} [id BL] ''
> | | | | | |Constant{1} [id BU]
> | | | | | |
Scalar
Constant{1} [id BU]
> | | | | |Rebroadcast{0} [id BL] ''
> | | | | |Rebroadcast{0} [id BL] ''
> | | | | |ScalarFromTensor [id BV] ''
> | | | | |ScalarFromTensor [id BV] ''
> | | | | |Subtensor{int64} [id BJ] ''
> | | | | |Subtensor{int64} [id BJ] ''
> | | | |A_copy [id BO] -> [id W]
> | | | |A_copy [id BO] -> [id W]
> | | |Constant{1} [id BW]
> | | |
Scalar
Constant{1} [id BW]
> | |Constant{-1} [id BX]
> | |
Scalar
Constant{-1} [id BX]
> |InplaceDimShuffle{x} [id BY] ''
> |InplaceDimShuffle{x} [id BY] ''
> |<TensorType(int64, scalar)> [id BZ] -> [id U]
> |<TensorType(int64, scalar)> [id BZ] -> [id U]
...
@@ -514,8 +514,8 @@ def test_scan_debugprint4():
...
@@ -514,8 +514,8 @@ def test_scan_debugprint4():
| | | | |Shape [id I] ''
| | | | |Shape [id I] ''
| | | | | |Subtensor{:int64:} [id J] ''
| | | | | |Subtensor{:int64:} [id J] ''
| | | | | |<TensorType(int64, vector)> [id K]
| | | | | |<TensorType(int64, vector)> [id K]
| | | | | |Constant{2} [id L]
| | | | | |
Scalar
Constant{2} [id L]
| | | | |Constant{0} [id M]
| | | | |
Scalar
Constant{0} [id M]
| | | |Subtensor{:int64:} [id J] ''
| | | |Subtensor{:int64:} [id J] ''
| | | |ScalarFromTensor [id N] ''
| | | |ScalarFromTensor [id N] ''
| | | |Subtensor{int64} [id H] ''
| | | |Subtensor{int64} [id H] ''
...
@@ -527,15 +527,15 @@ def test_scan_debugprint4():
...
@@ -527,15 +527,15 @@ def test_scan_debugprint4():
| | | |Shape [id S] ''
| | | |Shape [id S] ''
| | | | |Subtensor{:int64:} [id T] ''
| | | | |Subtensor{:int64:} [id T] ''
| | | | |<TensorType(int64, vector)> [id U]
| | | | |<TensorType(int64, vector)> [id U]
| | | | |Constant{2} [id V]
| | | | |
Scalar
Constant{2} [id V]
| | | |Constant{0} [id W]
| | | |
Scalar
Constant{0} [id W]
| | |Subtensor{:int64:} [id T] ''
| | |Subtensor{:int64:} [id T] ''
| | |ScalarFromTensor [id X] ''
| | |ScalarFromTensor [id X] ''
| | |Subtensor{int64} [id R] ''
| | |Subtensor{int64} [id R] ''
| |Constant{2} [id Y]
| |
Scalar
Constant{2} [id Y]
|Subtensor{int64::} [id Z] ''
|Subtensor{int64::} [id Z] ''
|for{cpu,scan_fn}.1 [id C] ''
|for{cpu,scan_fn}.1 [id C] ''
|Constant{2} [id BA]
|
Scalar
Constant{2} [id BA]
Inner graphs of the scan ops:
Inner graphs of the scan ops:
...
@@ -592,31 +592,31 @@ def test_scan_debugprint5():
...
@@ -592,31 +592,31 @@ def test_scan_debugprint5():
| | | | | | | | |A [id P]
| | | | | | | | |A [id P]
| | | | | | | | |InplaceDimShuffle{x} [id Q] ''
| | | | | | | | |InplaceDimShuffle{x} [id Q] ''
| | | | | | | | |TensorConstant{1.0} [id R]
| | | | | | | | |TensorConstant{1.0} [id R]
| | | | | | | |Constant{0} [id S]
| | | | | | | |
Scalar
Constant{0} [id S]
| | | | | | |Subtensor{int64} [id T] ''
| | | | | | |Subtensor{int64} [id T] ''
| | | | | | |Shape [id U] ''
| | | | | | |Shape [id U] ''
| | | | | | | |Rebroadcast{0} [id M] ''
| | | | | | | |Rebroadcast{0} [id M] ''
| | | | | | |Constant{1} [id V]
| | | | | | |
Scalar
Constant{1} [id V]
| | | | | |Rebroadcast{0} [id M] ''
| | | | | |Rebroadcast{0} [id M] ''
| | | | | |ScalarFromTensor [id W] ''
| | | | | |ScalarFromTensor [id W] ''
| | | | | |Subtensor{int64} [id K] ''
| | | | | |Subtensor{int64} [id K] ''
| | | | |A [id P]
| | | | |A [id P]
| | | |Constant{0} [id X]
| | | |
Scalar
Constant{0} [id X]
| | |TensorConstant{1} [id Y]
| | |TensorConstant{1} [id Y]
| |Subtensor{:int64:} [id Z] ''
| |Subtensor{:int64:} [id Z] ''
| | |Subtensor{::int64} [id BA] ''
| | |Subtensor{::int64} [id BA] ''
| | | |Subtensor{:int64:} [id BB] ''
| | | |Subtensor{:int64:} [id BB] ''
| | | | |for{cpu,scan_fn} [id F] ''
| | | | |for{cpu,scan_fn} [id F] ''
| | | | |Constant{-1} [id BC]
| | | | |
Scalar
Constant{-1} [id BC]
| | | |Constant{-1} [id BD]
| | | |
Scalar
Constant{-1} [id BD]
| | |ScalarFromTensor [id BE] ''
| | |ScalarFromTensor [id BE] ''
| | |Elemwise{sub,no_inplace} [id C] ''
| | |Elemwise{sub,no_inplace} [id C] ''
| |Subtensor{:int64:} [id BF] ''
| |Subtensor{:int64:} [id BF] ''
| | |Subtensor{:int64:} [id BG] ''
| | |Subtensor{:int64:} [id BG] ''
| | | |Subtensor{::int64} [id BH] ''
| | | |Subtensor{::int64} [id BH] ''
| | | | |for{cpu,scan_fn} [id F] ''
| | | | |for{cpu,scan_fn} [id F] ''
| | | | |Constant{-1} [id BI]
| | | | |
Scalar
Constant{-1} [id BI]
| | | |Constant{-1} [id BJ]
| | | |
Scalar
Constant{-1} [id BJ]
| | |ScalarFromTensor [id BK] ''
| | |ScalarFromTensor [id BK] ''
| | |Elemwise{sub,no_inplace} [id C] ''
| | |Elemwise{sub,no_inplace} [id C] ''
| |Subtensor{::int64} [id BL] ''
| |Subtensor{::int64} [id BL] ''
...
@@ -629,21 +629,21 @@ def test_scan_debugprint5():
...
@@ -629,21 +629,21 @@ def test_scan_debugprint5():
| | | | |Elemwise{second,no_inplace} [id BR] ''
| | | | |Elemwise{second,no_inplace} [id BR] ''
| | | | | |Subtensor{int64::} [id BS] ''
| | | | | |Subtensor{int64::} [id BS] ''
| | | | | | |for{cpu,scan_fn} [id F] ''
| | | | | | |for{cpu,scan_fn} [id F] ''
| | | | | | |Constant{1} [id BT]
| | | | | | |
Scalar
Constant{1} [id BT]
| | | | | |InplaceDimShuffle{x,x} [id BU] ''
| | | | | |InplaceDimShuffle{x,x} [id BU] ''
| | | | | |TensorConstant{0.0} [id BV]
| | | | | |TensorConstant{0.0} [id BV]
| | | | |Elemwise{second} [id BW] ''
| | | | |Elemwise{second} [id BW] ''
| | | | | |Subtensor{int64} [id BX] ''
| | | | | |Subtensor{int64} [id BX] ''
| | | | | | |Subtensor{int64::} [id BS] ''
| | | | | | |Subtensor{int64::} [id BS] ''
| | | | | | |Constant{-1} [id BY]
| | | | | | |
Scalar
Constant{-1} [id BY]
| | | | | |InplaceDimShuffle{x} [id BZ] ''
| | | | | |InplaceDimShuffle{x} [id BZ] ''
| | | | | |Elemwise{second,no_inplace} [id CA] ''
| | | | | |Elemwise{second,no_inplace} [id CA] ''
| | | | | |Sum{acc_dtype=float64} [id CB] ''
| | | | | |Sum{acc_dtype=float64} [id CB] ''
| | | | | | |Subtensor{int64} [id BX] ''
| | | | | | |Subtensor{int64} [id BX] ''
| | | | | |TensorConstant{1.0} [id CC]
| | | | | |TensorConstant{1.0} [id CC]
| | | | |Constant{-1} [id BY]
| | | | |
Scalar
Constant{-1} [id BY]
| | | |Constant{1} [id BT]
| | | |
Scalar
Constant{1} [id BT]
| | |Constant{-1} [id CD]
| | |
Scalar
Constant{-1} [id CD]
| |Alloc [id CE] ''
| |Alloc [id CE] ''
| | |TensorConstant{0.0} [id CF]
| | |TensorConstant{0.0} [id CF]
| | |Elemwise{add,no_inplace} [id CG] ''
| | |Elemwise{add,no_inplace} [id CG] ''
...
@@ -652,9 +652,9 @@ def test_scan_debugprint5():
...
@@ -652,9 +652,9 @@ def test_scan_debugprint5():
| | |Subtensor{int64} [id CI] ''
| | |Subtensor{int64} [id CI] ''
| | |Shape [id CJ] ''
| | |Shape [id CJ] ''
| | | |A [id P]
| | | |A [id P]
| | |Constant{0} [id CK]
| | |
Scalar
Constant{0} [id CK]
| |A [id P]
| |A [id P]
|Constant{-1} [id CL]
|
Scalar
Constant{-1} [id CL]
Inner graphs of the scan ops:
Inner graphs of the scan ops:
...
@@ -711,4 +711,4 @@ def test_printing_scan():
...
@@ -711,4 +711,4 @@ def test_printing_scan():
def
test_subtensor
():
def
test_subtensor
():
x
=
dvector
()
x
=
dvector
()
y
=
x
[
1
]
y
=
x
[
1
]
assert
pp
(
y
)
==
"<TensorType(float64, vector)>[Constant{1}]"
assert
pp
(
y
)
==
"<TensorType(float64, vector)>[
Scalar
Constant{1}]"
theano/graph/basic.py
浏览文件 @
7736732d
...
@@ -630,7 +630,7 @@ class Constant(Variable):
...
@@ -630,7 +630,7 @@ class Constant(Variable):
name
=
str
(
self
.
data
)
name
=
str
(
self
.
data
)
if
len
(
name
)
>
20
:
if
len
(
name
)
>
20
:
name
=
name
[:
10
]
+
"..."
+
name
[
-
10
:]
name
=
name
[:
10
]
+
"..."
+
name
[
-
10
:]
return
"Constant{
%
s}"
%
name
return
f
"{type(self).__name__}{{{name}}}"
def
clone
(
self
):
def
clone
(
self
):
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论