Skip to contents

Removes axes of size 1 from an array.

Usage

nv_squeeze(x, axes = NULL)

Arguments

x

(arrayish)
Input array.

axes

(integer() | NULL)
Axes to squeeze. Negative values count from the end, i.e. -1 refers to the last axis. If NULL (default), all axes of size 1 are removed.

Value

arrayish
Has the same data type as x with the specified axes removed.

Examples

x <- nv_array(1:6, shape = c(1, 6, 1))
nv_squeeze(x)
#> AnvlArray
#>  1
#>  2
#>  3
#>  4
#>  5
#>  6
#> [ CPUi32{6} ]