Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
45715e20
提交
45715e20
authored
4月 08, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make a separate merge_signature method.
上级
843e2b32
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
4 行删除
+12
-4
graph.py
theano/gof/graph.py
+3
-0
opt.py
theano/gof/opt.py
+1
-1
type.py
theano/gof/type.py
+8
-3
没有找到文件。
theano/gof/graph.py
浏览文件 @
45715e20
...
@@ -450,6 +450,9 @@ class Constant(Variable):
...
@@ -450,6 +450,9 @@ class Constant(Variable):
def
signature
(
self
):
def
signature
(
self
):
return
(
self
.
type
,
self
.
data
)
return
(
self
.
type
,
self
.
data
)
def
merge_signature
(
self
):
return
self
.
signature
()
def
__str__
(
self
):
def
__str__
(
self
):
if
self
.
name
is
not
None
:
if
self
.
name
is
not
None
:
return
self
.
name
return
self
.
name
...
...
theano/gof/opt.py
浏览文件 @
45715e20
...
@@ -499,7 +499,7 @@ class MergeFeature(object):
...
@@ -499,7 +499,7 @@ class MergeFeature(object):
"""Check if a constant can be merged, and queue that replacement"""
"""Check if a constant can be merged, and queue that replacement"""
if
id
(
c
)
in
self
.
seen_constants
:
if
id
(
c
)
in
self
.
seen_constants
:
return
return
sig
=
c
.
signature
()
sig
=
c
.
merge_
signature
()
other_c
=
self
.
const_sig_inv
.
get
(
sig
,
None
)
other_c
=
self
.
const_sig_inv
.
get
(
sig
,
None
)
if
other_c
is
not
None
:
if
other_c
is
not
None
:
# multiple names will clobber each other..
# multiple names will clobber each other..
...
...
theano/gof/type.py
浏览文件 @
45715e20
...
@@ -627,8 +627,13 @@ if (py_%(name)s == NULL) { %(freefunc)s(%(name)s); }
...
@@ -627,8 +627,13 @@ if (py_%(name)s == NULL) { %(freefunc)s(%(name)s); }
class
CDataTypeConstant
(
graph
.
Constant
):
class
CDataTypeConstant
(
graph
.
Constant
):
def
signature
(
self
):
def
merge_
signature
(
self
):
# We
can't check if certain constants are equal or not so just
# We
don't want to merge constants that don't point to the
#
assume they are all unequal
.
#
same object
.
return
id
(
self
.
data
)
return
id
(
self
.
data
)
def
signature
(
self
):
# There is no way to put the data in the signature, so we
# don't even try
return
(
self
.
type
,)
CDataType
.
Constant
=
CDataTypeConstant
CDataType
.
Constant
=
CDataTypeConstant
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论