Skip to content

Commit a300a34

Browse files
committed
rewrote the comment
1 parent 8a33160 commit a300a34

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

py/torch_tensorrt/dynamo/conversion/aten_ops_converters.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,12 +2699,14 @@ def topk_sort_validator(k: int) -> bool:
26992699
# topk layer supports dynamic k value but we cannot determine supported dynamic topk value at
27002700
# compile time.
27012701
if k == DYNAMIC_DIM:
2702-
_LOGGER.debug("k value cannot be dynamic!")
2702+
_LOGGER.debug(
2703+
"[top_k validator] Converter does not support k being a dynamic value. Therefore, aten::topk will run in PyTorch"
2704+
)
27032705
return False
27042706

27052707
if k > 3840:
27062708
_LOGGER.debug(
2707-
f"Currently only topk values up to 3840 are supported, got k={k}."
2709+
f"[top_k validator] Currently only topk values up to 3840 are supported, got k={k}. Therefore, aten::topk will run in PyTorch"
27082710
)
27092711
return False
27102712
return True

py/torch_tensorrt/dynamo/conversion/impl/topk.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@ def topk(
209209
get_axes_for_reduce_op(get_positive_dim(dim, len(input.shape))),
210210
)
211211

212-
# topk layer supports dynamic k value but we cannot dertermin supported dynamic topk value at
213-
# compile time.
214-
assert k != DYNAMIC_DIM, "k value cannot be dynamic!"
215-
216212
# TensorRT ITopKLayer does not have a sorted flag, it is always returning the sorted topk elements
217213
# so here no matter sorted is True or False the returned the topk Tensor object is always sorted
218214
set_layer_name(topk_layer, target, f"{name}_topk", source_ir)

0 commit comments

Comments
 (0)