|
18 | 18 | cast,
|
19 | 19 | )
|
20 | 20 |
|
21 |
| -import tensorrt as trt |
22 | 21 | import torch
|
23 | 22 | from torch import SymBool, SymFloat, SymInt
|
24 | 23 | from torch._ops import OpOverloadPacket
|
|
27 | 26 | from torch_tensorrt.dynamo.conversion._ConversionContext import ConversionContext
|
28 | 27 | from torch_tensorrt.fx.converter_registry import CONVERTERS as FX_CONVERTERS
|
29 | 28 |
|
| 29 | +import tensorrt as trt |
| 30 | + |
30 | 31 | logger = logging.getLogger(__name__)
|
31 | 32 |
|
32 | 33 | LegacyConverterImplSignature = Callable[
|
@@ -440,25 +441,33 @@ def __getitem__(
|
440 | 441 | ):
|
441 | 442 | if key in registry:
|
442 | 443 | converters = registry[key]
|
443 |
| - |
444 | 444 | if isinstance(converters, (list, tuple)):
|
445 |
| - for candidate in converters: |
| 445 | + logger.debug(f"Converter options for {key}: {len(converters)}") |
| 446 | + for i, candidate in enumerate(converters): |
446 | 447 | # We enable the converter under 4 conditions
|
447 | 448 | # 1) capability validator is True
|
448 | 449 | # 2) Assume dynamic_shape support is True
|
449 | 450 | # 3) Node only has static shaped inputs
|
450 | 451 | # 4) Node has dynamic inputs and the converter has supports_dynamic_shapes=True
|
451 |
| - if candidate.capability_validator( |
| 452 | + if is_valid := candidate.capability_validator( |
452 | 453 | node, self.compilation_settings
|
453 | 454 | ) and (
|
454 | 455 | assume_dynamic_shape_support
|
455 | 456 | or not node_has_dynamic_shapes(node)
|
456 | 457 | or candidate.supports_dynamic_shapes
|
457 | 458 | ):
|
| 459 | + logger.debug( |
| 460 | + f"Selecting converter option {i} for converting {key}" |
| 461 | + ) |
458 | 462 | return (
|
459 | 463 | candidate.converter_implementation,
|
460 | 464 | calling_convention,
|
461 | 465 | )
|
| 466 | + else: |
| 467 | + logger.debug( |
| 468 | + f"Skipping option {i} for {key}: (validator: {is_valid}, supports dynamic shapes: {candidate.supports_dynamic_shapes})" |
| 469 | + ) |
| 470 | + continue |
462 | 471 | else:
|
463 | 472 | # Assuming FX converters don't have dynamic shapes supported
|
464 | 473 | if not node_has_dynamic_shapes(node):
|
|
0 commit comments