def _tta_only(learn:Learner, ds_type:DatasetType=DatasetType.Valid, scale:float=1.35) -> Iterator[List[Tensor]]:
    "Computes the outputs for several augmented inputs for TTA"
    dl = learn.dl(ds_type)
    ds = dl.dataset
    old = ds.tfms
    augm_tfm = [o for o in learn.data.train_ds.tfms if o.tfm not in
               (crop_pad, flip_lr, dihedral, zoom)]
    try:
        pbar = master_bar(range(8))
        for i in pbar:
            row = 1 if i&1 else 0
            col = 1 if i&2 else 0
            flip = i&4
            d = {'row_pct':row, 'col_pct':col, 'is_random':False}
            tfm = [*augm_tfm, zoom(scale=scale, **d), crop_pad(**d)]
            if flip: tfm.append(flip_lr(p=1.))
            ds.tfms = tfm
            yield get_preds(learn.model, dl, pbar=pbar, activ=_loss_func2activ(learn.loss_func))[0]
    finally: ds.tfms = old
def _tta_only ( learn : Learner , ds_type : DatasetType = DatasetType . Valid , scale : float = 1.35 ) -> Iterator [ List [ Tensor ] ] : dl = learn . dl ( ds_type ) ds = dl . dataset old = ds . tfms augm_tfm = [ o for o in learn . data . train_ds . tfms if o . tfm not in ( crop_pad , flip_lr , dihedral , zoom ) ] try : pbar = master_bar ( range ( 8 ) ) for i in pbar : row = 1 if i & 1 else 0 col = 1 if i & 2 else 0 flip = i & 4 d = { 'row_pct' : row , 'col_pct' : col , 'is_random' : False } tfm = [ * augm_tfm , zoom ( scale = scale , ** d ) , crop_pad ( ** d ) ] if flip : tfm . append ( flip_lr ( p = 1. ) ) ds . tfms = tfm yield get_preds ( learn . model , dl , pbar = pbar , activ = _loss_func2activ ( learn . loss_func ) ) [ 0 ] finally : ds . tfms = old
Computes the outputs for several augmented inputs for TTA