Return the union of a forward and a backward walk. Args: forward_seed_ops: an iterable of operations from which the forward graph walk starts. If a list of tensors is given instead, the seed_ops are set to be the consumers of those tensors. backward_seed_ops: an iterable of op
(forward_seed_ops,
backward_seed_ops,
forward_inclusive=True,
backward_inclusive=True,
within_ops=None,
within_ops_fn=None,
control_inputs=False,
control_outputs=None,
control_ios=None)
| 556 | |
| 557 | |
| 558 | def get_walks_union_ops(forward_seed_ops, |
| 559 | backward_seed_ops, |
| 560 | forward_inclusive=True, |
| 561 | backward_inclusive=True, |
| 562 | within_ops=None, |
| 563 | within_ops_fn=None, |
| 564 | control_inputs=False, |
| 565 | control_outputs=None, |
| 566 | control_ios=None): |
| 567 | """Return the union of a forward and a backward walk. |
| 568 | |
| 569 | Args: |
| 570 | forward_seed_ops: an iterable of operations from which the forward graph |
| 571 | walk starts. If a list of tensors is given instead, the seed_ops are set |
| 572 | to be the consumers of those tensors. |
| 573 | backward_seed_ops: an iterable of operations from which the backward graph |
| 574 | walk starts. If a list of tensors is given instead, the seed_ops are set |
| 575 | to be the generators of those tensors. |
| 576 | forward_inclusive: if True the given forward_seed_ops are also part of the |
| 577 | resulting set. |
| 578 | backward_inclusive: if True the given backward_seed_ops are also part of the |
| 579 | resulting set. |
| 580 | within_ops: restrict the search within those operations. If within_ops is |
| 581 | None, the search is done within the whole graph. |
| 582 | within_ops_fn: if provided, a function on ops that should return True iff |
| 583 | the op is within the graph traversal. This can be used along within_ops, |
| 584 | in which case an op is within if it is also in within_ops. |
| 585 | control_inputs: A boolean indicating whether control inputs are enabled. |
| 586 | control_outputs: An instance of util.ControlOutputs or None. If not None, |
| 587 | control outputs are enabled. |
| 588 | control_ios: An instance of util.ControlOutputs or None. If not None, both |
| 589 | control inputs and control outputs are enabled. This is equivalent to set |
| 590 | control_inputs to True and control_outputs to the util.ControlOutputs |
| 591 | instance. |
| 592 | Returns: |
| 593 | A Python set of all the tf.Operation in the union of a forward and a |
| 594 | backward walk. |
| 595 | Raises: |
| 596 | TypeError: if forward_seed_ops or backward_seed_ops or within_ops cannot be |
| 597 | converted to a list of tf.Operation. |
| 598 | """ |
| 599 | control_inputs, control_outputs = check_cios(control_inputs, control_outputs, |
| 600 | control_ios) |
| 601 | forward_ops = get_forward_walk_ops( |
| 602 | forward_seed_ops, |
| 603 | inclusive=forward_inclusive, |
| 604 | within_ops=within_ops, |
| 605 | within_ops_fn=within_ops_fn, |
| 606 | control_outputs=control_outputs) |
| 607 | backward_ops = get_backward_walk_ops( |
| 608 | backward_seed_ops, |
| 609 | inclusive=backward_inclusive, |
| 610 | within_ops=within_ops, |
| 611 | within_ops_fn=within_ops_fn, |
| 612 | control_inputs=control_inputs) |
| 613 | return util.concatenate_unique(forward_ops, backward_ops) |
| 614 | |
| 615 |
nothing calls this directly
no test coverage detected