<!--
This file is generated by a tool. Do not edit directly.
For open-source contributions the docs will be updated automatically.
-->

*Last updated: 2023-03-16.*

<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf_quant_finance.utils.common_shape" />
<meta itemprop="path" content="Stable" />
</div>

# tf_quant_finance.utils.common_shape

<!-- Insert buttons and diff -->

<table class="tfo-notebook-buttons tfo-api" align="left">
</table>

<a target="_blank" href="https://github.com/paolodelia99/tf-quant-finance/blob/main/tf_quant_finance/utils/shape_utils.py">View source</a>



Returns common shape for a sequence of Tensors.

```python
tf_quant_finance.utils.common_shape(
    *, name=None, *args
)
```



<!-- Placeholder for "Used in" -->

The common shape is the smallest-rank shape to which all tensors are
broadcastable.

#### Example
```python
import tensorflow as tf
import tf_quant_finance as tff

args = [tf.ones([1, 2], dtype=tf.float64), tf.constant([[True], [False]])]
tff.utils.common_shape(*args)
# Expected: [2, 2]
```

#### Args:


* <b>`*args`</b>: A sequence of `Tensor`s of compatible shapes and any `dtype`s.
* <b>`name`</b>: Python string. The name to give to the ops created by this function.
  Default value: `None` which maps to the default name
  `broadcast_tensor_shapes`.


#### Returns:

A common shape for the input `Tensor`s, which an instance of TensorShape,
if the input shapes are fully defined, or a `Tensor` for dynamically shaped
inputs.



#### Raises:


* <b>`ValueError`</b>: If inputs are of incompatible shapes.