Support non-scalar inputs (just flatten everything as they have to be 1d)