pub struct PboTensor<T>{
pub name: String,
pub shape: Vec<usize>,
/* private fields */
}Expand description
A tensor backed by an OpenGL Pixel Buffer Object.
Fields§
§name: String§shape: Vec<usize>Implementations§
Source§impl<T> PboTensor<T>
impl<T> PboTensor<T>
Sourcepub fn from_pbo(
buffer_id: u32,
size: usize,
shape: &[usize],
name: Option<&str>,
ops: Arc<dyn PboOps>,
) -> Result<Self>
pub fn from_pbo( buffer_id: u32, size: usize, shape: &[usize], name: Option<&str>, ops: Arc<dyn PboOps>, ) -> Result<Self>
Create a new PBO tensor from an already-allocated GL buffer.
Called by the image crate after creating the PBO on the GL thread.
Users should not call this directly — use ImageProcessor::create_image().
§Errors
Returns Error::ShapeMismatch if size does not equal
shape.iter().product::<usize>() * std::mem::size_of::<T>().
Returns Error::InvalidSize if size is zero.
Trait Implementations§
Source§impl<T> TensorTrait<T> for PboTensor<T>
impl<T> TensorTrait<T> for PboTensor<T>
Source§fn new(_shape: &[usize], _name: Option<&str>) -> Result<Self>
fn new(_shape: &[usize], _name: Option<&str>) -> Result<Self>
Create a new tensor with the given shape and optional name. If no name
is given, a random name will be generated.
Source§fn from_fd(_fd: OwnedFd, _shape: &[usize], _name: Option<&str>) -> Result<Self>
fn from_fd(_fd: OwnedFd, _shape: &[usize], _name: Option<&str>) -> Result<Self>
Create a new tensor using the given file descriptor, shape, and optional
name. If no name is given, a random name will be generated. Read more
Source§fn memory(&self) -> TensorMemory
fn memory(&self) -> TensorMemory
Get the memory type of this tensor.
Source§fn reshape(&mut self, shape: &[usize]) -> Result<()>
fn reshape(&mut self, shape: &[usize]) -> Result<()>
Reshape this tensor to the given shape. The total number of elements
must remain the same.
Source§fn map(&self) -> Result<TensorMap<T>>
fn map(&self) -> Result<TensorMap<T>>
Map the tensor into memory and return a TensorMap for accessing the
data.
Source§fn buffer_identity(&self) -> &BufferIdentity
fn buffer_identity(&self) -> &BufferIdentity
Get the buffer identity for cache keying and liveness tracking.
impl<T> Send for PboTensor<T>
impl<T> Sync for PboTensor<T>
Auto Trait Implementations§
impl<T> Freeze for PboTensor<T>
impl<T> !RefUnwindSafe for PboTensor<T>
impl<T> Unpin for PboTensor<T>where
T: Unpin,
impl<T> UnsafeUnpin for PboTensor<T>
impl<T> !UnwindSafe for PboTensor<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more