Provides S3 generics for common tensor operations.
Installation
pak::pak("r-xla/tengen")Available Generics
-
shape(): Different fromdim()by also supporting 0-dimensional tensors. -
dtype(): Returns the data type of the tensor. -
as_array(): Converts the tensor to an R array. -
as_raw(): Converts the tensor to araw()vector. -
device(): Returns the device of the tensor.
Other functions:
-
ndims(): Returns the number of dimensions of the tensor. Is implemented aslength(shape(x)).