#[repr(transparent)]pub struct Tensor<'tensor> {
pub inner: DLTensor,
/* private fields */
}
Expand description
Non-owned Tensor type interface. See DLTensor
Fields
inner: DLTensor
Implementations
sourceimpl<'tensor> Tensor<'tensor>
impl<'tensor> Tensor<'tensor>
sourcepub fn new(
data: *mut c_void,
device: Device,
ndim: i32,
dtype: DataType,
shape: *mut i64,
strides: *mut i64,
byte_offset: u64
) -> Self
pub fn new(
data: *mut c_void,
device: Device,
ndim: i32,
dtype: DataType,
shape: *mut i64,
strides: *mut i64,
byte_offset: u64
) -> Self
Constructor
sourcepub fn into_inner(self) -> DLTensor
pub fn into_inner(self) -> DLTensor
Returns the underlying DLTensor where lifetime parameter is removed.
sourcepub fn into_raw(self) -> *const DLTensor
pub fn into_raw(self) -> *const DLTensor
Consumes the Tensor and returns the raw pointer to its underlying DLTensor.
sourcepub unsafe fn from_raw(ptr: *mut DLTensor) -> Self
pub unsafe fn from_raw(ptr: *mut DLTensor) -> Self
Creates a Tensor from a raw DLTensor pointer (must be non-null).
sourcepub fn byte_offset(&self) -> isize
pub fn byte_offset(&self) -> isize
Returns the byte offset of the underlying Tensor.
Trait Implementations
Auto Trait Implementations
impl<'tensor> RefUnwindSafe for Tensor<'tensor>
impl<'tensor> !Send for Tensor<'tensor>
impl<'tensor> !Sync for Tensor<'tensor>
impl<'tensor> Unpin for Tensor<'tensor>
impl<'tensor> UnwindSafe for Tensor<'tensor>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more