mdarray_to_tensor

Function mdarray_to_tensor 

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

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

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

§Examples

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

let md: Array<f64, DynRank> = mdarray::tensor![1.0, 2.0, 3.0];
let t: Tensor<f64> = mdarray_to_tensor(md);