Fixed ComposeChannels and bugs with num_channels()

num_channels() is now a bit hacky, but necessary.  Also, the case where it is called without having an image generated first is very narrow and usually happens at most once, at initialization (when it's necessary to know, beforehand, the number of channels of the inputs, in order to construct the higher structures)

Yes, out of date docstring, and yes, they conflict.  We can replace with
"the list of channel_factors should match the number of channels.  If they
don't...." or even run an assert to check that they're equal.

G



On Sat, Jul 19, 2014 at 4:44 PM, James A. Bednar <notifications@github.com>
wrote:

> In imagen/image.py:
>
> > @@ -519,6 +519,32 @@ def __call__(self,channel_data):
> >
> >
> >
> > +class ScaleChannels(
> ChannelTransform):
> > +    """
> > +    Scale each channel of an Image PatternGenerator by a different factor.
> > +
> > +    The list of channel factors needs to be the same length as the number of channels.
> > +    If the factors provided are fewer than the channels of the Image, the remaining channels
> > +    will not be scaled. If they are more, then only the first N factors are used.
> > +    """
> > +
> > +    channel_factors = param.Dynamic(default=[1.0,1.0,1.0],doc="""
> > +        Channel scaling factors. The length of this list sets the
> > +        number of channels to be created, unless the input_generator
> > +        already supports multiple channels (in which case the number
> > +        of its channels is used).""")
>
> Is this docstring out of date?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ioam/imagen/pull/32/files#r15144280>.
>