mshr-h opened a new pull request, #17330:
URL: https://github.com/apache/tvm/pull/17330
With torch==2.4, the `normalized_shape` argument of the
`torch.nn.functional.layer_norm` can be
`torch.fx.immutable_collections.immutable_list`.
This PR update the layer_norm conveter to cast it to tuple when the
`normalized_shape` argument is `immutable_list`.
```
> verify_model(model, input_info, binding, expected3)
tests/python/relax/test_frontend_from_fx.py:1323:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
tests/python/relax/test_frontend_from_fx.py:36: in verify_model
mod = from_fx(graph_model, input_info)
python/tvm/relax/frontend/torch/fx_translator.py:1770: in from_fx
return TorchFXImporter().from_fx(
python/tvm/relax/frontend/torch/fx_translator.py:1653: in from_fx
self.env[node] = self.convert_map[func_name](node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _
self = <tvm.relax.frontend.torch.fx_translator.TorchFXImporter object at
0x778d11543da0>, node = layer_norm
def _layer_norm(self, node: fx.node.Node) -> relax.Var:
import torch # type: ignore
import numpy as np # type: ignore
x = self.env[node.args[0]]
# functional.layer_norm
if node.target not in self.named_modules:
# static or symbolic
arg = node.args[1]
if isinstance(arg, tuple):
value = arg
else:
try:
> value = self.env[arg]
E KeyError: [10, 10]
python/tvm/relax/frontend/torch/fx_translator.py:1084: KeyError
```
cc @vinx13 @yongwww @Hzfengsy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]