Struct burn_wgpu::tensor::WgpuTensor
source · pub struct WgpuTensor<E: WgpuElement, const D: usize> {
pub client: WgpuComputeClient,
pub handle: WgpuHandle,
pub shape: Shape<D>,
pub device: WgpuDevice,
pub strides: [usize; D],
/* private fields */
}Expand description
The basic tensor primitive struct.
Fields§
§client: WgpuComputeClientCompute client for wgpu.
handle: WgpuHandleThe buffer where the data are stored.
shape: Shape<D>The shape of the current tensor.
device: WgpuDeviceThe device of the current tensor.
strides: [usize; D]The strides of the current tensor.
Implementations§
source§impl<E: WgpuElement, const D: usize> WgpuTensor<E, D>
impl<E: WgpuElement, const D: usize> WgpuTensor<E, D>
sourcepub fn new(
client: WgpuComputeClient,
device: WgpuDevice,
shape: Shape<D>,
handle: WgpuHandle
) -> Self
pub fn new( client: WgpuComputeClient, device: WgpuDevice, shape: Shape<D>, handle: WgpuHandle ) -> Self
Create a new tensor.
sourcepub fn to_client(&self, client: WgpuComputeClient, device: WgpuDevice) -> Self
pub fn to_client(&self, client: WgpuComputeClient, device: WgpuDevice) -> Self
Change the context of the current tensor and return the newly transferred tensor.
sourcepub fn assert_is_on_same_device(&self, other: &Self)
pub fn assert_is_on_same_device(&self, other: &Self)
Assert that both tensors are on the same device.
sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Check if the current tensor is contiguous.
Trait Implementations§
Auto Trait Implementations§
impl<E, const D: usize> !RefUnwindSafe for WgpuTensor<E, D>
impl<E, const D: usize> Send for WgpuTensor<E, D>
impl<E, const D: usize> Sync for WgpuTensor<E, D>
impl<E, const D: usize> Unpin for WgpuTensor<E, D>where E: Unpin,
impl<E, const D: usize> !UnwindSafe for WgpuTensor<E, D>
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