original_docstring: r"""An n-way switch statement which calls a single branch function.
  
        An n-way switch statement, implementing the following:
        ```
        switch (branch_index) {
          case 0:
            output = branches[0](input);
            break;
          case 1:
            output = branches[1](input);
            break;
          ...
          case [[nbranches-1]]:
          default:
            output = branches[nbranches-1](input);
            break;
        }
        ```
  
    Args:
      branch_index: A `Tensor` of type `int32`.
        The branch selector, an int32 Tensor.
      input: A list of `Tensor` objects.
        A list of input tensors passed to the branch function.
      Tout: A list of `tf.DTypes`. A list of output types.
      branches: A list of functions decorated with @Defun that has length `>= 1`.
              A list of functions each of which takes 'inputs' and returns a list of
              tensors, whose types are the same as what every other branch returns.
      output_shapes: An optional list of shapes (each a `tf.TensorShape` or list of `ints`). Defaults to `[]`.
      name: A name for the operation (optional).
  
    Returns:
      A list of `Tensor` objects of type `Tout`.
    
docstring: r"""An n-way switch statement which calls a single branch function.
docstring_tokens: r " " " An n - way switch statement which calls a single branch function .
code: def case(branch_index, input, Tout, branches, output_shapes=[], name=None):
    r"""An n-way switch statement which calls a single branch function.
  
        An n-way switch statement, implementing the following:
        ```
        switch (branch_index) {
          case 0:
            output = branches[0](input);
            break;
          case 1:
            output = branches[1](input);
            break;
          ...
          case [[nbranches-1]]:
          default:
            output = branches[nbranches-1](input);
            break;
        }
        ```
  
    Args:
      branch_index: A `Tensor` of type `int32`.
        The branch selector, an int32 Tensor.
      input: A list of `Tensor` objects.
        A list of input tensors passed to the branch function.
      Tout: A list of `tf.DTypes`. A list of output types.
      branches: A list of functions decorated with @Defun that has length `>= 1`.
              A list of functions each of which takes 'inputs' and returns a list of
              tensors, whose types are the same as what every other branch returns.
      output_shapes: An optional list of shapes (each a `tf.TensorShape` or list of `ints`). Defaults to `[]`.
      name: A name for the operation (optional).
  
    Returns:
      A list of `Tensor` objects of type `Tout`.
    """
    _ctx = _context._context or _context.context()
    if _ctx is not None and _ctx._thread_local_data.is_eager:
      try:
        _result = _pywrap_tensorflow.TFE_Py_FastPathExecute(
          _ctx._context_handle, _ctx._thread_local_data.device_name, "Case",
          name, _ctx._post_execution_callbacks, branch_index, input, "Tout",
          Tout, "branches", branches, "output_shapes", output_shapes)
        return _result
      except _core._FallbackException:
        try:
          return case_eager_fallback(
              branch_index, input, Tout=Tout, branches=branches,
              output_shapes=output_shapes, name=name, ctx=_ctx)
        except _core._SymbolicException:
          pass  # Add nodes to the TensorFlow graph.
      except _core._NotOkStatusException as e:
        if name is not None:
          message = e.message + " name: " + name
        else:
          message = e.message
        _six.raise_from(_core._status_to_exception(e.code, message), None)
    # Add nodes to the TensorFlow graph.
    if not isinstance(Tout, (list, tuple)):
      raise TypeError(
          "Expected list for 'Tout' argument to "
          "'case' Op, not %r." % Tout)
    Tout = [_execute.make_type(_t, "Tout") for _t in Tout]
    if not isinstance(branches, (list, tuple)):
      raise TypeError(
          "Expected list for 'branches' argument to "
          "'case' Op, not %r." % branches)
    if output_shapes is None:
      output_shapes = []
    if not isinstance(output_shapes, (list, tuple)):
      raise TypeError(
          "Expected list for 'output_shapes' argument to "
          "'case' Op, not %r." % output_shapes)
    output_shapes = [_execute.make_shape(_s, "output_shapes") for _s in output_shapes]
    _, _, _op = _op_def_lib._apply_op_helper(
          "Case", branch_index=branch_index, input=input, Tout=Tout,
                  branches=branches, output_shapes=output_shapes, name=name)
    _result = _op.outputs[:]
    if not _result:
      return _op
    _inputs_flat = _op.inputs
    _attrs = ("Tin", _op.get_attr("Tin"), "Tout", _op.get_attr("Tout"),
              "branches", _op.get_attr("branches"), "output_shapes",
              _op.get_attr("output_shapes"))
    _execute.record_gradient(
        "Case", _inputs_flat, _attrs, _result, name)
    return _result
