chainer.functions.broadcast

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

Broadcast given variables.

Parameters

args (Variable or N-dimensional array) – 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(np.float32)
>>> y = F.broadcast(x)
>>> np.all(x == y.array)
True
>>> z = np.random.uniform(0, 1, (3, 2)).astype(np.float32)
>>> y, w = F.broadcast(x, z)
>>> np.all(x == y.array) & np.all(z == w.array)
True