This raises however a compilation error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]. Of course I can cast away the const-ness of the array, but is there a way to avoid this? Can I somehow use from_blob (or similar) with const data input?
As always, help is highly appreciated…
Thank you & Best regards,
RB
Hi @hoyden, thank you very much for your suggestion. Yes, you are right. I did a similar workaround with a simple memcpy(). The only issue is, that such a a memory copy per input and output tensor hurts runtime execution performance. I will apply this workaround, if there is no other way to deal with const arrays. But is there?
Hi @hoyden, thanks once again for your answer. It’s a bit tricky. We need to extend the ONNX Runtime (ORT) with operators that are not yet present. This can be done since ORT has a pretty nice C/C++ extension mechanism.
To save development time/effort we are basically using Libtorch in the ORT custom operators, and thus just need to interface the input/output data formats between ORT->Torch->ORT. However, the inputs, as defined by ORT come always as const float*. We don’t have a saying in this. We can always cast away the constedness, but that is also not the nicest thing…