-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic data in resolveOutput? #8
Comments
Yes, you assumption is correct. So far all dynamic input I have seen have turned out to be static in the .onnx file. Closest thing to dynamic input is with the LSTM node, but there the dynamic input is kind of on another axis. And how to handle this sort of dynamic input is a good question to which I don't have a good answer. What is the real-world use-case of this sort of dynamically sized input? Maybe that gives a hint on how to handle it? E.g. does it have a natural upper bound that is known at compile time (onnx2c-compile time, that is ) that the buffers can be allocated to? Allocating dynamic memory with malloc() & free() is of course maybe the most straight-forward solution. I don't have any fundamental objection to using them, especially when buffers are allocated and free'd by computer-generated code. Finally there is the question of passing the dynamic size along the tensor info as function parameters. This is going to touch the codebase all over the place. I'm looking forward to all the fringe code cleanups that are bound to show up if you make a pull request out this handling of dynamic tensors :) |
Slightly related: I just pushed in an implementation to the Range node that will work if the inputs are compile-time determinable. The input data being know to the compiler avoids the need for dynamic allocation in these cases. This was made possible due to a slight rework on what const tensors actually mean. Now a Tensor::isConst really means the data in them is not modifiable. Modified input tensors then are passed as const Tensor to nodes - but these are not compile time constants. Now adding a malloc()/free() should not pose problems. Only thing is to find out when the free() can be called. And also, any dynamic allocation should post a warning, or be enabled by a command line option switch. |
Hi! I'm experimenting with additional ONNX nodes, and running into issues with ones that need dynamic tensor input even to be able to determine the output's shape in
resolveOutput
(an easy example is Range, where all three ofstart
,delta
, andlimit
are inputs, not attributes). Am I correct in assuming that this is currently only supported for initialized (i.e., const) nodes? If so, what do you think would need to change to support fully dynamic input in these cases? Thanks!The text was updated successfully, but these errors were encountered: