Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
58aca963
提交
58aca963
authored
10月 17, 2014
作者:
Roy Xue
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6 from nouiz/RoyXue-theano_function_free
Make f.fn.allow_gc accesible with the CVM and allow to change it dynamically
上级
47a46357
08b01559
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
48 行增加
和
1 行删除
+48
-1
lazylinker_c.c
theano/gof/lazylinker_c.c
+29
-1
test_vm.py
theano/gof/tests/test_vm.py
+19
-0
没有找到文件。
theano/gof/lazylinker_c.c
浏览文件 @
58aca963
...
@@ -930,6 +930,34 @@ static PyMethodDef CLazyLinker_methods[] = {
...
@@ -930,6 +930,34 @@ static PyMethodDef CLazyLinker_methods[] = {
};
};
#endif
#endif
static
PyObject
*
CLazyLinker_get_allow_gc
(
CLazyLinker
*
self
,
void
*
closure
)
{
return
PyBool_FromLong
(
self
->
allow_gc
);
}
static
int
CLazyLinker_set_allow_gc
(
CLazyLinker
*
self
,
PyObject
*
value
,
void
*
closure
)
{
if
(
!
PyBool_Check
(
value
))
return
-
1
;
if
(
value
==
Py_True
)
self
->
allow_gc
=
true
;
else
self
->
allow_gc
=
false
;
return
0
;
}
static
PyGetSetDef
CLazyLinker_getset
[]
=
{
{
"allow_gc"
,
(
getter
)
CLazyLinker_get_allow_gc
,
(
setter
)
CLazyLinker_set_allow_gc
,
"do this function support allow_gc"
,
NULL
},
{
NULL
,
NULL
,
NULL
,
NULL
}
/* Sentinel */
};
static
PyMemberDef
CLazyLinker_members
[]
=
{
static
PyMemberDef
CLazyLinker_members
[]
=
{
{(
char
*
)
"nodes"
,
T_OBJECT_EX
,
offsetof
(
CLazyLinker
,
nodes
),
0
,
{(
char
*
)
"nodes"
,
T_OBJECT_EX
,
offsetof
(
CLazyLinker
,
nodes
),
0
,
(
char
*
)
"list of nodes"
},
(
char
*
)
"list of nodes"
},
...
@@ -983,7 +1011,7 @@ static PyTypeObject lazylinker_ext_CLazyLinkerType = {
...
@@ -983,7 +1011,7 @@ static PyTypeObject lazylinker_ext_CLazyLinkerType = {
0
,
/* tp_iternext */
0
,
/* tp_iternext */
0
,
//CLazyLinker_methods, /* tp_methods */
0
,
//CLazyLinker_methods, /* tp_methods */
CLazyLinker_members
,
/* tp_members */
CLazyLinker_members
,
/* tp_members */
0
,
/* tp_getset */
CLazyLinker_getset
,
/* tp_getset */
0
,
/* tp_base */
0
,
/* tp_base */
0
,
/* tp_dict */
0
,
/* tp_dict */
0
,
/* tp_descr_get */
0
,
/* tp_descr_get */
...
...
theano/gof/tests/test_vm.py
浏览文件 @
58aca963
...
@@ -184,6 +184,25 @@ def test_speed_lazy():
...
@@ -184,6 +184,25 @@ def test_speed_lazy():
time_linker
(
'vmLinker_C'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
,
time_linker
(
'vmLinker_C'
,
lambda
:
vm
.
VM_Linker
(
allow_gc
=
False
,
use_cloop
=
True
))
use_cloop
=
True
))
def
test_allow_gc_cvm
():
v
=
theano
.
tensor
.
vector
()
f
=
theano
.
function
([
v
],
v
+
1
)
f
([
1
])
n
=
list
(
f
.
maker
.
fgraph
.
apply_nodes
)[
0
]
.
outputs
[
0
]
assert
f
.
fn
.
storage_map
[
n
][
0
]
is
None
assert
f
.
fn
.
allow_gc
is
True
f
.
fn
.
allow_gc
=
False
assert
f
.
fn
.
allow_gc
is
False
f
([
1
])
assert
f
.
fn
.
storage_map
[
n
][
0
]
is
not
None
f
.
fn
.
allow_gc
=
True
assert
f
.
fn
.
allow_gc
is
True
f
([
1
])
assert
f
.
fn
.
storage_map
[
n
][
0
]
is
None
run_memory_usage_tests
=
False
run_memory_usage_tests
=
False
if
run_memory_usage_tests
:
if
run_memory_usage_tests
:
# these are not normal unit tests, do not run them as part of standard
# these are not normal unit tests, do not run them as part of standard
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论