# tf.raw_ops.While

<br />

output = input; While (Cond(output)) { output = Body(output) }

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.While`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/While)

<br />

    tf.raw_ops.While(
        input, cond, body, output_shapes=[], parallel_iterations=10, name=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `input` | A list of `Tensor` objects. A list of input tensors whose types are T. |
| `cond` | A function decorated with @Defun. A function takes 'input' and returns a tensor. If the tensor is a scalar of non-boolean, the scalar is converted to a boolean according to the following rule: if the scalar is a numerical value, non-zero means True and zero means False; if the scalar is a string, non-empty means True and empty means False. If the tensor is not a scalar, non-emptiness means True and False otherwise. |
| `body` | A function decorated with @Defun. A function that takes a list of tensors and returns another list of tensors. Both lists have the same types as specified by T. |
| `output_shapes` | An optional list of shapes (each a [`tf.TensorShape`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/TensorShape) or list of `ints`). Defaults to `[]`. |
| `parallel_iterations` | An optional `int`. Defaults to `10`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A list of `Tensor` objects. Has the same type as `input`. ||

<br />