提交 c0b57d75 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Indentation.

上级 d8cee62e
......@@ -22,8 +22,8 @@ def warning(*msg): _logger.warning(' '.join(str(m) for m in msg))
def error(*msg): _logger.error(' '.join(str(m) for m in msg))
AddConfigVar('shared.value_borrows',
("False: shared variables 'value' property is guaranteed to not"
" alias theano-managed memory. True: no guarantee, but faster."
("False: shared variables 'value' property is guaranteed to not"
" alias theano-managed memory. True: no guarantee, but faster."
" For more control consider using shared.get_value() instead."),
BoolParam(True))
......@@ -86,7 +86,7 @@ class SharedVariable(Variable):
def get_value(self, borrow=False, return_internal_type=False):
"""Get the non-symbolic value associated with this SharedVariable.
:param borrow:
:param borrow:
True to permit returning of an object aliased to internal memory.
:param return_internal_type:
True to permit the returning of an arbitrary type object used internally to store
......@@ -95,7 +95,7 @@ class SharedVariable(Variable):
Only with borrow=False and return_internal_type=True does this function guarantee that
you actually get the internal object. But in that case, you may get different return
types when using different compute devices.
"""
if borrow:
return self.container.value
......@@ -105,10 +105,10 @@ class SharedVariable(Variable):
def set_value(self,new_value, borrow=False):
"""Set the non-symbolic value associated with this SharedVariable.
:param borrow:
:param borrow:
True to use the new_value directly, potentially creating problems
related to aliased memory.
Changes to this value will be visible to all functions using this SharedVariable.
"""
if borrow:
......@@ -119,7 +119,7 @@ class SharedVariable(Variable):
def clone(self):
cp = self.__class__(
name=self.name,
type=self.type,
type=self.type,
value=None,
strict=None,
container=self.container)
......@@ -135,8 +135,8 @@ class SharedVariable(Variable):
# 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(_value_get, _value_set,
doc=("shortcut for self.get_value() and self.set_value()."
value = property(_value_get, _value_set,
doc=("shortcut for self.get_value() and self.set_value()."
"The `borrow` argument to these methods is read from "
"`theano.config.shared.value_borrows`"))
......@@ -174,10 +174,10 @@ def shared(value, name=None, strict=False, allow_downcast=None, **kwargs):
This function iterates over constructor functions (see `shared_constructor`) to find a
suitable SharedVariable subclass.
:note:
:note:
By passing kwargs, you effectively limit the set of potential constructors to those that
can accept those kwargs.
"""
for ctor in reversed(shared.constructors):
try:
......@@ -198,4 +198,3 @@ def generic_constructor(value, name=None, strict=False, allow_downcast=None):
"""SharedVariable Constructor"""
return SharedVariable(type=generic, value=value, name=name, strict=strict,
allow_downcast=allow_downcast)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论