A ``Member`` represents a state variable. It will be named automatically after that field and it will be an implicit input of all ``Methods`` of the ``Module``. Its storage will be shared by all ``Methods`` of the ``Module``.
A ``Member`` cannot wrap a ``Result`` which is the result of a previous computation. [What does this mean?][Fred:Still true?Yes]. Those are called External and are automatically detected.
A ``Result`` which is the result of a previous computation is not a Member. Internally this is called an External. You should not care about this.
**NOTE2:** this can also lead to some subtle bug as to share a member between module, you should do as this:
...
...
@@ -63,7 +63,7 @@ A ``Member`` cannot wrap a ``Result`` which is the result of a previous computat
module2 = M.Module()
module2.m1_state = M.Member(module.state)
#wrong: module2.m1_state = module.state as module2.m1_state won't be a member of module2...
#wrong: module2.m1_state = module.state as module2.m1_state won't be a member of module2...[Fred: need to check, Being an External is not what it need to be?]
see later section for more information.
...
...
@@ -104,7 +104,7 @@ Module Interface
'''make''' compiles all ``Methods`` and allocates storage for all ``Members`` into a ``ModuleInstance`` object, which is returned. The ``init`` dictionary can be used to provide initial values for the members.
'''make''' calls ``initialize_storage``[Fred: still true???] to allocate storage and ``_instance_initialize`` to initialize the instance.
'''make''' calls ``initialize_storage``[Fred: still true??? Olivier D. What was this? Do you removed it as I don't find it anywhere] to allocate storage and ``_instance_initialize`` to initialize the instance.
.. code-block:: python
...
...
@@ -124,7 +124,7 @@ This allocates a ``Container`` for each member (and hierarchically, for the memb
def _instance_initialize(self, inst, **init)
The inst argument is a ``ModuleInstance``. For each key, value pair in init: s``etattr(inst, key, value)``. This can be easily overriden by ``Module`` subclasses to initialize an instance in different ways. If you don't know what to put their, you probably want:
The inst argument is a ``ModuleInstance``. For each key, value pair in init: s``etattr(inst, key, value)``. This can be easily overriden by ``Module`` subclasses to initialize an instance in different ways. If you don't know what to put their, you probably want[Fred: this should be automatic. Is it?]:
.. code-block:: python
...
...
@@ -192,7 +192,7 @@ Using function:
def make_incdec_function():
n, c = T.scalars('nc')
inc = theano.function([n, ((c, c + n), 0)], [])
dec = theano.function([n, ((c, c - n), inc.container[c])], [])
dec = theano.function([n, ((c, c - n), inc.container[c])], [])#[Fred: inc.container should mean that inc and dec share the same state?]