Skip to content

refactor: Moving elementwise core to impl (FX Converter Refactor [3/N]) <Target: converter_reorg_proto> #1869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
509 changes: 379 additions & 130 deletions py/torch_tensorrt/fx/converters/acc_ops_converters.py

Large diffs are not rendered by default.

42 changes: 39 additions & 3 deletions py/torch_tensorrt/fx/converters/aten_ops_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from .converter_utils import * # noqa: F403
import torch_tensorrt.fx.tracer.acc_tracer.acc_utils as acc_utils
from torch_tensorrt.fx.converters.impl import activation, convolution
from torch_tensorrt.fx.converters.impl.elementwise import trunc_div
from torch_tensorrt.fx.converters.impl.elementwise import rsqrt

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

Expand Down Expand Up @@ -182,9 +184,7 @@ def aten_ops_div(
network, target, None, kwargs_new, name
)
elif rounding_mode == "trunc":
return acc_ops_converters.acc_ops_trunc_div(
network, target, None, kwargs_new, name
)
return trunc_div(network, target, SourceIR.ATEN, name, args[0], args[1])
else:
raise RuntimeError(
f"Target {target} does not support rounding mode {rounding_mode}"
Expand Down Expand Up @@ -390,6 +390,42 @@ def aten_ops_relu(
)


@tensorrt_converter(torch.ops.aten.relu.default)
def aten_ops_relu(
network: TRTNetwork,
target: Target,
args: Tuple[Argument, ...],
kwargs: Dict[str, Argument],
name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:

return activation.relu(
network,
target,
SourceIR.ATEN,
name,
args[0],
)


@tensorrt_converter(torch.ops.aten.rsqrt.default)
def aten_ops_rsqrt(
network: TRTNetwork,
target: Target,
args: Tuple[Argument, ...],
kwargs: Dict[str, Argument],
name: str,
) -> Union[TRTTensor, Sequence[TRTTensor]]:

return rsqrt(
network,
target,
SourceIR.ATEN,
name,
args[0],
)


@tensorrt_converter(torch.ops.aten.sub.Tensor)
def aten_ops_sub(
network: TRTNetwork,
Expand Down
Loading