<s> """<STR_LIT>""" <EOL> from fuel . transformers import ScaleAndShift , Cast , SourcewiseTransformer <EOL> from fuel . transformers . image import ImagesFromBytes <EOL> def uint8_pixels_to_floatX ( which_sources ) : <EOL> return ( <EOL> ( ScaleAndShift , [ <NUM_LIT:1> / <NUM_LIT> , <NUM_LIT:0> ] , { '<STR_LIT>' : which_sources } ) , <EOL> ( Cast , [ '<STR_LIT>' ] , { '<STR_LIT>' : which_sources } ) ) <EOL> class ToBytes ( SourcewiseTransformer ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , stream , ** kwargs ) : <EOL> kwargs . setdefault ( '<STR_LIT>' , stream . produces_examples ) <EOL> axis_labels = ( stream . axis_labels <EOL> if stream . axis_labels is not None <EOL> else { } ) <EOL> for source in kwargs . get ( '<STR_LIT>' , stream . sources ) : <EOL> axis_labels [ source ] = ( ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if '<STR_LIT>' in axis_labels . get ( source , ( ) ) <EOL> else ( '<STR_LIT>' , ) ) <EOL> kwargs . setdefault ( '<STR_LIT>' , axis_labels ) <EOL> super ( ToBytes , self ) . __init__ ( stream , ** kwargs ) <EOL> def transform_source_example ( self , example , _ ) : <EOL> return example . tostring ( ) <EOL> def transform_source_batch ( self , batch , _ ) : <EOL> return [ example . tostring ( ) for example in batch ] <EOL> def rgb_images_from_encoded_bytes ( which_sources ) : <EOL> return ( ( ToBytes , [ ] , { '<STR_LIT>' : ( '<STR_LIT>' , ) } ) , <EOL> ( ImagesFromBytes , [ ] , { '<STR_LIT>' : ( '<STR_LIT>' , ) } ) ) </s>
