tenferro_burn/convert.rs
1//! Conversion utilities between Burn tensor primitives and tenferro tensors.
2
3use burn::tensor::backend::Backend;
4use burn::tensor::ops::FloatTensor;
5
6/// Convert a Burn backend tensor primitive into a tenferro `Tensor<f64>`.
7///
8/// # Examples
9///
10/// ```ignore
11/// use burn::backend::NdArray;
12/// use tenferro_burn::convert::burn_to_tenferro;
13///
14/// let burn_prim: <NdArray<f64> as burn::tensor::backend::Backend>::FloatTensorPrimitive =
15/// todo!();
16/// let tenferro_t: tenferro_tensor::Tensor<f64> = burn_to_tenferro::<NdArray<f64>>(burn_prim);
17/// ```
18pub fn burn_to_tenferro<B: Backend>(_tensor: FloatTensor<B>) -> tenferro_tensor::Tensor<f64> {
19 todo!()
20}
21
22/// Convert a tenferro `Tensor<f64>` into a Burn backend tensor primitive.
23///
24/// # Examples
25///
26/// ```ignore
27/// use burn::backend::NdArray;
28/// use tenferro_burn::convert::tenferro_to_burn;
29///
30/// let tenferro_t: tenferro_tensor::Tensor<f64> = todo!();
31/// let burn_prim = tenferro_to_burn::<NdArray<f64>>(tenferro_t, &Default::default());
32/// ```
33pub fn tenferro_to_burn<B: Backend>(
34 _tensor: tenferro_tensor::Tensor<f64>,
35 _device: &B::Device,
36) -> FloatTensor<B> {
37 todo!()
38}