Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __init__(self, funcs=None, as_item=False, split_idx=None): | |
self.split_idx,self.default = split_idx,None | |
if isinstance(funcs, Pipeline): self.fs = funcs.fs | |
else: | |
if isinstance(funcs, Transform): funcs = [funcs] | |
self.fs = L(ifnone(funcs,[noop])).map(mk_transform).sorted(key='order') | |
for f in self.fs: | |
name = camel2snake(type(f).__name__) | |
a = getattr(self,name,None) | |
if a is not None: f = L(a)+f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Cell | |
class TfmdList(FilteredBase, L, GetAttr): | |
"A `Pipeline` of `tfms` applied to a collection of `items`" | |
_default='tfms' | |
def __init__(self, items, tfms, use_list=None, do_setup=True, as_item=True, split_idx=None, train_setup=True, splits=None): | |
super().__init__(items, use_list=use_list) | |
self.splits = L([slice(None),[]] if splits is None else splits).map(mask2idxs) | |
if isinstance(tfms,TfmdList): tfms = tfms.tfms | |
if isinstance(tfms,Pipeline): do_setup=False | |
self.tfms = Pipeline(tfms, as_item=as_item, split_idx=split_idx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Cell | |
@docs | |
@delegates(TfmdList) | |
class DataSource(FilteredBase): | |
"A dataset that creates a tuple from each `tfms`, passed thru `item_tfms`" | |
def __init__(self, items=None, tfms=None, tls=None, n_inp=None, dl_type=None, **kwargs): | |
super().__init__(dl_type=dl_type) | |
self.tls = L(tls if tls else [TfmdList(items, t, **kwargs) for t in L(ifnone(tfms,[None]))]) | |
self.n_inp = (1 if len(self.tls)==1 else len(self.tls)-1) if n_inp is None else n_inp |