Import a function from an external module. Note that the `module_name` must be a module name that works with the usual import mechanisms. Shorthands like "tf.nn" will not work. Args: module_name: name of the module function_name: name of the function within the module Return
(module_name, function_name)
| 187 | # These are DSL names, not Python names |
| 188 | # pylint: disable=invalid-name, exec-used |
| 189 | def External(module_name, function_name): |
| 190 | """Import a function from an external module. |
| 191 | |
| 192 | Note that the `module_name` must be a module name |
| 193 | that works with the usual import mechanisms. Shorthands |
| 194 | like "tf.nn" will not work. |
| 195 | |
| 196 | Args: |
| 197 | module_name: name of the module |
| 198 | function_name: name of the function within the module |
| 199 | |
| 200 | Returns: |
| 201 | Function-wrapped value of symbol. |
| 202 | """ |
| 203 | module = importlib.import_module(module_name) |
| 204 | return Function(vars(module)[function_name]) |
| 205 | |
| 206 | |
| 207 | def Import(statements): |