# tf.contrib.autograph.stack

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/autograph/lang/special_functions.py#L92-L122) |

Stacks the input, if it admits the notion of stacking.

    tf.contrib.autograph.stack(
        list_or_tensor, element_dtype=None, strict=True
    )

For example, a list of tensors can be stacked into a larger tensor. This
function is similar to tf.stack, but it accepts non-lists and lists of
non-tensors as arguments. In the latter case, the function does nothing.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `list_or_tensor` | Any |
| `element_dtype` | tf.DType, optional dtypedtype for the elements in the list. Required if the input is stackable, and the list is untyped. |
| `strict` | bool, if True an error is raised if the input is not stackable. Otherwise the function is a no-op. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Any, if the input is stackable, the result will be a tf.Tensor. Otherwise, if strict=False, the result will be list_or_tensor. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | if strict=True and the input is not stackable. |

<br />