提交 a8171dd2 authored 作者: James Bergstra's avatar James Bergstra

changing default shared variable .value to use "borrow=True" to maintain backward compatibility

上级 fa31bb68
......@@ -106,8 +106,17 @@ class SharedVariable(Variable):
cp.tag = copy.copy(self.tag)
return cp
value = property(get_value, set_value,
doc="shortcut for self.get_value() and self.set_value() which COPIES data")
def get_borrowed_value(self):
return self.get_value(borrow=True)
def set_borrowed_value(self, new_value):
return self.set_value(new_value, borrow=True)
#TODO: USE A CONFIG VARIABLE TO set these get/set methods to the non-borrowing versions
# Semantically things are clearer when using non-borrow versions. That should be the
# default. The default support transparently (if slowly) when the 'raw' value is in a
# different memory space (e.g. GPU or other machine).
value = property(get_borrowed_value, set_borrowed_value,
doc="shortcut for self.get_borrowed_value() and self.set_borrowed_value() which COPIES data")
def filter_update(self, update):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论