tensor_to_mdarray

Function tensor_to_mdarray 

Source
pub fn tensor_to_mdarray<T: Scalar>(_tensor: Tensor<T>) -> Array<T, DynRank>
Expand description

Converts a tenferro Tensor<T> into an mdarray Array<T, DynRank>.

This conversion copies all element data from the tenferro tensor into a newly allocated mdarray array. The shape is preserved.

§Examples

use mdarray::{Array, DynRank};
use tenferro_tensor::Tensor;
use tenferro_mdarray::tensor_to_mdarray;

let t: Tensor<f64> = Tensor::zeros(&[3, 4]);
let md: Array<f64, DynRank> = tensor_to_mdarray(t);