TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

✨[Feature] Expand index converter support to boolean masks

Open zewenli98 opened this issue 2 years ago • 3 comments

Current index converter only supports int type while cannot handle bool mask indices.

We need to expand index support to boolean masks, since this is a valid usage in Torch and we already support something very similar in aten.where.

Reported in the bug: #2480

zewenli98 avatar Dec 06 '23 01:12 zewenli98

#2487

zewenli98 avatar Dec 06 '23 01:12 zewenli98

I think for this converter, the output shape is dynamic because it depends on the mask. It's similar to a bug reported in #2516. So let's wait for getting TRT bug fixed.

zewenli98 avatar Dec 11 '23 22:12 zewenli98

I think for this converter, the output shape is dynamic because it depends on the mask. It's similar to a bug reported in #2516. So let's wait for getting TRT bug fixed.

@zewenli98 One thing to note in the case of x[mask] is that mask is a boolean tensor. And in the index converter implementation, https://github.com/pytorch/TensorRT/blob/main/py/torch_tensorrt/dynamo/conversion/impl/select.py#L130 the indices tensor received would be a boolean mask. This boolean mask should be converted to indices (where the non zero valued indices should be extracted. I'm not sure if TRT has such an operator)

peri044 avatar Jan 18 '24 08:01 peri044