burn_jit::tensor

Struct JitTensor

Source
pub struct JitTensor<R, E>
where R: JitRuntime, E: JitElement,
{ pub client: ComputeClient<R::Server, R::Channel>, pub handle: Handle, pub shape: Shape, pub device: R::Device, pub strides: Vec<usize>, /* private fields */ }
Expand description

The basic tensor primitive struct.

Fields§

§client: ComputeClient<R::Server, R::Channel>

Compute client for the runtime.

§handle: Handle

The buffer where the data are stored.

§shape: Shape

The shape of the tensor.

§device: R::Device

The device of the tensor.

§strides: Vec<usize>

The strides of the tensor.

Implementations§

Source§

impl<R, E> JitTensor<R, E>
where R: JitRuntime, E: JitElement,

Source

pub fn new( client: ComputeClient<R::Server, R::Channel>, handle: Handle, shape: Shape, device: R::Device, strides: Vec<usize>, ) -> Self

Constructs a new JitTensor.

Source§

impl<R, E> JitTensor<R, E>
where R: JitRuntime, E: JitElement,

Source

pub fn new_contiguous( client: ComputeClient<R::Server, R::Channel>, device: R::Device, shape: Shape, handle: Handle, ) -> Self

Create a new tensor with a contiguous memory layout.

Source

pub fn to_client( &self, client: ComputeClient<R::Server, R::Channel>, device: R::Device, ) -> Self

Change the context of the current tensor and return the newly transferred tensor.

Source

pub fn as_handle_ref(&self) -> TensorHandleRef<'_, R>

Return the reference to a tensor handle.

Source

pub fn as_tensor_arg<'a>(&'a self, vectorisation: u8) -> TensorArg<'a, R>

Return the reference to a tensor argument.

Source

pub fn copy(&self) -> Self

Copy the current tensor.

Source

pub fn can_mut(&self) -> bool

Check if the tensor is safe to mutate.

Source

pub fn assert_is_on_same_device(&self, other: &Self)

Assert that both tensors are on the same device.

Source

pub fn is_contiguous(&self) -> bool

Check if the current tensor is contiguous.

Trait Implementations§

Source§

impl<R, E> Clone for JitTensor<R, E>
where R: JitRuntime, E: JitElement,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R, E> Debug for JitTensor<R, E>
where R: JitRuntime, E: JitElement,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R: JitRuntime, E: JitElement> From<JitTensor<R, E>> for TensorHandle<R, E>

Source§

fn from(val: JitTensor<R, E>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<R, E> Freeze for JitTensor<R, E>
where <R as JitRuntime>::JitDevice: Freeze, <R as Runtime>::Channel: Freeze,

§

impl<R, E> !RefUnwindSafe for JitTensor<R, E>

§

impl<R, E> Send for JitTensor<R, E>

§

impl<R, E> Sync for JitTensor<R, E>

§

impl<R, E> Unpin for JitTensor<R, E>
where <R as JitRuntime>::JitDevice: Unpin, <R as Runtime>::Channel: Unpin, E: Unpin,

§

impl<R, E> !UnwindSafe for JitTensor<R, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V