TTypes<T>::Vec tensorflow::Tensor::vec()
Return the tensor data as an Eigen::Tensor
with the type and sizes of this Tensor
.
Use these methods when you know the data type and the number of dimensions of the Tensor and you want an Eigen::Tensor
automatically sized to the Tensor
sizes. The implementation check fails if either type or sizes mismatch.
Example:
Tensor my_mat(...built with Shape{rows: 3, cols: 5}...); auto mat = my_mat.matrix<T>(); // 2D Eigen::Tensor, 3 x 5. auto mat = my_mat.tensor<T, 2>(); // 2D Eigen::Tensor, 3 x 5. auto vec = my_mat.vec<T>(); // CHECK fails as my_mat is 2D. auto vec = my_mat.tensor<T, 3>(); // CHECK fails as my_mat is 2D. auto mat = my_mat.matrix<int32>();// CHECK fails as type mismatch.
Please login to continue.