Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
875424b8
提交
875424b8
authored
3月 15, 2011
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add deprecation warning for .value property of shared variables.
Also update inline documentation.
上级
bb4e32e1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
6 行删除
+15
-6
sharedvalue.py
theano/compile/sharedvalue.py
+15
-6
没有找到文件。
theano/compile/sharedvalue.py
浏览文件 @
875424b8
...
@@ -22,9 +22,10 @@ def warning(*msg): _logger.warning(' '.join(str(m) for m in msg))
...
@@ -22,9 +22,10 @@ def warning(*msg): _logger.warning(' '.join(str(m) for m in msg))
def
error
(
*
msg
):
_logger
.
error
(
' '
.
join
(
str
(
m
)
for
m
in
msg
))
def
error
(
*
msg
):
_logger
.
error
(
' '
.
join
(
str
(
m
)
for
m
in
msg
))
AddConfigVar
(
'shared.value_borrows'
,
AddConfigVar
(
'shared.value_borrows'
,
(
"False: shared variables 'value' property is guaranteed to not"
(
"DEPRECATED. You should not use the 'value' property of shared"
" alias theano-managed memory. True: no guarantee, but faster."
" variables, but use the .get_value() and .set_value() methods."
" For more control consider using shared.get_value() instead."
),
" False: shared variables 'value' property is guaranteed to not"
" alias theano-managed memory. True: no guarantee, but faster."
),
BoolParam
(
True
))
BoolParam
(
True
))
class
SharedVariable
(
Variable
):
class
SharedVariable
(
Variable
):
...
@@ -127,8 +128,14 @@ class SharedVariable(Variable):
...
@@ -127,8 +128,14 @@ class SharedVariable(Variable):
return
cp
return
cp
def
_value_get
(
self
):
def
_value_get
(
self
):
warnings
.
warn
((
"The .value property of shared variables is deprecated."
" You should use the .get_value() method instead."
),
stacklevel
=
2
)
return
self
.
get_value
(
borrow
=
config
.
shared
.
value_borrows
,
return_internal_type
=
False
)
return
self
.
get_value
(
borrow
=
config
.
shared
.
value_borrows
,
return_internal_type
=
False
)
def
_value_set
(
self
,
new_value
):
def
_value_set
(
self
,
new_value
):
warnings
.
warn
((
"The .value property of shared variables is deprecated."
" You should use the .set_value() method instead."
),
stacklevel
=
2
)
return
self
.
set_value
(
new_value
,
borrow
=
config
.
shared
.
value_borrows
)
return
self
.
set_value
(
new_value
,
borrow
=
config
.
shared
.
value_borrows
)
#TODO: USE A CONFIG VARIABLE TO set these get/set methods to the non-borrowing versions
#TODO: USE A CONFIG VARIABLE TO set these get/set methods to the non-borrowing versions
...
@@ -136,9 +143,11 @@ class SharedVariable(Variable):
...
@@ -136,9 +143,11 @@ class SharedVariable(Variable):
# default. The default support transparently (if slowly) when the 'raw' value is in a
# default. The default support transparently (if slowly) when the 'raw' value is in a
# different memory space (e.g. GPU or other machine).
# different memory space (e.g. GPU or other machine).
value
=
property
(
_value_get
,
_value_set
,
value
=
property
(
_value_get
,
_value_set
,
doc
=
(
"shortcut for self.get_value() and self.set_value()."
doc
=
(
"DEPRECATED. Shortcut for self.get_value() and "
"The `borrow` argument to these methods is read from "
"self.set_value(). "
"`theano.config.shared.value_borrows`"
))
"The `borrow` argument to these methods is read from "
"`theano.config.shared.value_borrows`. "
"You should call get_value() and set_value() directly."
))
def
filter_update
(
self
,
update
):
def
filter_update
(
self
,
update
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论