pub struct Tensor<T: TensorType> { /* private fields */ }
Implementations§
source§impl<H: HalideType> Tensor<Device<H>>
impl<H: HalideType> Tensor<Device<H>>
source§impl<T: TensorType> Tensor<T>where
T::H: HalideType,
impl<T: TensorType> Tensor<T>where
T::H: HalideType,
sourcepub unsafe fn from_ptr(tensor: *mut Tensor) -> Self
pub unsafe fn from_ptr(tensor: *mut Tensor) -> Self
This function constructs a Tensor type from a raw pointer
§Safety
Since this constructs a Tensor from a raw pointer we have no way to guarantee that it’s a valid tensor or it’s lifetime
sourcepub fn copy_from_host_tensor(
&mut self,
tensor: &Tensor<Host<T::H>>,
) -> Result<()>
pub fn copy_from_host_tensor( &mut self, tensor: &Tensor<Host<T::H>>, ) -> Result<()>
Copies the data from a host tensor to the self tensor
sourcepub fn copy_to_host_tensor(&self, tensor: &mut Tensor<Host<T::H>>) -> Result<()>
pub fn copy_to_host_tensor(&self, tensor: &mut Tensor<Host<T::H>>) -> Result<()>
Copies the data from the self tensor to a host tensor
pub fn device_id(&self) -> u64
sourcepub fn shape(&self) -> TensorShape
pub fn shape(&self) -> TensorShape
Get the shape of the tensor
pub fn dimensions(&self) -> usize
pub fn width(&self) -> u32
pub fn height(&self) -> u32
pub fn channel(&self) -> u32
pub fn batch(&self) -> u32
pub fn size(&self) -> usize
pub fn element_size(&self) -> usize
pub fn print_shape(&self)
pub fn print(&self)
sourcepub fn is_dynamic_unsized(&self) -> bool
pub fn is_dynamic_unsized(&self) -> bool
Check if the tensor is dynamic and needs resizing
sourcepub unsafe fn halide_buffer(&self) -> *const halide_buffer_t
pub unsafe fn halide_buffer(&self) -> *const halide_buffer_t
DO not use this function directly
§Safety
This is just provided as a 1:1 compat mostly for possible later use
sourcepub unsafe fn halide_buffer_mut(&self) -> *mut halide_buffer_t
pub unsafe fn halide_buffer_mut(&self) -> *mut halide_buffer_t
Do not use this function directly
§Safety
This is just provided as a 1:1 compat mostly for possible later use
pub fn get_dimension_type(&self) -> DimensionType
pub fn get_type(&self) -> halide_type_t
pub fn is_type_of<H: HalideType>(&self) -> bool
source§impl<T: MutableTensorType> Tensor<T>where
T::H: HalideType,
impl<T: MutableTensorType> Tensor<T>where
T::H: HalideType,
source§impl<T: HostTensorType> Tensor<T>where
T::H: HalideType,
impl<T: HostTensorType> Tensor<T>where
T::H: HalideType,
sourcepub fn try_host(&self) -> Result<&[T::H]>
pub fn try_host(&self) -> Result<&[T::H]>
Try to map the device tensor to the host memory and get the slice
sourcepub fn try_host_mut(&mut self) -> Result<&mut [T::H]>
pub fn try_host_mut(&mut self) -> Result<&mut [T::H]>
Try to map the device tensor to the host memory and get the mutable slice
pub fn host(&self) -> &[T::H]
pub fn host_mut(&mut self) -> &mut [T::H]
source§impl<T: DeviceTensorType> Tensor<T>where
T::H: HalideType,
impl<T: DeviceTensorType> Tensor<T>where
T::H: HalideType,
source§impl<T: OwnedTensorType> Tensor<T>where
T::H: HalideType,
impl<T: OwnedTensorType> Tensor<T>where
T::H: HalideType,
pub fn new(shape: impl AsTensorShape, dm_type: DimensionType) -> Self
source§impl<T: HostTensorType + RefTensorType> Tensor<T>where
T::H: HalideType,
impl<T: HostTensorType + RefTensorType> Tensor<T>where
T::H: HalideType,
pub fn borrowed(shape: impl AsTensorShape, input: impl AsRef<[T::H]>) -> Self
pub fn borrowed_mut( shape: impl AsTensorShape, input: impl AsMut<[T::H]>, ) -> Self
Trait Implementations§
source§impl<T: OwnedTensorType> Clone for Tensor<T>where
T::H: HalideType,
impl<T: OwnedTensorType> Clone for Tensor<T>where
T::H: HalideType,
Auto Trait Implementations§
impl<T> Freeze for Tensor<T>
impl<T> RefUnwindSafe for Tensor<T>where
T: RefUnwindSafe,
impl<T> !Send for Tensor<T>
impl<T> !Sync for Tensor<T>
impl<T> Unpin for Tensor<T>where
T: Unpin,
impl<T> UnwindSafe for Tensor<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)