as.tensor

0th

Percentile

Tensor Conversion

Create a Tensor-class object from an array, matrix, or vector.

Usage
as.tensor(x, drop = FALSE)
Arguments
x

an instance of array, matrix, or vector

drop

whether or not modes of 1 should be dropped

Value

a Tensor-class object

Aliases
  • as.tensor
Examples
# NOT RUN {
#From vector
vec <- runif(100); vecT <- as.tensor(vec); vecT
#From matrix
mat <- matrix(runif(1000),nrow=100,ncol=10)
matT <- as.tensor(mat); matT
#From array
indices <- c(10,20,30,40)
arr <- array(runif(prod(indices)), dim = indices)
arrT <- as.tensor(arr); arrT
# }
Documentation reproduced from package rTensor, version 1.4, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.