locnd182644 opened a new pull request, #18574:
URL: https://github.com/apache/tvm/pull/18574
## Summary
Happen error when create module from exported_program have torch.mean
without dim.
## Reproduce
- Module:
```
class MeanModule(nn.Module):
def forward(self, x):
return torch.mean(x)
...
# Export → Relax
ep = torch_export(m, (x,))
mod = from_exported_program(ep)
```
- Error log:
```
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[2], line 13
11 # Export → Relax
12 ep = torch_export(m, (x,))
---> 13 mod = from_exported_program(ep)
15 mod.show()
17 target = "llvm"
File
~/Programming/tvm/python/tvm/relax/frontend/torch/exported_program_translator.py:1783,
in from_exported_program(exported_program, keep_params_as_input,
unwrap_unit_return_tuple, no_bind_return_tuple, run_ep_decomposition)
1780 if run_ep_decomposition:
1781 exported_program = exported_program.run_decompositions()
-> 1783 return ExportedProgramImporter().from_exported_program(
1784 exported_program,
1785 keep_params_as_input,
1786 unwrap_unit_return_tuple,
1787 no_bind_return_tuple,
1788 )
File
~/Programming/tvm/python/tvm/relax/frontend/torch/exported_program_translator.py:1642,
in ExportedProgramImporter.from_exported_program(self, exported_program,
keep_params_as_input, unwrap_unit_return_tuple, no_bind_return_tuple)
1639 nodes: List[fx.Node] = exported_program.graph.nodes
1641 # Find all the missing function types
-> 1642 self._check_unsupported_func_type(nodes)
1644 with self.block_builder.function(
1645 name=func_name, params=list(inputs_vars.values()).copy(),
attrs=func_attrs
1646 ):
1647 output = None
File
~/Programming/tvm/python/tvm/relax/frontend/torch/base_fx_graph_translator.py:182,
in BaseFXGraphImporter._check_unsupported_func_type(self, nodes)
174 def _check_unsupported_func_type(self, nodes: List[fx.Node]):
175 missing_func_types = list(
176 {
177 node.target.__name__
(...) 180 }
181 )
--> 182 assert not missing_func_types, f"Unsupported function types
{missing_func_types}"
AssertionError: Unsupported function types ['mean.default']
```
## Resolve:
- Add "mean.default" into create_convert_map in class
ExportedProgramImporter.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]