chainer.functions.broadcast

chainer.functions.broadcast(*args)[source]

Broadcast given variables.

Parameters:args (Variable or numpy.ndarray or cupy.ndarray) – Input variables to be broadcasted. Each dimension of the shapes of the input variables must have the same size.
Returns:Variable or tuple of Variable objects which are broadcasted from given arguments.
Return type:Variable

Example

>>> x = np.random.uniform(0, 1, (3, 2)).astype('f')
>>> y = F.broadcast(x)
>>> np.all(x == y.data)
True
>>> z = np.random.uniform(0, 1, (3, 2)).astype('f')
>>> y, w = F.broadcast(x, z)
>>> np.all(x == y.data) & np.all(z == w.data)
True