# tf.broadcast_static_shape

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 1 version](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/broadcast_static_shape) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/ops/array_ops.py#L456-L480) |

Computes the shape of a broadcast given known shapes.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.broadcast_static_shape(
        shape_x, shape_y
    )

When shape_x and shape_y are fully known TensorShapes this computes a
TensorShape which is the shape of the result of a broadcasting op applied in
tensors of shapes shape_x and shape_y.

For example, if shape_x is \[1, 2, 3\] and shape_y is \[5, 1, 3\], the result is a
TensorShape whose value is \[5, 2, 3\].

This is useful when validating the result of a broadcasting operation when the
tensors have statically known shapes.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `shape_x` | A `TensorShape` |
| `shape_y` | A `TensorShape` |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `TensorShape` representing the broadcasted shape. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If the two shapes can not be broadcasted. |

<br />