View Operations
View operations create a new view of an existing array without copying the data.
array_slice
def array_slice(arg0: Array, slices: List[Slice]) -> Array
Slices the input array based on the given slices.
detach
def detach(arg0: Array) -> Array
Detaches the input array from the computation graph.
expand
def expand(arg0: Array, shape: ArrayShape, ignore_axes: List[Int] = List[Int]()) -> Array
Expands the input array to the given shape.
expand_as
def expand_as(arg0: Array, arg1: Array) -> Array
Expands the input array to the shape of the target array.
broadcast_to
def broadcast_to(arg0: Array, shape: List[Int]) -> Array
Broadcasts the input array to the given shape.
imag
def imag(arg0: Array) -> Array
Computes the imaginary part of the input array.
as_strided_inv
def as_strided_inv(arg0: Array, target_shape: ArrayShape, shape: List[Int], stride: List[Int], storage_offset: Int) -> Array
Creates a view of the input array with the given shape and stride.
pad
def pad(arg0: Array, target_shape: ArrayShape, slices_in_target: List[Slice]) -> Array
Pads an array to a target shape.
Args
arg0: The input array to be padded. target_shape: The target shape to pad the input array to. slices_in_target: A list of slices specifying the region in the target shape where the input array is copied.
Returns
An array containing the input array padded to the target shape.
Note
This function supports:
- Automatic differentiation (reverse mode only).
- Complex valued arguments.
permute
def permute(arg0: Array, axis: ArrayShape) -> Array
Creates a view of the input array with its dimensions permuted based on the given axis.
transpose
def transpose(arg0: Array, axis1: Int, axis2: Int) -> Array
Transposes the input array based on the given axes.
swapaxes
def swapaxes(arg0: Array, axis1: Int, axis2: Int) -> Array
Swaps the input array's axes based on the given axes.
swapdims
def swapdims(arg0: Array, axis1: Int, axis2: Int) -> Array
Swaps the input array's dimensions based on the given axes.
real
def real(arg0: Array) -> Array
Computes the real part of the input array element-wise.
squeeze
def squeeze(arg0: Array) -> Array
Squeezes the input array by removing axes of length 1.
unsqueeze
def unsqueeze(arg0: Array, axis: ArrayShape) -> Array
Unsqueezes the input array by adding axes of length 1.
view_as_imag
def view_as_imag(arg0: Array) -> Array
Creates a view of the input array as an imaginary array.
view_as_real
def view_as_real(arg0: Array) -> Array