much faster implementation of transform.inputs2ml