tract icon indicating copy to clipboard operation
tract copied to clipboard

Resize operator output

Open cchudant opened this issue 3 years ago • 4 comments

Hello! I have some trouble with the ONNX Resize operator.

Short list:

  • Does not support mode: nearest & nearest_modes like floor, ceil, round_prefer_ceil, round_prefer_floor (Fixed by #723)
  • Does not support coordinate_transformation_mode: pytorch_half_pixel
  • If one of the output dimension is < than the input dimension, it won't resize on that axis (this is the reason msot of the onnx tests don't pass) -- see https://github.com/sonos/tract/blob/main/onnx/src/ops/resize.rs#L146
  • if the optional roi input is not present, inference_rules panics
  • output_facts panics for some of the onnx tests

I am currently trying to solve all (or at least, most) of these issues in a PR, I think this operator needs a bit of a refactor. Before that though, Are you ok with me working on that? Also, should this operator be moved to onnx-opl too, for nnef support?

cchudant avatar Jun 15 '22 12:06 cchudant

Yeah, Resize is typically an operator for which we ourselves have very little interest, so we welcome contribution on it.

I am aware of the limitations. I took an axis-per-axis approach that simplifies code a bit but requires two passes. I only looked at the growing case, not the shrinking case. And I only implemented a handful of the various possible combination.

I have not looked at all at the roi stuff... no big surprise.

Migrating it to -opl would be super nice too. I did not bother doing it because it was so uncooked.

If you plan some heavy refactoring, please give me an opportunity to discuss what you intend to do before throwing yourself at it.

kali avatar Jun 15 '22 12:06 kali

Cool! By refactor I did not mean heavy refactoring, just changing how inference_rules, output_facts are done, moving stuff to opl, and yes, probably redo the evaluation part.

I haven't really thought about how to do Resize without looping on every axes like this yet, but it shouldn't be too hard.

cchudant avatar Jun 15 '22 12:06 cchudant