Skip to content

Commit f76f1d9

Browse files
committed
validator for index non zero case- else error- Could not find any implementation for node [NON_ZERO]-[aten_ops.index.Tensor]-[index_tensor_bool_nonzero_1]
1 parent aa19802 commit f76f1d9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,23 @@ def index_dtype_validator(
425425
return True
426426

427427

428+
def index_nonbool_validator(
429+
node: Node, settings: Optional[CompilationSettings] = None
430+
) -> bool:
431+
# for thor, we don't support boolean indices
432+
if is_thor():
433+
index = node.args[1]
434+
for ind in index:
435+
if ind is not None:
436+
val = ind.meta.get("val")
437+
if val is not None and val.dtype == torch.bool:
438+
return False
439+
return True
440+
441+
428442
@dynamo_tensorrt_converter(
429443
torch.ops.aten.index.Tensor,
430-
capability_validator=index_dtype_validator,
444+
capability_validator=index_dtype_validator and index_nonbool_validator,
431445
supports_dynamic_shapes=True,
432446
requires_output_allocator=True,
433447
)

0 commit comments

Comments
 (0)