Skip to content
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

[Relax][PyTorch][Bugfix] Update layer_norm converter to support immutable_list for normalized_shape #17330

Merged
merged 1 commit into from
Sep 4, 2024
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
5 changes: 3 additions & 2 deletions python/tvm/relax/frontend/torch/fx_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ def _batch_norm_2d(self, node: fx.node.Node) -> relax.Var:

def _layer_norm(self, node: fx.node.Node) -> relax.Var:
import torch # type: ignore
from torch.fx.immutable_collections import immutable_list
import numpy as np # type: ignore

x = self.env[node.args[0]]
Expand All @@ -1077,8 +1078,8 @@ def _layer_norm(self, node: fx.node.Node) -> relax.Var:
if node.target not in self.named_modules:
# static or symbolic
arg = node.args[1]
if isinstance(arg, tuple):
value = arg
if isinstance(arg, (immutable_list, tuple)):
value = tuple(arg)
else:
try:
value = self.env[arg]
Expand Down
Loading