Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1380aedb
提交
1380aedb
authored
8月 09, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
8月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unused aesara.graph.callcache
上级
7d71505d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
0 行增加
和
68 行删除
+0
-68
callcache.py
aesara/graph/callcache.py
+0
-54
basic.py
aesara/link/c/basic.py
+0
-14
没有找到文件。
aesara/graph/callcache.py
deleted
100644 → 0
浏览文件 @
7d71505d
import
logging
import
pickle
_logger
=
logging
.
getLogger
(
"aesara.graph.callcache"
)
class
CallCache
:
def
__init__
(
self
,
filename
=
None
):
self
.
filename
=
filename
try
:
if
filename
is
None
:
raise
OSError
(
"bad filename"
)
# just goes to except
with
open
(
filename
)
as
f
:
self
.
cache
=
pickle
.
load
(
f
)
except
OSError
:
self
.
cache
=
{}
def
persist
(
self
,
filename
=
None
):
"""
Cache "filename" as a pickle file
"""
if
filename
is
None
:
filename
=
self
.
filename
with
open
(
filename
,
"w"
)
as
f
:
pickle
.
dump
(
self
.
cache
,
f
)
def
call
(
self
,
fn
,
args
=
(),
key
=
None
):
"""
Retrieve item from the cache(if available)
based on a key
Parameters:
----------
key
parameter to retrieve cache item
fn,args
key to retrieve if "key" is None
"""
if
key
is
None
:
key
=
(
fn
,
tuple
(
args
))
if
key
not
in
self
.
cache
:
_logger
.
debug
(
"cache miss
%
i"
,
len
(
self
.
cache
))
self
.
cache
[
key
]
=
fn
(
*
args
)
else
:
_logger
.
debug
(
"cache hit
%
i"
,
len
(
self
.
cache
))
return
self
.
cache
[
key
]
def
__del__
(
self
):
try
:
if
self
.
filename
:
self
.
persist
()
except
Exception
as
e
:
_logger
.
error
(
"persist failed
%
s
%
s"
,
self
.
filename
,
e
)
aesara/link/c/basic.py
浏览文件 @
1380aedb
...
@@ -3,7 +3,6 @@ Defines Linkers that deal with C implementations.
...
@@ -3,7 +3,6 @@ Defines Linkers that deal with C implementations.
"""
"""
import
logging
import
logging
import
os
import
sys
import
sys
from
collections
import
defaultdict
from
collections
import
defaultdict
from
copy
import
copy
from
copy
import
copy
...
@@ -21,7 +20,6 @@ from aesara.graph.basic import (
...
@@ -21,7 +20,6 @@ from aesara.graph.basic import (
io_toposort
,
io_toposort
,
vars_between
,
vars_between
,
)
)
from
aesara.graph.callcache
import
CallCache
from
aesara.link.basic
import
Container
,
Linker
,
LocalLinker
,
PerformLinker
from
aesara.link.basic
import
Container
,
Linker
,
LocalLinker
,
PerformLinker
from
aesara.link.c.cmodule
import
(
from
aesara.link.c.cmodule
import
(
METH_VARARGS
,
METH_VARARGS
,
...
@@ -55,18 +53,6 @@ def get_module_cache(init_args=None):
...
@@ -55,18 +53,6 @@ def get_module_cache(init_args=None):
return
_get_module_cache
(
config
.
compiledir
,
init_args
=
init_args
)
return
_get_module_cache
(
config
.
compiledir
,
init_args
=
init_args
)
_persistent_module_cache
=
None
def
get_persistent_module_cache
():
global
_persistent_module_cache
if
_persistent_module_cache
is
None
:
_persistent_module_cache
=
CallCache
(
os
.
path
.
join
(
config
.
compiledir
,
"persistent_cache"
)
)
return
_persistent_module_cache
class
CodeBlock
:
class
CodeBlock
:
"""
"""
Represents a computation unit composed of declare, behavior, and cleanup.
Represents a computation unit composed of declare, behavior, and cleanup.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论