pub struct RawTensor<'r> { /* private fields */ }
Expand description
A raw tensor type that doesn’t have any guarantees and will be unconditionally dropped
Implementations§
source§impl RawTensor<'_>
impl RawTensor<'_>
sourcepub fn create_host_tensor_from_device(
&self,
copy_data: bool,
) -> RawTensor<'static>
pub fn create_host_tensor_from_device( &self, copy_data: bool, ) -> RawTensor<'static>
Creates a new host tensor from the device tensor
sourcepub fn copy_from_host_tensor(&mut self, tensor: &RawTensor<'_>) -> Result<()>
pub fn copy_from_host_tensor(&mut self, tensor: &RawTensor<'_>) -> Result<()>
Copies the data from a host tensor to the self tensor
sourcepub fn copy_to_host_tensor(&self, tensor: &mut RawTensor<'_>) -> Result<()>
pub fn copy_to_host_tensor(&self, tensor: &mut RawTensor<'_>) -> Result<()>
Copies the data from the self tensor to a host tensor
sourcepub fn shape(&self) -> TensorShape
pub fn shape(&self) -> TensorShape
Returns the shape of the tensor
sourcepub fn get_dimension_type(&self) -> DimensionType
pub fn get_dimension_type(&self) -> DimensionType
Returns the dimension type of the tensor
sourcepub fn element_size(&self) -> usize
pub fn element_size(&self) -> usize
Returns the size of the tensor when counted by elements
sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Returns the number of dimensions of the tensor
sourcepub fn is_dynamic_unsized(&self) -> bool
pub fn is_dynamic_unsized(&self) -> bool
Returns true if the tensor is unsized and dynamic (needs to be resized to work)
sourcepub unsafe fn unchecked_host_ptr(&self) -> *mut c_void
pub unsafe fn unchecked_host_ptr(&self) -> *mut c_void
§Safety
This is very unsafe do not use this unless you know what you are doing Gives a raw pointer to the tensor’s data P.S. I don’t know what I’m doing
sourcepub unsafe fn unchecked_host_bytes(&mut self) -> &mut [u8] ⓘ
pub unsafe fn unchecked_host_bytes(&mut self) -> &mut [u8] ⓘ
§Safety
This is very unsafe do not use this unless you know what you are doing Gives a mutable byte slice to the tensor’s data
sourcepub unsafe fn to_concrete<T: TensorType>(self) -> Tensor<T>where
T::H: HalideType,
pub unsafe fn to_concrete<T: TensorType>(self) -> Tensor<T>where
T::H: HalideType,
§Safety
This is very unsafe do not use this unless you know what you are doing