

The structure of this breakdown is to support relatively seamless support for CPU/GPU, while supporting doing
pre/postprocessing on the CPU on different threads
preprocess will take the originally defined inputs, and turn them into something feedable to the model. It might
contain more information and is usually a Dict.
_forward is the implementation detail and is not meant to be called directly. forward is the preferred
called method as it contains safeguards to make sure everything is working on the expected device. If anything is
linked to a real model it belongs in the _forward method, anything else is in the preprocess/postprocess.
postprocess methods will take the output of _forward and turn it into the final output that was decided
earlier.
_sanitize_parameters exists to allow users to pass any parameters whenever they wish, be it at initialization
time pipeline(., maybe_arg=4) or at call time pipe = pipeline(); output = pipe(., maybe_arg=4).
The returns of _sanitize_parameters are the 3 dicts of kwargs that will be passed directly to preprocess,
_forward, and postprocess. Don't fill anything if the caller didn't call with any extra parameter. That
allows to keep the default arguments in the function definition which is always more "natural".
A classic example would be a top_k argument in the post processing in classification tasks.
thon