Skip to content

feat: Exempt default softmax from decomposition #2268

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

Merged
merged 1 commit into from
Aug 26, 2023
Merged
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
12 changes: 7 additions & 5 deletions py/torch_tensorrt/dynamo/lowering/_decomposition_groups.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from typing import Any, Callable, Dict, Set
from typing import Any, Callable, Dict, Set, Union

import torch
from torch._decomp import core_aten_decompositions
from torch._decomp import get_decompositions as get_torch_decompositions
from torch._ops import OpOverload
from torch._ops import OpOverload, OpOverloadPacket

aten = torch.ops.aten

_core_aten_decompositions: Dict[
OpOverload, Callable[[Any], Any]
] = core_aten_decompositions()
torch_enabled_decompositions: Set[OpOverload] = {
torch_enabled_decompositions: Set[Union[OpOverload, OpOverloadPacket]] = {
aten._adaptive_avg_pool2d_backward,
aten.addcdiv,
aten.addcdiv_,
Expand Down Expand Up @@ -140,7 +140,7 @@
aten.smooth_l1_loss_backward,
aten.soft_margin_loss,
aten.soft_margin_loss_backward,
aten._softmax,
aten._softmax.out,
aten._softmax_backward_data,
aten.softplus,
aten.softplus_backward,
Expand Down Expand Up @@ -176,7 +176,9 @@
aten.full,
aten.repeat,
}
torch_disabled_decompositions: Set[OpOverload] = set()
torch_disabled_decompositions: Set[Union[OpOverload, OpOverloadPacket]] = {
aten._softmax.default,
}


ENABLED_TORCH_DECOMPOSITIONS: Dict[
Expand Down