Last updated: 2023-03-16.
tf_quant_finance.utils.common_shape#
Returns common shape for a sequence of Tensors.
tf_quant_finance.utils.common_shape(
*, name=None, *args
)
The common shape is the smallest-rank shape to which all tensors are broadcastable.
Example#
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:#
*args: A sequence ofTensors of compatible shapes and anydtypes.name: Python string. The name to give to the ops created by this function. Default value:Nonewhich maps to the default namebroadcast_tensor_shapes.
Returns:#
A common shape for the input Tensors, which an instance of TensorShape,
if the input shapes are fully defined, or a Tensor for dynamically shaped
inputs.
Raises:#
ValueError: If inputs are of incompatible shapes.