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