pub trait TensorDataAccess {
// Required methods
fn data_f32(&self) -> Option<&[f32]>;
fn data_bytes(&self) -> Option<&[u8]>;
fn to_vec_f32(&self) -> Result<Vec<f32>>;
fn to_vec_u8(&self) -> Result<Vec<u8>>;
}Expand description
Tensor data access for interop
Required Methods§
Sourcefn data_f32(&self) -> Option<&[f32]>
fn data_f32(&self) -> Option<&[f32]>
Get read-only access to raw data (CPU only) Returns None if tensor is not on CPU or data is not contiguous
Sourcefn data_bytes(&self) -> Option<&[u8]>
fn data_bytes(&self) -> Option<&[u8]>
Get read-only access to raw data as bytes
Sourcefn to_vec_f32(&self) -> Result<Vec<f32>>
fn to_vec_f32(&self) -> Result<Vec<f32>>
Copy tensor data to a Vec