Last updated: 2023-03-16.
tf_quant_finance.utils.broadcast_tensors#
Broadcasts arguments to the common shape.
tf_quant_finance.utils.broadcast_tensors(
*, name=None, *args
)
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.broadcast_tensor_shapes(*args)
# Expected: (array([[1., 1.], [1., 1.]]),
# array([[True, True], [False, False]])
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 tuple of broadcasted Tensors. Each Tensor has the same dtype as the
corresponding input Tensor.
Raises:#
ValueError: If inputs are of incompatible shapes.