@@ -17,29 +17,29 @@ There are two main cases related to where the owner of the underlying data / sto
1717
1818In this case, ` ManagedTensor ` is built from ` ManagedTensorProxy ` which is a safe proxy for the unsafe ` ffi::DLManagedTensor ` .
1919
20- ### Non -Memory Manged Tensor (View)
20+ ### Plain Not -Memory-Managed Tensor
2121
2222In this case, the (invariant) Rust wrapper ` Tensor ` can be used or if needed the unsafe ` ffi::DLTensor ` .
2323
2424## Example
2525
2626When ownership is concerned, one can use the ` ManagedTensor ` . Here is an example on how the bi-directional conversion
2727
28- <div align =" center " >ndarray::ArrayD <--> ManagedTensor</div >
28+ <div align =" center " >ndarray::ArrayD <--- > ManagedTensor</div >
2929
3030is done at zero-cost.
3131
3232``` rust
33- impl <'tensor , ' ctx > From <& 'tensor mut ArrayD <f32 >> for ManagedTensor <'tensor , ' ctx > {
33+ impl <'tensor , C > From <& 'tensor mut ArrayD <f32 >> for ManagedContext <'tensor , C > {
3434 fn from (t : & 'tensor mut ArrayD <f32 >) -> Self {
3535 let dlt : Tensor <'tensor > = Tensor :: from (t );
36- let inner = DLManagedTensor :: new (dlt . 0 , ptr :: null_mut () );
37- ManagedTensor (inner )
36+ let inner = DLManagedTensor :: new (dlt . 0 , None );
37+ ManagedContext (inner )
3838 }
3939}
4040
41- impl <'tensor , ' ctx > From <& mut ManagedTensor <'tensor , ' ctx >> for ArrayD <f32 > {
42- fn from (mt : & mut ManagedTensor <'tensor , ' ctx >) -> Self {
41+ impl <'tensor , C > From <& mut ManagedContext <'tensor , C >> for ArrayD <f32 > {
42+ fn from (mt : & mut ManagedContext <'tensor , C >) -> Self {
4343 let dlt : DLTensor = mt . 0. inner. dl_tensor. into ();
4444 unsafe {
4545 let arr = RawArrayViewMut :: from_shape_ptr (dlt . shape (). unwrap (), dlt . data () as * mut f32 );
@@ -51,7 +51,7 @@ impl<'tensor, 'ctx> From<&mut ManagedTensor<'tensor, 'ctx>> for ArrayD<f32> {
5151
5252And when ownership is not concerned, one can use ` Tensor ` as a view. Here is an example on how the bi-directional converion
5353
54- <div align =" center " >ndarray::ArrayD <--> Tensor</div >
54+ <div align =" center " >ndarray::ArrayD <--- > Tensor</div >
5555
5656is done at zero-cost.
5757
0 commit comments