Python 'with' handler to help annotate ops with their originator. An op may have an 'original_op' property that indicates the op on which it was based. For example a replica op is based on the op that was replicated and a gradient op is based on the op that was differentiated. All
(self, op)
| 4012 | |
| 4013 | @tf_contextlib.contextmanager |
| 4014 | def _original_op(self, op): |
| 4015 | """Python 'with' handler to help annotate ops with their originator. |
| 4016 | |
| 4017 | An op may have an 'original_op' property that indicates the op on which |
| 4018 | it was based. For example a replica op is based on the op that was |
| 4019 | replicated and a gradient op is based on the op that was differentiated. |
| 4020 | |
| 4021 | All ops created in the scope of this 'with' handler will have |
| 4022 | the given 'op' as their original op. |
| 4023 | |
| 4024 | Args: |
| 4025 | op: The Operation that all ops created in this scope will have as their |
| 4026 | original op. |
| 4027 | |
| 4028 | Yields: |
| 4029 | Nothing. |
| 4030 | """ |
| 4031 | old_original_op = self._default_original_op |
| 4032 | self._default_original_op = op |
| 4033 | try: |
| 4034 | yield |
| 4035 | finally: |
| 4036 | self._default_original_op = old_original_op |
| 4037 | |
| 4038 | @property |
| 4039 | def _name_stack(self): |
no outgoing calls