Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
470fc030
提交
470fc030
authored
2月 06, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
In the key of the Theano cache, use the md5 hash of the constant value.
We implement it for tensor and sparse Contant Variable. This get also done for gpu variable as it inherit from the tensor Constant variable.
上级
0728bb3c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
0 行删除
+12
-0
cc.py
theano/gof/cc.py
+2
-0
basic.py
theano/sparse/basic.py
+5
-0
basic.py
theano/tensor/basic.py
+5
-0
没有找到文件。
theano/gof/cc.py
浏览文件 @
470fc030
...
@@ -906,6 +906,8 @@ class CLinker(link.Linker):
...
@@ -906,6 +906,8 @@ class CLinker(link.Linker):
if
isinstance
(
i
,
graph
.
Constant
):
#orphans
if
isinstance
(
i
,
graph
.
Constant
):
#orphans
if
id
(
i
)
not
in
constant_ids
:
if
id
(
i
)
not
in
constant_ids
:
isig
=
(
i
.
signature
(),
topological_pos
,
i_idx
)
isig
=
(
i
.
signature
(),
topological_pos
,
i_idx
)
if
hasattr
(
isig
[
0
],
"theano_hash"
):
isig
=
(
isig
[
0
]
.
theano_hash
(),
topological_pos
,
i_idx
)
try
:
try
:
hash
(
isig
)
hash
(
isig
)
except
Exception
:
#generic constants don't have a hashable signature
except
Exception
:
#generic constants don't have a hashable signature
...
...
theano/sparse/basic.py
浏览文件 @
470fc030
...
@@ -16,6 +16,7 @@ import scipy.sparse
...
@@ -16,6 +16,7 @@ import scipy.sparse
from
theano
import
gof
,
tensor
,
compile
,
scalar
,
config
from
theano
import
gof
,
tensor
,
compile
,
scalar
,
config
from
theano.gof.python25
import
all
from
theano.gof.python25
import
all
from
theano.tensor
import
blas
from
theano.tensor
import
blas
from
theano.sparse.utils
import
hash_from_sparse
sparse_formats
=
[
'csc'
,
'csr'
]
sparse_formats
=
[
'csc'
,
'csr'
]
...
@@ -278,6 +279,10 @@ class SparseConstantSignature(tuple):
...
@@ -278,6 +279,10 @@ class SparseConstantSignature(tuple):
(
a
,
b
)
=
self
(
a
,
b
)
=
self
return
hash
(
type
(
self
))
^
hash
(
a
)
^
hash
(
type
(
b
))
return
hash
(
type
(
self
))
^
hash
(
a
)
^
hash
(
type
(
b
))
def
theano_hash
(
self
):
(
_
,
d
)
=
self
return
hash_from_sparse
(
d
)
class
SparseConstant
(
gof
.
Constant
,
_sparse_py_operators
):
class
SparseConstant
(
gof
.
Constant
,
_sparse_py_operators
):
dtype
=
property
(
lambda
self
:
self
.
type
.
dtype
)
dtype
=
property
(
lambda
self
:
self
.
type
.
dtype
)
...
...
theano/tensor/basic.py
浏览文件 @
470fc030
...
@@ -20,6 +20,7 @@ from theano import scalar as scal
...
@@ -20,6 +20,7 @@ from theano import scalar as scal
from
theano.gof.python25
import
partial
,
any
,
all
from
theano.gof.python25
import
partial
,
any
,
all
from
theano
import
compile
,
printing
from
theano
import
compile
,
printing
from
theano.printing
import
pprint
,
min_informative_str
from
theano.printing
import
pprint
,
min_informative_str
from
theano.tensor.utils
import
hash_from_ndarray
# We use these exceptions as well.
# We use these exceptions as well.
from
theano.scalar
import
ComplexError
,
IntegerDivisionError
from
theano.scalar
import
ComplexError
,
IntegerDivisionError
...
@@ -1505,6 +1506,10 @@ class TensorConstantSignature(tuple):
...
@@ -1505,6 +1506,10 @@ class TensorConstantSignature(tuple):
t
,
d
=
self
t
,
d
=
self
return
hashtype
(
self
)
^
hash
(
t
)
^
hash
(
d
.
shape
)
^
hash
(
self
.
sum
)
return
hashtype
(
self
)
^
hash
(
t
)
^
hash
(
d
.
shape
)
^
hash
(
self
.
sum
)
def
theano_hash
(
self
):
_
,
d
=
self
return
hash_from_ndarray
(
d
)
def
_get_sum
(
self
):
def
_get_sum
(
self
):
"""Compute sum of non NaN / Inf values in the array."""
"""Compute sum of non NaN / Inf values in the array."""
try
:
try
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论