Enum syntaxdot_transformers::models::LayerOutput
source · [−]pub enum LayerOutput {
Embedding(Tensor),
EncoderWithAttention(HiddenLayer),
}
Expand description
Output of a BERT layer.
Variants
Embedding(Tensor)
Embedding layer output.
EncoderWithAttention(HiddenLayer)
Encoder layer output.
Implementations
sourceimpl LayerOutput
impl LayerOutput
sourcepub fn attention(&self) -> Option<&Tensor>
pub fn attention(&self) -> Option<&Tensor>
Get the layer attention.
Return a Some
value if the layer output is from an encoder layer,
or None
otherwise.
sourcepub fn embedding(&self) -> Option<&Tensor>
pub fn embedding(&self) -> Option<&Tensor>
Get the embedding.
Returns Some
if the layer output is an embedding or None
otherwise.
sourcepub fn map_output<F>(&self, f: F) -> Result<Self, TransformerError> where
F: Fn(&Tensor) -> Result<Tensor, TransformerError>,
pub fn map_output<F>(&self, f: F) -> Result<Self, TransformerError> where
F: Fn(&Tensor) -> Result<Tensor, TransformerError>,
Map the output representation of this layer.
sourcepub fn output_mut(&mut self) -> &mut Tensor
pub fn output_mut(&mut self) -> &mut Tensor
Get the layer output mutably.
sourcepub fn encoder_with_attention(&self) -> Option<&HiddenLayer>
pub fn encoder_with_attention(&self) -> Option<&HiddenLayer>
Get the output of an encoder layer.
Return a Some
value if the layer output is from an encoder layer,
or None
otherwise.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LayerOutput
impl Send for LayerOutput
impl !Sync for LayerOutput
impl Unpin for LayerOutput
impl UnwindSafe for LayerOutput
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more