(source='zc', target='zc')
return Renormalizer(oldoffset, oldscale, newoffset, newscale,
            tobyte=(target == 'byte'))
Returns a function that imposes a standard normalization on
    the image data.  The returned renormalizer operates on either
    3d tensor (single image) or 4d tensor (image batch) data.
    The normalization target choices are:

        zc (default) - zero centered [-1..1]
        pt - pytorch [0..1]
        imagenet - zero mean, unit stdev imagenet stats (approx [-2.1...2.6])
        byte - as from an image file, [0..255]

    If a source is provided (a dataset or transform), then, the renormalizer
    first reverses any normalization found in the data source before
    imposing the specified normalization.  When no source is provided,
    the input data is assumed to be pytorch-normalized (range [0..1]).
Returns a function that imposes a standard normalization on
    the image data.  The returned renormalizer operates on either
    3d tensor (single image) or 4d tensor (image batch) data.
    The normalization target choices are:
Returns a function that imposes a standard normalization on the image data . The returned renormalizer operates on either 3d tensor ( single image ) or 4d tensor ( image batch ) data . The normalization target choices are :
def renormalizer(source='zc', target='zc'):
    '''
    Returns a function that imposes a standard normalization on
    the image data.  The returned renormalizer operates on either
    3d tensor (single image) or 4d tensor (image batch) data.
    The normalization target choices are:

        zc (default) - zero centered [-1..1]
        pt - pytorch [0..1]
        imagenet - zero mean, unit stdev imagenet stats (approx [-2.1...2.6])
        byte - as from an image file, [0..255]

    If a source is provided (a dataset or transform), then, the renormalizer
    first reverses any normalization found in the data source before
    imposing the specified normalization.  When no source is provided,
    the input data is assumed to be pytorch-normalized (range [0..1]).
    '''
    if isinstance(source, str):
        oldoffset, oldscale = OFFSET_SCALE[source]
    else:
        normalizer = find_normalizer(source)
        oldoffset, oldscale = (
                (normalizer.mean, normalizer.std) if normalizer is not None
                else OFFSET_SCALE['pt'])
    newoffset, newscale = (target if isinstance(target, tuple)
            else OFFSET_SCALE[target])
    return Renormalizer(oldoffset, oldscale, newoffset, newscale,
            tobyte=(target == 'byte'))
def renormalizer ( source = 'zc' , target = 'zc' ) : if isinstance ( source , str ) : oldoffset , oldscale = OFFSET_SCALE [ source ] else : normalizer = find_normalizer ( source ) oldoffset , oldscale = ( ( normalizer . mean , normalizer . std ) if normalizer is not None else OFFSET_SCALE [ 'pt' ] ) newoffset , newscale = ( target if isinstance ( target , tuple ) else OFFSET_SCALE [ target ] ) return Renormalizer ( oldoffset , oldscale , newoffset , newscale , tobyte = ( target == 'byte' ) )