(compute, dataset, sample_size=None, batch_size=10,
        r=4096, cachefile=None, **kwargs)
Computes quantile sketch statistics for a large data sample that can
    be computed from a dataset.  The compute function should return one
    batch of samples as a (sample, unit)-dimension tensor.

    The underlying quantile sketch is an optimal KLL sorted sampler that
    retains at least r samples (where r is the specified resolution).
Computes quantile sketch statistics for a large data sample that can
    be computed from a dataset.  The compute function should return one
    batch of samples as a (sample, unit)-dimension tensor.
Computes quantile sketch statistics for a large data sample that can be computed from a dataset . The compute function should return one batch of samples as a ( sample unit ) - dimension tensor .
def tally_quantile(compute, dataset, sample_size=None, batch_size=10,
        r=4096, cachefile=None, **kwargs):
    '''
    Computes quantile sketch statistics for a large data sample that can
    be computed from a dataset.  The compute function should return one
    batch of samples as a (sample, unit)-dimension tensor.

    The underlying quantile sketch is an optimal KLL sorted sampler that
    retains at least r samples (where r is the specified resolution).
    '''
    with torch.no_grad():
        args = dict(sample_size=sample_size, r=r)
        cached_state = load_cached_state(cachefile, args)
        if cached_state is not None:
            return runningstats.RunningQuantile(state=cached_state)
        loader = make_loader(dataset, sample_size, batch_size, **kwargs)
        rq = runningstats.RunningQuantile()
        for batch in pbar(loader):
            sample = call_compute(compute, batch)
            rq.add(sample)
        rq.to_('cpu')
        save_cached_state(cachefile, rq, args)
        return rq
def tally_quantile ( compute , dataset , sample_size = None , batch_size = 10 , r = 4096 , cachefile = None , * * kwargs ) : with torch . no_grad ( ) : args = dict ( sample_size = sample_size , r = r ) cached_state = load_cached_state ( cachefile , args ) if cached_state is not None : return runningstats . RunningQuantile ( state = cached_state ) loader = make_loader ( dataset , sample_size , batch_size , * * kwargs ) rq = runningstats . RunningQuantile ( ) for batch in pbar ( loader ) : sample = call_compute ( compute , batch ) rq . add ( sample ) rq . to_ ( 'cpu' ) save_cached_state ( cachefile , rq , args ) return rq