code_tokens: def case ( branch_index , input , Tout , branches , output_shapes = [ ] , name = None ) : _ctx = _context . _context or _context . context ( ) if _ctx is not None and _ctx . _thread_local_data . is_eager : try : _result = _pywrap_tensorflow . TFE_Py_FastPathExecute ( _ctx . _context_handle , _ctx . _thread_local_data . device_name , "Case" , name , _ctx . _post_execution_callbacks , branch_index , input , "Tout" , Tout , "branches" , branches , "output_shapes" , output_shapes ) return _result except _core . _FallbackException : try : return case_eager_fallback ( branch_index , input , Tout = Tout , branches = branches , output_shapes = output_shapes , name = name , ctx = _ctx ) except _core . _SymbolicException : pass except _core . _NotOkStatusException as e : if name is not None : message = e . message + " name: " + name else : message = e . message _six . raise_from ( _core . _status_to_exception ( e . code , message ) , None ) if not isinstance ( Tout , ( list , tuple ) ) : raise TypeError ( "Expected list for 'Tout' argument to " "'case' Op, not %r." % Tout ) Tout = [ _execute . make_type ( _t , "Tout" ) for _t in Tout ] if not isinstance ( branches , ( list , tuple ) ) : raise TypeError ( "Expected list for 'branches' argument to " "'case' Op, not %r." % branches ) if output_shapes is None : output_shapes = [ ] if not isinstance ( output_shapes , ( list , tuple ) ) : raise TypeError ( "Expected list for 'output_shapes' argument to " "'case' Op, not %r." % output_shapes ) output_shapes = [ _execute . make_shape ( _s , "output_shapes" ) for _s in output_shapes ] _ , _ , _op = _op_def_lib . _apply_op_helper ( "Case" , branch_index = branch_index , input = input , Tout = Tout , branches = branches , output_shapes = output_shapes , name = name ) _result = _op . outputs [ : ] if not _result : return _op _inputs_flat = _op . inputs _attrs = ( "Tin" , _op . get_attr ( "Tin" ) , "Tout" , _op . get_attr ( "Tout" ) , "branches" , _op . get_attr ( "branches" ) , "output_shapes" , _op . get_attr ( "output_shapes" ) ) _execute . record_gradient ( "Case" , _inputs_flat , _attrs , _result , name ) return _result
short_docstring: r"""An n-way switch statement which calls a single branch function.
short_docstring_tokens: r " " " An n - way switch statement which calls a single branch function .
comment: r"""An n-way switch statement which calls a single branch function.
  
        An n-way switch statement, implementing the following:
        ```
        switch (branch_index) {
          case 0:
            output = branches[0](input);
            break;
          case 1:
            output = branches[1](input);
            break;
          ...
          case [[nbranches-1]]:
          default:
            output = branches[nbranches-1](input);
            break;
        }
        ```
  
    Args:
      branch_index: A `Tensor` of type `int32`.
        The branch selector, an int32 Tensor.
      input: A list of `Tensor` objects.
        A list of input tensors passed to the branch function.
      Tout: A list of `tf.DTypes`. A list of output types.
      branches: A list of functions decorated with @Defun that has length `>= 1`.
              A list of functions each of which takes 'inputs' and returns a list of
              tensors, whose types are the same as what every other branch returns.
      output_shapes: An optional list of shapes (each a `tf.TensorShape` or list of `ints`). Defaults to `[]`.
      name: A name for the operation (optional).
  
    Returns:
      A list of `Tensor` objects of type `Tout`.
    """$SEP$# Add nodes to the TensorFlow graph.$SEP$# Add nodes to the TensorFlow graph.