Casts an object with class tensor to an R atomic vector, matrix or array.

# S3 method for tensor
as.array(x)

Arguments

x

tensor object to be casted to an R array.

See also

Examples

x <- tensor(array(1:8, dim = c(2, 2, 2))) as.array(x)
#> , , 1 #> #> [,1] [,2] #> [1,] 1 3 #> [2,] 2 4 #> #> , , 2 #> #> [,1] [,2] #> [1,] 5 7 #> [2,] 6 8 #>