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


##########
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()
+                mod2func[module_spec.filename].update(
+                    [function_spec.symbol for function_spec in 
module_spec.functions]
+                )
+            return [(mod, list(mod2func[mod])) for mod in mod2func]

Review Comment:
   always prefer `[f(k, v) for k, v in dict.items()]` to `[f(k, dict[k]) for k 
in dict]`



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