Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
086323fa
提交
086323fa
authored
6月 05, 2024
作者:
Virgile Andreani
提交者:
Ricardo Vieira
6月 06, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some types to printing.py
上级
1a92165c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
17 行删除
+19
-17
printing.py
pytensor/printing.py
+19
-17
没有找到文件。
pytensor/printing.py
浏览文件 @
086323fa
...
...
@@ -1200,18 +1200,18 @@ default_colorCodes = {
def
pydotprint
(
fct
,
outfile
=
None
,
compact
=
True
,
format
=
"png"
,
with_ids
=
False
,
high_contrast
=
True
,
outfile
:
str
|
None
=
None
,
compact
:
bool
=
True
,
format
:
str
=
"png"
,
with_ids
:
bool
=
False
,
high_contrast
:
bool
=
True
,
cond_highlight
=
None
,
colorCodes
=
None
,
max_label_size
=
70
,
scan_graphs
=
False
,
var_with_name_simple
=
False
,
print_output_file
=
True
,
return_image
=
False
,
colorCodes
:
dict
|
None
=
None
,
max_label_size
:
int
=
70
,
scan_graphs
:
bool
=
False
,
var_with_name_simple
:
bool
=
False
,
print_output_file
:
bool
=
True
,
return_image
:
bool
=
False
,
):
"""Print to a file the graph of a compiled pytensor function's ops. Supports
all pydot output formats, including png and svg.
...
...
@@ -1676,7 +1676,9 @@ class _TagGenerator:
return
rval
def
min_informative_str
(
obj
,
indent_level
=
0
,
_prev_obs
=
None
,
_tag_generator
=
None
):
def
min_informative_str
(
obj
,
indent_level
:
int
=
0
,
_prev_obs
:
dict
|
None
=
None
,
_tag_generator
=
None
)
->
str
:
"""
Returns a string specifying to the user what obj is
The string will print out as much of the graph as is needed
...
...
@@ -1776,7 +1778,7 @@ def min_informative_str(obj, indent_level=0, _prev_obs=None, _tag_generator=None
return
rval
def
var_descriptor
(
obj
,
_prev_obs
=
None
,
_tag_generator
=
None
)
:
def
var_descriptor
(
obj
,
_prev_obs
:
dict
|
None
=
None
,
_tag_generator
=
None
)
->
str
:
"""
Returns a string, with no endlines, fully specifying
how a variable is computed. Does not include any memory
...
...
@@ -1832,7 +1834,7 @@ def var_descriptor(obj, _prev_obs=None, _tag_generator=None):
return
rval
def
position_independent_str
(
obj
):
def
position_independent_str
(
obj
)
->
str
:
if
isinstance
(
obj
,
Variable
):
rval
=
"pytensor_var"
rval
+=
"{type="
+
str
(
obj
.
type
)
+
"}"
...
...
@@ -1842,7 +1844,7 @@ def position_independent_str(obj):
return
rval
def
hex_digest
(
x
)
:
def
hex_digest
(
x
:
np
.
ndarray
)
->
str
:
"""
Returns a short, mostly hexadecimal hash of a numpy ndarray
"""
...
...
@@ -1852,8 +1854,8 @@ def hex_digest(x):
# because the buffer interface only exposes the raw data, not
# any info about the semantics of how that data should be arranged
# into a tensor
rval
=
rval
+
"|strides=["
+
","
.
join
(
str
(
stride
)
for
stride
in
x
.
strides
)
+
"]"
rval
=
rval
+
"|shape=["
+
","
.
join
(
str
(
s
)
for
s
in
x
.
shape
)
+
"]"
rval
+=
"|strides=["
+
","
.
join
(
str
(
stride
)
for
stride
in
x
.
strides
)
+
"]"
rval
+=
"|shape=["
+
","
.
join
(
str
(
s
)
for
s
in
x
.
shape
)
+
"]"
return
rval
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论