(compute, batch)
Utility for passing a dataloader batch to a compute function.
Utility for passing a dataloader batch to a compute function.
Utility for passing a dataloader batch to a compute function .
def call_compute(compute, batch):
    '''Utility for passing a dataloader batch to a compute function.'''
    if isinstance(batch, list):
        return compute(*batch)
    elif isinstance(batch, dict):
        return compute(**batch)
    else:
        return compute(batch)
def call_compute ( compute , batch ) : if isinstance ( batch , list ) : return compute ( * batch ) elif isinstance ( batch , dict ) : return compute ( * * batch ) else : return compute ( batch )