Thrsu opened a new issue, #15892:
URL: https://github.com/apache/tvm/issues/15892
I encountered a TypeError while trying to convert a TorchFX layer_norm model
to TVM using the from_fx function. The error occurs in the TVM code when
processing the layer_norm operation.
### Actual behavior
```
Traceback (most recent call last):
File "layer_norm.py", line 19, in <module>
mod = from_fx(fx_model, input_info)
File
"/workplace/software/tvm/tvm/python/tvm/relax/frontend/torch/fx_translator.py",
line 1484, in from_fx
return TorchFXImporter().from_fx(
File
"/workplace/software/tvm/tvm/python/tvm/relax/frontend/torch/fx_translator.py",
line 1371, in from_fx
self.env[node] = self.convert_map[func_name](node)
File
"/workplace/software/tvm/tvm/python/tvm/relax/frontend/torch/fx_translator.py",
line 872, in _layer_norm
node.args[1] if type(node.args[1]) == tuple else self.env[node.args[1]]
TypeError: unhashable type: 'immutable_list'
```
### Environment
- branch: unity
- tvm: v0.14.dev0-595-gfa0d35b
- torch: 2.0.1
### Steps to reproduce
```python
import torch
from torch import fx
from torch.nn import Module
import tvm
from tvm import relax
from tvm.relax.frontend.torch import from_fx
input_data = torch.randn([1, 3, 10, 10], dtype=torch.float32)
para_1 = [10]
para_2 = torch.randn([10], dtype=torch.float32)
para_3 = torch.randn([10], dtype=torch.float32)
class layer_norm(Module):
def forward(self, input):
return torch.nn.functional.layer_norm(input, para_1,para_2,para_3,)
model = layer_norm().float()
input_info = list(zip([list(inp.shape) for inp in input_data],
[str(inp.dtype) for inp in input_data]))
fx_model : torch.fx.GraphModule = fx.symbolic_trace(model)
with torch.no_grad():
mod = from_fx(fx_model, input_info)
```
### Triage
* needs-triage
--
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]