The attributes on partial (I think the right solution to this is
metaclasses, but this is fine for now)


On Thu, Apr 3, 2014 at 11:31 AM, Xavier Bouthillier <
notifications@github.com> wrote:

> In pylearn2/utils/iteration.py:
>
> > +                length = len(batch)
> > +
> > +        return batch
> > +
> > +
> > +def as_even(cls):
> > +    partial = functools.partial(ForcedEvenIterator, cls)
> > +
> > +    # temporarily set cls attributes on partial so they are accessible
> > +    # before instantiation
> > +    attributes = inspect.getmembers(cls, lambda a:not(inspect.isroutine(a)))
> > +    for key, value in attributes:
> > +        if not(key.startswith('__') and key.endswith('__')):
> > +            setattr(partial,key,value)
> > +
> > +    partial.uniform_batch_size = True
>
> uniform_batch_size or the temp copy of the attributes of cls on partial?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/lisa-lab/pylearn2/pull/733/files#r11256890>
> .
>