pub struct EmbeddingOutput { /* private fields */ }Available on crate feature
onnx only.Expand description
Container struct with all the outputs from the embedding layer.
This will contain one SingleBatchOutput object per batch/inference call.
Implementations§
Source§impl EmbeddingOutput
impl EmbeddingOutput
Sourcepub fn new(batches: impl IntoIterator<Item = SingleBatchOutput>) -> Self
pub fn new(batches: impl IntoIterator<Item = SingleBatchOutput>) -> Self
Create a new EmbeddingOutput from the per-batch session outputs.
Sourcepub fn into_raw(self) -> Vec<SingleBatchOutput>
pub fn into_raw(self) -> Vec<SingleBatchOutput>
Consume this EmbeddingOutput and return the raw session outputs.
This allows the user to perform their custom extractions outside of this library.
Sourcepub fn export_with_transformer<R>(
&self,
transformer: impl Fn(&[SingleBatchOutput]) -> Result<R>,
) -> Result<R>
pub fn export_with_transformer<R>( &self, transformer: impl Fn(&[SingleBatchOutput]) -> Result<R>, ) -> Result<R>
Export the output using the given output transformer.
The transformer shall be responsible for:
- Selecting the output from the session outputs based on the precedence order,
- Extracting the tensor from the output, then
- Transform the tensor into the desired output.
The transformer function should take a slice of SingleBatchOutput, and return
the desired output type.
If any of the steps fail, this function will return an error, including the session output not containing the expected precedence keys.
Auto Trait Implementations§
impl !RefUnwindSafe for EmbeddingOutput
impl !UnwindSafe for EmbeddingOutput
impl Forget for EmbeddingOutput
impl Freeze for EmbeddingOutput
impl Move for EmbeddingOutput
impl Send for EmbeddingOutput
impl Sync for EmbeddingOutput
impl Unpin for EmbeddingOutput
impl UnsafeUnpin for EmbeddingOutput
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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