numpy.broadcast_to() in Python

The numpy.broadcast_to() function broadcasts an array to a new shape.

Syntax

Parameter

The numpy.broadcast_to() function has three parameters which are as follows: 

array: This parameter represents the array to broadcast.

shape: It signifies the shape of the desired array.

subok:  It is an optional parameter which takes Boolean value. If True, then sub-classes will be passed-through, else the returned array will be forced to be a base-class array (default).

Return

This function returns a read-only view on the original array with the given shape. It is typically not contiguous. 

Example 1

Output

Pin It on Pinterest

Share This