reshape
Reshapes an array without changing its data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
input array to reshape. |
required | |
shape
|
a new shape compatible with the original shape. One shape dimension is allowed to be |
required | |
copy
|
whether or not to copy the input array.
If |
None
|
Returns:
Name | Type | Description |
---|---|---|
out |
array
|
an output array having the same data type and elements as |
Raises:
Type | Description |
---|---|
ValueError
|
If |
Examples:
>>> a = sparse.COO.from_numpy(np.array([[0, 1], [2, 0]]))
>>> o = sparse.reshape(a, shape=(1, 4))
>>> o.todense()
array([[0, 1, 2, 0]])
Source code in sparse/numba_backend/_common.py
2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 |
|