powered by
Cast to a TensorFlow matrix
k_matrix(x, dtype = NULL)
A two-dimensional tf.Tensor with values from x. The shape will be (nrow(x), ncol(x)) where x is first converted to an R matrix via as.matrix().
tf.Tensor
x
(nrow(x), ncol(x))
as.matrix()
Numeric object to be converted to a matrix Tensor.
Type of the elements of the resulting tensor. Defaults to k_floatx().
k_floatx()
if (interactive() && keras::is_keras_available()) { k_matrix(diag(1:3)) k_matrix(diag(1:3), dtype = "int32") # Vectors are converted to columns: k_matrix(1:3) }
Run the code above in your browser using DataLab