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

Method __init__

tensorflow/python/ops/control_flow_ops.py:811–846  ·  view source on GitHub ↗

Creates a `CondContext`. Args: pred: The `boolean` tensor for the conditional predicate. pivot: The predicate tensor in this branch. branch: 0 or 1 representing this branch. name: Name of the `CondContext` python object. context_def: Optional `ContextDef` protocol

(self,
               pred=None,
               pivot=None,
               branch=None,
               name="cond_text",
               context_def=None,
               import_scope=None)

Source from the content-addressed store, hash-verified

809 """The context for the conditional construct."""
810
811 def __init__(self,
812 pred=None,
813 pivot=None,
814 branch=None,
815 name="cond_text",
816 context_def=None,
817 import_scope=None):
818 """Creates a `CondContext`.
819
820 Args:
821 pred: The `boolean` tensor for the conditional predicate.
822 pivot: The predicate tensor in this branch.
823 branch: 0 or 1 representing this branch.
824 name: Name of the `CondContext` python object.
825 context_def: Optional `ContextDef` protocol buffer to initialize the
826 `CondContext` object from.
827 import_scope: Optional `string`. Name scope to add. Only used when
828 initialing from protocol buffer.
829 """
830 self._name = ops.get_default_graph().unique_name(name)
831
832 if context_def:
833 self._init_from_proto(context_def, import_scope=import_scope)
834 else:
835 # Initializes the default fields.
836 ControlFlowContext.__init__(self)
837 self._pred = pred # The boolean tensor for the cond predicate
838 self._pivot = pivot # The predicate tensor in this branch
839 self._branch = branch # 0 or 1 representing this branch
840
841 # Values considered to have been already seen in this context. pred is not
842 # included in this context.
843 self._values.add(pred.name)
844 self._external_values[pred.name] = pred
845 self._values.add(pivot.name)
846 pivot.op._set_control_flow_context(self) # pylint: disable=protected-access
847
848 def _init_from_proto(self, context_def, import_scope=None):
849 """Creates a new `CondContext` from protocol buffer.

Callers 4

_init_from_protoMethod · 0.45
__init__Method · 0.45
_init_from_protoMethod · 0.45
__init__Method · 0.45

Calls 4

_init_from_protoMethod · 0.95
unique_nameMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected