Add the control inputs cops to op. Warning: this function is directly manipulating the internals of the tf.Graph. Args: op: a tf.Operation to which the control inputs are added. cops: an object convertible to a list of `tf.Operation`. Raises: TypeError: if op is not a tf.Operatio
(op, cops)
| 479 | |
| 480 | |
| 481 | def add_control_inputs(op, cops): |
| 482 | """Add the control inputs cops to op. |
| 483 | |
| 484 | Warning: this function is directly manipulating the internals of the tf.Graph. |
| 485 | |
| 486 | Args: |
| 487 | op: a tf.Operation to which the control inputs are added. |
| 488 | cops: an object convertible to a list of `tf.Operation`. |
| 489 | Raises: |
| 490 | TypeError: if op is not a tf.Operation |
| 491 | ValueError: if any cop in cops is already a control input of op. |
| 492 | """ |
| 493 | if not isinstance(op, _tf_ops.Operation): |
| 494 | raise TypeError("Expected a tf.Operation, got: {}", type(op)) |
| 495 | cops = _util.make_list_of_op(cops, allow_graph=False) |
| 496 | for cop in cops: |
| 497 | if cop in op.control_inputs: |
| 498 | raise ValueError("{} is already a control_input of {}".format(cop.name, |
| 499 | op.name)) |
| 500 | op._add_control_inputs(cops) # pylint: disable=protected-access |
| 501 | |
| 502 | remove_undocumented(__name__, _allowed_symbols) |
nothing calls this directly
no test coverage detected