Process the symbolic gradients. Args: grads (list): list of (grad, var). Returns: list: processed gradients, with the same type as input.
(self, grads)
| 30 | _name_scope = None |
| 31 | |
| 32 | def process(self, grads): |
| 33 | """ |
| 34 | Process the symbolic gradients. |
| 35 | |
| 36 | Args: |
| 37 | grads (list): list of (grad, var). |
| 38 | Returns: |
| 39 | list: processed gradients, with the same type as input. |
| 40 | """ |
| 41 | |
| 42 | # reuse the old name_scope, if process() is called multiple times |
| 43 | if self._name_scope is None: |
| 44 | with tfv1.name_scope(type(self).__name__) as scope: |
| 45 | self._name_scope = scope |
| 46 | return self._process(grads) |
| 47 | else: |
| 48 | with tfv1.name_scope(self._name_scope): |
| 49 | return self._process(grads) |
| 50 | |
| 51 | @abstractmethod |
| 52 | def _process(self, grads): |
no test coverage detected