pub struct PjRtBuffer { /* private fields */ }
Expand description
A buffer represents a view on a memory slice hosted on a device.
Implementations§
Source§impl PjRtBuffer
impl PjRtBuffer
Sourcepub fn client(&self) -> &PjRtClient
pub fn client(&self) -> &PjRtClient
The client that owns this buffer.
Sourcepub fn copy_to_device(&self, device: PjRtDevice<'_>) -> Result<PjRtBuffer>
pub fn copy_to_device(&self, device: PjRtDevice<'_>) -> Result<PjRtBuffer>
Copy the buffer to a different device.
Sourcepub fn to_literal_sync(&self) -> Result<Literal>
pub fn to_literal_sync(&self) -> Result<Literal>
Copy the buffer back to the host as a literal.
Sourcepub fn on_device_shape(&self) -> Result<Shape>
pub fn on_device_shape(&self) -> Result<Shape>
Retrieve the shape used by this buffer.
Sourcepub fn copy_raw_to_host_sync<T: ArrayElement>(
&self,
dst: &mut [T],
offset: usize,
) -> Result<()>
pub fn copy_raw_to_host_sync<T: ArrayElement>( &self, dst: &mut [T], offset: usize, ) -> Result<()>
Copy the data stored in a buffer to host memory in a blocking way.
Trait Implementations§
Source§impl Drop for PjRtBuffer
impl Drop for PjRtBuffer
Source§impl FromRawBytes for PjRtBuffer
impl FromRawBytes for PjRtBuffer
type Context = PjRtClient
fn from_raw_bytes( client: &Self::Context, ty: ElementType, dims: &[usize], bytes: &[u8], ) -> Result<Self>
Source§fn read_npy<T: AsRef<Path>>(path: T, c: &Self::Context) -> Result<Self>
fn read_npy<T: AsRef<Path>>(path: T, c: &Self::Context) -> Result<Self>
Reads a npy file and return the stored multi-dimensional array as a literal.
Auto Trait Implementations§
impl Freeze for PjRtBuffer
impl RefUnwindSafe for PjRtBuffer
impl !Send for PjRtBuffer
impl !Sync for PjRtBuffer
impl Unpin for PjRtBuffer
impl UnwindSafe for PjRtBuffer
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