Skip to content

Commit f2641c5

Browse files
committed
Added the dynamic check in the validator
1 parent 13f9f0b commit f2641c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
get_positive_dim,
2626
is_only_operator_on_placeholder,
2727
)
28+
from torch_tensorrt.dynamo.utils import DYNAMIC_DIM
2829

2930
_LOGGER: logging.Logger = logging.getLogger(__name__)
3031

@@ -2721,6 +2722,13 @@ def sort_validator(node: Node, settings: Optional[CompilationSettings] = None) -
27212722

27222723

27232724
def topk_sort_validator(k: int) -> bool:
2725+
2726+
# topk layer supports dynamic k value but we cannot determine supported dynamic topk value at
2727+
# compile time.
2728+
if k == DYNAMIC_DIM:
2729+
_LOGGER.debug("k value cannot be dynamic!")
2730+
return False
2731+
27242732
if k > 3840:
27252733
_LOGGER.debug(
27262734
f"Currently only topk values up to 3840 are supported, got k={k}."

0 commit comments

Comments
 (0)