Adds this function into the graph g.
(self, g)
| 541 | return hasher.hexdigest()[:8] |
| 542 | |
| 543 | def add_to_graph(self, g): |
| 544 | """Adds this function into the graph g.""" |
| 545 | self._create_definition_if_needed() |
| 546 | |
| 547 | # Adds this function into 'g'. |
| 548 | # pylint: disable=protected-access |
| 549 | if context.executing_eagerly(): |
| 550 | context.context().add_function_def(self.definition) |
| 551 | else: |
| 552 | g._add_function(self) |
| 553 | # pylint: enable=protected-access |
| 554 | |
| 555 | # Ensures related sub-routines are defined in 'g', too. |
| 556 | for f in self._sub_functions.values(): |
| 557 | f.add_to_graph(g) |
| 558 | |
| 559 | # Adds its gradient function, too. |
| 560 | if self._grad_func: |
| 561 | self._grad_func.add_to_graph(g) |
| 562 | |
| 563 | def __call__(self, *args, **kwargs): |
| 564 | self.add_to_graph(ops.get_default_graph()) |
no test coverage detected