broadcast_to
Broadcasts an array to a specified shape.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
array to broadcast. |
required | |
shape
|
array shape. Must be compatible with |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
array
|
an array having a specified shape and having the same data type as |
Examples:
>>> a = sparse.COO.from_numpy(np.array([[0, 1], [2, 0]]))
>>> o = sparse.broadcast_to(a, shape=(1, 2, 2))
>>> o.todense()
array([[[0, 1],
[2, 0]]])
Source code in sparse/numba_backend/_common.py
2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 |
|