Registers the function, adds it to the graph g or default graph. Args: g: If specified, registers the function with this graph. Defaults to the current context (either the default graph or the eager context).
(self, g=None)
| 1317 | expand_composites=False) |
| 1318 | |
| 1319 | def add_to_graph(self, g=None): |
| 1320 | """Registers the function, adds it to the graph g or default graph. |
| 1321 | |
| 1322 | Args: |
| 1323 | g: If specified, registers the function with this graph. Defaults to the |
| 1324 | current context (either the default graph or the eager context). |
| 1325 | """ |
| 1326 | # If we are not executing eagerly, adds the function to default graph if no |
| 1327 | # graph is specified. |
| 1328 | # In case of eager execution, function definition gets added to context |
| 1329 | # during construction itself. |
| 1330 | |
| 1331 | if not context.executing_eagerly() and not g: |
| 1332 | g = ops.get_default_graph() |
| 1333 | self._delayed_rewrite_functions.forward.add_to_graph(g) |
| 1334 | |
| 1335 | def add_gradient_functions_to_graph(self, g=None): |
| 1336 | """Add forward/backward functions to graph `g` or the current context.""" |