shared
- defines theano.shared¶
-
class
shared.
SharedVariable
¶ Variable with Storage that is shared between functions that it appears in. These variables are meant to be created by registered shared constructors (see
shared_constructor()
).The user-friendly constructor is
shared()
-
value
¶ Read/write access to the [non-symbolic] value/data associated with this SharedVariable.
Changes to this value will be visible to all functions using this SharedVariable.
-
__init__
(self, name, type, value, strict, container=None)¶ Parameters: - name (None or str) – The name for this variable.
- type – The Type for this Variable.
- value – A value to associate with this variable (a new container will be created).
- strict – True -> assignments to
self.value
will not be casted or copied, so they must have the correct type or an exception will be raised. - container – The container to use for this variable. This should instead of the value parameter. Using both is an error.
-
container
¶ A container to use for this SharedVariable when it is an implicit function parameter.
Type: class:Container
-
-
theano.compile.sharedvalue.
shared
(value, name=None, strict=False, allow_downcast=None, **kwargs)¶ Return a SharedVariable Variable, initialized with a copy or reference of value.
This function iterates over constructor functions to find a suitable SharedVariable subclass. The suitable one is the first constructor that accept the given value.
This function is meant as a convenient default. If you want to use a specific shared variable constructor, consider calling it directly.
theano.shared
is a shortcut to this function.Note: By passing kwargs, you effectively limit the set of potential constructors to those that can accept those kwargs. Note: Some shared variable have borrow
as extra kwargs. See for detail.Note: Some shared variable have broadcastable
as extra kwargs. As shared variable shapes can change, all dimensions default to not being broadcastable, even ifvalue
has a shape of 1 along some dimension. This parameter allows you to create for example a row or column 2d tensor.-
shared.
constructors
¶ A list of shared variable constructors that will be tried in reverse order.
-