Return all the `tf.Operation` which are connected to an op in ops. Args: ops: an object convertible to a list of `tf.Operation`. control_inputs: A boolean indicating whether control inputs are enabled. control_outputs: An instance of `util.ControlOutputs` or `None`. If not `None
(ops, control_inputs=False, control_outputs=None,
control_ios=None)
| 245 | |
| 246 | |
| 247 | def get_ops_ios(ops, control_inputs=False, control_outputs=None, |
| 248 | control_ios=None): |
| 249 | """Return all the `tf.Operation` which are connected to an op in ops. |
| 250 | |
| 251 | Args: |
| 252 | ops: an object convertible to a list of `tf.Operation`. |
| 253 | control_inputs: A boolean indicating whether control inputs are enabled. |
| 254 | control_outputs: An instance of `util.ControlOutputs` or `None`. If not |
| 255 | `None`, control outputs are enabled. |
| 256 | control_ios: An instance of `util.ControlOutputs` or `None`. If not `None`, |
| 257 | both control inputs and control outputs are enabled. This is equivalent to |
| 258 | set `control_inputs` to `True` and `control_outputs` to the |
| 259 | `util.ControlOutputs` instance. |
| 260 | Returns: |
| 261 | All the `tf.Operation` surrounding the given ops. |
| 262 | Raises: |
| 263 | TypeError: if `ops` cannot be converted to a list of `tf.Operation`. |
| 264 | """ |
| 265 | control_inputs, control_outputs = check_cios(control_inputs, control_outputs, |
| 266 | control_ios) |
| 267 | ops = util.make_list_of_op(ops) |
| 268 | res = [] |
| 269 | for op in ops: |
| 270 | util.concatenate_unique(res, [t.op for t in op.inputs]) |
| 271 | for t in op.outputs: |
| 272 | util.concatenate_unique(res, t.consumers()) |
| 273 | if control_outputs is not None: |
| 274 | util.concatenate_unique(res, control_outputs.get(op)) |
| 275 | if control_inputs: |
| 276 | util.concatenate_unique(res, op.control_inputs) |
| 277 | return res |
| 278 | |
| 279 | |
| 280 | def compute_boundary_ts(ops): |
no test coverage detected