-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
86 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from ._TRTInterpreter import * # noqa: F403 | ||
from .aten_ops_converters import * # noqa: F403 | ||
from .conversion import * # noqa: F403 | ||
from .op_evaluators import * # noqa: F403 | ||
from .truncate_long_and_double import repair_long_or_double_inputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
condition, | ||
elementwise, | ||
embedding, | ||
evaluators, | ||
matmul, | ||
normalization, | ||
permutation, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
import operator | ||
from typing import Dict, Sequence, Tuple, Union | ||
|
||
from torch.fx.node import Argument, Node, Target | ||
from torch_tensorrt.fx.types import TRTNetwork, TRTTensor | ||
|
||
from .converter_registry import ConverterRegistry, dynamo_tensorrt_converter | ||
|
||
_LOGGER: logging.Logger = logging.getLogger(__name__) | ||
|
||
|
||
def getitem_validator(getitem_node: Node) -> bool: | ||
from torch_tensorrt.dynamo.conversion.converter_registry import DYNAMO_CONVERTERS | ||
|
||
# Getitem nodes can only be converted if their parent node also can | ||
return getitem_node.args[0] in DYNAMO_CONVERTERS | ||
|
||
|
||
# TODO: Subsequent evaluators should be registered here with their own validators | ||
@dynamo_tensorrt_converter(operator.getitem, capability_validator=getitem_validator) | ||
def generic_evaluator( | ||
network: TRTNetwork, | ||
target: Target, | ||
args: Tuple[Argument, ...], | ||
kwargs: Dict[str, Argument], | ||
name: str, | ||
) -> Union[TRTTensor, Sequence[TRTTensor]]: | ||
_LOGGER.debug( | ||
f"Evaluating {ConverterRegistry.qualified_name_or_str(target)} on object with name: {name}" | ||
) | ||
return target(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters