expand#
- ivy.expand(x, shape, /, *, copy=None, out=None)[source]#
Broadcast the input Array following the given shape and the broadcast rule.
- Parameters:
x (
Union
[Array
,NativeArray
]) – Array input.shape (
Union
[Shape
,NativeShape
]) – A 1-D Array indicates the shape you want to expand to, following the broadcast rule.copy (
Optional
[bool
], default:None
) – boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, the function must never copy. In case copy is False we avoid copying by returning a view of the input array.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to.
- Return type:
- Returns:
ret – Output Array
- Array.expand(self, shape, /, *, copy=None, out=None)[source]#
Broadcast the input Array following the given shape and the broadcast rule.
- Parameters:
self (
Array
) – Array input.shape (
Union
[Shape
,NativeShape
]) – A 1-D Array indicates the shape you want to expand to, following the broadcast rulecopy (
Optional
[bool
], default:None
) –boolean indicating whether or not to copy the input array. If True, the function must always copy. If False, the function must never copy. In case copy is False we avoid copying by returning
a view of the input array.
out (
Optional
[Array
], default:None
) – optional output array, for writing the result to.
- Return type:
Array
- Returns:
ret – Output Array
- Container.expand(self, shape, /, *, copy=None, out=None)[source]#
- Parameters:
self (
Union
[Array
,NativeArray
,Container
]) – input container.shape (
Union
[Shape
,NativeShape
,Container
]) – A 1-D Array indicates the shape you want to expand to, following the broadcast rule.copy (
Optional
[Union
[bool
,Container
]], default:None
) – boolean indicating whether to copy the input array. If True, the function must always copy. If False, the function must never copy and must raise a ValueError in case a copy would be necessary. If None, the function must reuse existing memory buffer if possible and copy otherwise. Default:None
. deviceout (
Optional
[Container
], default:None
) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – An output Container with the results.