Add a post-execution callback to the context. A post-execution callback is invoked immediately after an eager operation or function has finished execution, providing access to the op's type, name input and output tensors. Multiple execution callbacks can be added, in which case the
(self, callback)
| 1008 | return bool(pywrap_tensorflow.TFE_ContextHasFunction(self._handle, name)) |
| 1009 | |
| 1010 | def add_post_execution_callback(self, callback): |
| 1011 | """Add a post-execution callback to the context. |
| 1012 | |
| 1013 | A post-execution callback is invoked immediately after an eager operation or |
| 1014 | function has finished execution, providing access to the op's type, name |
| 1015 | input and output tensors. Multiple execution callbacks can be added, in |
| 1016 | which case the callbacks will be invoked in the order in which they are |
| 1017 | added. |
| 1018 | |
| 1019 | Args: |
| 1020 | callback: a callable of the signature |
| 1021 | `f(op_type, op_name, attrs, inputs, outputs)`. |
| 1022 | `op_type` is the type of the operation that was just executed (e.g., |
| 1023 | `MatMul`). |
| 1024 | `op_name` is the name of the operation that has was just executed. This |
| 1025 | name is set by the client who created the operation and can be `None` if |
| 1026 | it is unset. |
| 1027 | `attrs` contains the attributes of the operation as a `tuple` of |
| 1028 | alternating attribute names and attribute values. |
| 1029 | `inputs` is the `list` of input `Tensor`(s) to the op. |
| 1030 | `outputs` is the `list` of output `Tensor`(s) from the op. |
| 1031 | Return value(s) from the callback are ignored. |
| 1032 | """ |
| 1033 | self.post_execution_callbacks.append(callback) |
| 1034 | |
| 1035 | def clear_post_execution_callbacks(self): |
| 1036 | """Clear all post-execution callbacks added to the context.""" |
no test coverage detected