Skip to contents

Returns the number of dimensions (sometimes also refered to as rank) of a tensor. Equivalent to length(shape(x)).

Usage

ndims(x)

Arguments

x

(tensorish)
A tensor-like object.

Value

integer(1)

See also

Examples

x <- nv_tensor(1:4, dtype = "f32")
ndims(x)
#> [1] 1