WIP: BaseRecurrent and recurrent_apply_method

The scan related code is a typical boilerplate code
of which we had so much in Groundhog. This commit
introduces a way to get rid of it: a decorator that adds iteration
code to a single-step transition function.
This can be done, but for all the RNN applications I know the initial 
hidden state is either zeros or a function of something else. I think we 
can add this feature later if needed.

On 22.10.2014 19:33, Bart van Merriënboer wrote:
>
> In blocks/bricks.py:
>
> > @@ -702,7 +703,142 @@ def apply(self, inp):
> >          return output.reshape(full_shape)
> >
> >
> > -class Recurrent(DefaultRNG):
> > +class BaseRecurrent(Brick):
> > +    """Base class for recurrent bricks.
> > +
> > +    A recurrent network processes sequences by applying recursively
> > +    a transition operator. This class contains some useful routine
> > +    that fascilitate simple and boilerplate code free implementation
> > +    of recurrent bricks.
> > +    """
> > +
> > +    def zero_state(self, batch_size):
>
> Maybe we could re-use some of the initialization schemes here? So by 
> default it's initialized with |Constant(0)|, but people could choose 
> others as well.
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/bartvm/blocks/pull/10/files#r19229855>.
>