Skip to content

add vector overloads to rivetonnxrt retrieve

tprocter46 requested to merge extend_onnx_retrieve into release-3-2-x

Builds on discussions in !745 (merged), specifically !745 (comment 1723574540).

Adds an overload to RivetONNXrt's retrieve method for vectors (which previously would have suffered a runtime crash).

It's very easy to overload just vector<float>, but to generalise to any vector (which it seemed lazy not to do), it required a bit of SFINAEish-meddling to avoid duplicated definitions. I've not put any SFINAE into rivet before, and frankly I may have enjoyed myself a little too much doing it, so please let me know if I've missed something. I used the is_container definition we already have elsewhere in the project to avoid re-inventing the wheel. If this is unsatisfactory, then I guess the most rigorous way to do it would be to define some sort of is_lexical_castable struct of our own somewhere, and then enable the original function if the type is lexical castable, and my new function if the type is a vector of lexical castables.

Merge request reports