ngraph.if_op(condition: Union[_pyngraph.Node, int, float, numpy.ndarray], inputs: List[_pyngraph.Node], bodies: Tuple[ngraph.utils.tensor_iterator_types.GraphBody, ngraph.utils.tensor_iterator_types.GraphBody], input_desc: Tuple[List[ngraph.utils.tensor_iterator_types.TensorIteratorInvariantInputDesc], List[ngraph.utils.tensor_iterator_types.TensorIteratorInvariantInputDesc]], output_desc: Tuple[List[ngraph.utils.tensor_iterator_types.TensorIteratorBodyOutputDesc], List[ngraph.utils.tensor_iterator_types.TensorIteratorBodyOutputDesc]], name: Optional[str] = None) _pyngraph.Node

Execute one of the bodies depending on condtion value.

  • condition – A scalar or 1D tensor with 1 element specifying body will be executed. If condition is True, then body will be executed, False - else_body.

  • inputs – The provided inputs to If operation.

  • bodies – Two graphs (then_body, else_body) which will be executed depending on condition value.

:param input_desc Two lists (for then_body and else_body) which contain rules how If

inputs are connected with body parameters.

  • output_desc – Two lists (for then_body and else_body) which contain rules how If outputs are connected with body results.

  • name – The optional name for the created output node.


The new node which performs If operation.