Ejemplo n.º 1
0
def static_functions_pipeline(input_string):
    # Creates a pipeline with a list of functions
    pipe = Pipeline([remove_spaces, remove_special_chars, lowercase])

    # Invokes pipeline
    output = pipe(input_string)

    print(f"""output ==> {output}""")
Ejemplo n.º 2
0
def dynamic_functions_pipeline(input_string, pipe_funcs):
    # Creates a pipeline with a list of functions using using globals()
    pipe = Pipeline([globals()[func] for func in pipe_funcs])

    # Invokes pipeline
    output = pipe(input_string)

    print(f"""output ==> {output}""")
Ejemplo n.º 3
0
def make_cifar_item_tfm(th_img_tfms=None):
    img_tfms = [cfnp2img_tfm]
    if th_img_tfms is not None:
        # assumes th_img_tfms incl ToTensor (cnvt2 PIL.Image -> tensor + div by 255)
        img_tfms += [th_img_tfms]
    else:
        img_tfms += [cfimg_tfm, cfimg2float_tfm]

    return CifarTupleTransform(x_tfm=Pipeline(img_tfms), y_tfm=i2t_tfm)
Ejemplo n.º 4
0
 def __init__(self, **kwargs):
     self.tfms = Pipeline(audio_item_tfms(**kwargs))
Ejemplo n.º 5
0
def after_batch(self:th_data.DataLoader):
    'return empty pipeline when fastai learner looks for after_batch'
    return Pipeline()
Ejemplo n.º 6
0
def test_pipeline():
    pipe = Pipeline([f, g])
    assert 2.0 == pipe(3)