#[repr(C)]pub struct Tensor { /* private fields */ }
Expand description
ABI stable owned Shape for ffi
Implementations§
Source§impl Tensor
impl Tensor
Sourcepub fn data_ptr_mut(&mut self) -> *mut c_void
pub fn data_ptr_mut(&mut self) -> *mut c_void
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
pub fn data_as_slice<T: AsDLDataType>(&self) -> Result<&[T]>
Sourcepub fn data_as_slice_mut<T: AsDLDataType>(&self) -> Result<&mut [T]>
pub fn data_as_slice_mut<T: AsDLDataType>(&self) -> Result<&mut [T]>
pub fn shape(&self) -> &[i64]
pub fn ndim(&self) -> usize
pub fn numel(&self) -> usize
pub fn strides(&self) -> &[i64]
pub fn dtype(&self) -> DLDataType
pub fn device(&self) -> DLDevice
Source§impl Tensor
impl Tensor
Sourcepub fn from_nd_alloc<TNDAlloc>(
alloc: TNDAlloc,
shape: &[i64],
dtype: DLDataType,
device: DLDevice,
) -> Selfwhere
TNDAlloc: NDAllocator,
pub fn from_nd_alloc<TNDAlloc>(
alloc: TNDAlloc,
shape: &[i64],
dtype: DLDataType,
device: DLDevice,
) -> Selfwhere
TNDAlloc: NDAllocator,
Sourcepub fn from_slice<T: AsDLDataType>(slice: &[T], shape: &[i64]) -> Result<Self>
pub fn from_slice<T: AsDLDataType>(slice: &[T], shape: &[i64]) -> Result<Self>
Trait Implementations§
Source§impl AnyCompatible for Tensor
impl AnyCompatible for Tensor
Source§unsafe fn copy_to_any_view(src: &Self, data: &mut TVMFFIAny)
unsafe fn copy_to_any_view(src: &Self, data: &mut TVMFFIAny)
the value to copy to TVMFFIAny
unsafe fn check_any_strict(data: &TVMFFIAny) -> bool
Source§unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> Self
unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> Self
Copy value from TVMFFIAny after checking
caller must ensure that the value is compatible with the type
Source§unsafe fn move_to_any(src: Self, data: &mut TVMFFIAny)
unsafe fn move_to_any(src: Self, data: &mut TVMFFIAny)
consume the value to move to Any
Source§unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> Self
unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> Self
the value to move from TVMFFIAny
NOTE: pay very careful attention to avoid memory leak! Read more
Source§unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<Self, ()>
unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<Self, ()>
try to cast the value from AnyView
Source§fn get_mismatch_type_info(data: &TVMFFIAny) -> String
fn get_mismatch_type_info(data: &TVMFFIAny) -> String
Get the type key of a type when TryCastFromAnyView fails.
Source§impl<'a> ArgIntoRef for &'a Tensor
impl<'a> ArgIntoRef for &'a Tensor
Source§impl ArgIntoRef for Tensor
impl ArgIntoRef for Tensor
Source§impl<'a> IntoArgHolder for &'a Tensor
impl<'a> IntoArgHolder for &'a Tensor
Source§impl IntoArgHolder for Tensor
impl IntoArgHolder for Tensor
Source§impl ObjectRefCore for Tensor
impl ObjectRefCore for Tensor
Auto Trait Implementations§
impl Freeze for Tensor
impl RefUnwindSafe for Tensor
impl !Send for Tensor
impl !Sync for Tensor
impl Unpin for Tensor
impl UnwindSafe for Tensor
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