Skip to content
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

Can't concat ragged tensors with more than one dimension. #1817

Open
magicaltoast opened this issue Jan 8, 2022 · 1 comment
Open

Can't concat ragged tensors with more than one dimension. #1817

magicaltoast opened this issue Jan 8, 2022 · 1 comment
Labels
contribution welcome Community contribution is welcomed enhancement New feature or request

Comments

@magicaltoast
Copy link

Describe the bug
Can't concat ragged tensors with more than one dimension.

I want to decode results from the object detector. I am using tf.ragged.boolean_mask(bboxes, pos_inds) to gather results above threshold but my detector has multiple scales like yolo family so I need to concatenate it to one tensor to perform nonmax suppression. There's is no problem with scores because is a 1d tensor but it fails to convert bounding boxes.

That feature would allow avoiding builder plate code for decoding object detection results because the decoding step would be inside onnx model.

System information

  • OS Platform and Distribution: Ubuntu 21.04
  • Tensorflow Version: 2.7.0
  • Python version: 3.8.8

To Reproduce

i1 = Input((None, 4), ragged=True, batch_size=1)
i2 = Input((None, 4), ragged=True, batch_size=1)
# None in shape above means that i have unknow number of detection per scale, 4 is for bounding box
o = tf.concat([i1, i2], axis=1)
m = Model([i1, i2], o)
m.save("model")
python -m tf2onnx.convert --saved-model model --output model.onnx --opset 15

Error

ValueError: make_sure failure: RaggedGather conversion only supports tensors with no dense dimensions
@hwangdeyu hwangdeyu added the enhancement New feature or request label Jan 18, 2022
@hwangdeyu
Copy link
Contributor

Now the ONNX doesn't support ragged tensors. Converter can convert rank-1 ragged tensors but currently can't do larger than rank-1.
We could potentially support higher ranks with a loop, but that would probably not be very efficient now.

@hwangdeyu hwangdeyu added the contribution welcome Community contribution is welcomed label Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Community contribution is welcomed enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants