MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / get_walks_intersection_ops

Function get_walks_intersection_ops

tensorflow/contrib/graph_editor/select.py:499–555  ·  view source on GitHub ↗

Return the intersection 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 iterabl

(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)

Source from the content-addressed store, hash-verified

497
498
499def get_walks_intersection_ops(forward_seed_ops,
500 backward_seed_ops,
501 forward_inclusive=True,
502 backward_inclusive=True,
503 within_ops=None,
504 within_ops_fn=None,
505 control_inputs=False,
506 control_outputs=None,
507 control_ios=None):
508 """Return the intersection of a forward and a backward walk.
509
510 Args:
511 forward_seed_ops: an iterable of operations from which the forward graph
512 walk starts. If a list of tensors is given instead, the seed_ops are set
513 to be the consumers of those tensors.
514 backward_seed_ops: an iterable of operations from which the backward graph
515 walk starts. If a list of tensors is given instead, the seed_ops are set
516 to be the generators of those tensors.
517 forward_inclusive: if True the given forward_seed_ops are also part of the
518 resulting set.
519 backward_inclusive: if True the given backward_seed_ops are also part of the
520 resulting set.
521 within_ops: an iterable of tf.Operation within which the search is
522 restricted. If within_ops is None, the search is performed within
523 the whole graph.
524 within_ops_fn: if provided, a function on ops that should return True iff
525 the op is within the graph traversal. This can be used along within_ops,
526 in which case an op is within if it is also in within_ops.
527 control_inputs: A boolean indicating whether control inputs are enabled.
528 control_outputs: An instance of util.ControlOutputs or None. If not None,
529 control outputs are enabled.
530 control_ios: An instance of util.ControlOutputs or None. If not None, both
531 control inputs and control outputs are enabled. This is equivalent to set
532 control_inputs to True and control_outputs to the util.ControlOutputs
533 instance.
534 Returns:
535 A Python set of all the tf.Operation in the intersection of a forward and a
536 backward walk.
537 Raises:
538 TypeError: if `forward_seed_ops` or `backward_seed_ops` or `within_ops`
539 cannot be converted to a list of `tf.Operation`.
540 """
541 control_inputs, control_outputs = check_cios(control_inputs, control_outputs,
542 control_ios)
543 forward_ops = get_forward_walk_ops(
544 forward_seed_ops,
545 inclusive=forward_inclusive,
546 within_ops=within_ops,
547 within_ops_fn=within_ops_fn,
548 control_outputs=control_outputs)
549 backward_ops = get_backward_walk_ops(
550 backward_seed_ops,
551 inclusive=backward_inclusive,
552 within_ops=within_ops,
553 within_ops_fn=within_ops_fn,
554 control_inputs=control_inputs)
555 return [op for op in forward_ops if op in backward_ops]
556

Callers

nothing calls this directly

Calls 3

check_ciosFunction · 0.85
get_forward_walk_opsFunction · 0.85
get_backward_walk_opsFunction · 0.70

Tested by

no test coverage detected