Determines if `op` needs a control dependency.
(op)
| 1768 | """Add a control input to the op if it only depends on loop invariants.""" |
| 1769 | |
| 1770 | def _IsOpFree(op): |
| 1771 | """Determines if `op` needs a control dependency.""" |
| 1772 | if op.control_inputs: |
| 1773 | return False |
| 1774 | # pylint: disable=protected-access |
| 1775 | if op.graph._is_function(op.type) or op.type == "SymbolicGradient": |
| 1776 | return True |
| 1777 | # pylint: enable=protected-access |
| 1778 | for x in op.inputs: |
| 1779 | if not util.IsLoopConstantEnter(x.op): |
| 1780 | return False |
| 1781 | return True |
| 1782 | |
| 1783 | if _IsOpFree(op): |
| 1784 | # pylint: disable=protected-access |
nothing calls this directly
no test coverage detected