junrushao commented on code in PR #15487:
URL: https://github.com/apache/tvm/pull/15487#discussion_r1296709662


##########
python/tvm/relax/frontend/nn/spec.py:
##########
@@ -268,10 +306,24 @@ def _effects() -> List[Tuple[str, core.Effect]]:
                 result.append((name, effect))
             return result
 
+        def _extern_modules() -> List[Tuple[str, List[str]]]:
+            mod2func = {}
+            for _, extern_module in core._attribute_finder(
+                spec.module, "", condition_yield=lambda x: isinstance(x, 
core.ExternModule)
+            ):
+                module_spec = extern_module.module_spec
+                if not module_spec.filename in mod2func:
+                    mod2func[module_spec.filename] = set()

Review Comment:
   using
   
   ```
   from collections import defaultdict
   
   mod2func = defaultdict(set)
   ```
   
   to avoid checking if `mod2func` contains `module_spec.filename`.



-- 
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]

Reply via email to