Replies: 4 comments
-
This question seems to involve several things: (a) ONNX, (b) The PyTorch-to-ONNX exporter, and (c) Any backend you use to run the ONNX Model (e.g., ORT). With regards to (a) ONNX itself: yes, in principle, ONNX models support inputs/outputs that are non-tensors (like Sequences or Maps). However, this has never really been used, so there could be bugs/issues relating to it. There is an ongoing PR (#2581 ) that will test at least some aspects of this. For (b) or (c), it may be better to ask in the PyTorch or ORT repos. Your final question is somewhat unclear, but may be it is question meant for PyTorch. The meaning of the dictionary you are using is somewhat unclear. It does not look like a dictionary to me. Rather it sounds like it is meant to be a sequence of images, along with some attributes (like id, original_size) attached to each image. Does the model use any of this data (like id or original_size)? In any case, the key point is whether the operations used are supported by the PyTorch exporter. |
Beta Was this translation helpful? Give feedback.
-
@gramalingam Thank you for your reply! You are right, these are attributes that can be discarded if not in use, I have passed the tensor only to the model now and converted it to onnx Since you are here: is it true that onnx takes as inputs arrays only and not tensors? I mean, I was dealing with adversarial attacks, and one condition to train one of those 'adversarial patches' is that the gradient path from the output of the network back to the input (the image with the adversary) should be intact This also is more an informative question Thanks again for availability! |
Beta Was this translation helpful? Give feedback.
-
I think this question about gradient path is for the training-framework you use (Pytorch?). It sounds like you are concerned with auto-differentiation / backprop issues. It doesn't concern ONNX as far as I can see. |
Beta Was this translation helpful? Give feedback.
-
Yes, you are right. I was wondering if it would be feasible with a .onnx model, namely if it is able to accept also tensors as input since only they have gradients |
Beta Was this translation helpful? Give feedback.
-
Hello, I would have several questions:
I am using a pytorch model that seems to take as input a dictionary, where the first element is the image itself and the second is another dictionary, basically encoding the image_id and the original size.
The first question is maybe not so related to this page, but I use the space to ask: is it really possible to pass a dictionary as input to a model? I usually see that the image tensor is passed
I should convert this model to onnx using torch.onnx.export. Should I pass it the dictionary as input? And in the resulting onnx model, the input would be a dictionary too? I need the input to be a tensor and stop, as I've always seen: should I change the training code?
Beta Was this translation helpful? Give feedback.
All reactions