pub enum EmbeddingBagMode {
Sum,
Mean,
}Expand description
Reduction mode for embedding_bag.
Intentionally NOT #[non_exhaustive] — Sum / Mean is the
closed set for the EmbeddingBag op family today; Max mode lives on
its own super::EmbeddingBagMaxPlan plan (separate FFI surface)
rather than as a third variant here. New variants would be a
deliberate breaking-change event.
Variants§
Sum
out[b, :] = Σ weight[indices[k], :] for k in bag b.
Mean
out[b, :] = (Σ weight[indices[k], :]) / bag_size(b) where
bag_size counts only non-padded / in-bounds indices.
Trait Implementations§
Source§impl Clone for EmbeddingBagMode
impl Clone for EmbeddingBagMode
Source§fn clone(&self) -> EmbeddingBagMode
fn clone(&self) -> EmbeddingBagMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for EmbeddingBagMode
Source§impl Debug for EmbeddingBagMode
impl Debug for EmbeddingBagMode
impl Eq for EmbeddingBagMode
Source§impl Hash for EmbeddingBagMode
impl Hash for EmbeddingBagMode
Source§impl PartialEq for EmbeddingBagMode
impl PartialEq for EmbeddingBagMode
Source§fn eq(&self, other: &EmbeddingBagMode) -> bool
fn eq(&self, other: &EmbeddingBagMode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for EmbeddingBagMode
Auto Trait Implementations§
impl Freeze for EmbeddingBagMode
impl RefUnwindSafe for EmbeddingBagMode
impl Send for EmbeddingBagMode
impl Sync for EmbeddingBagMode
impl Unpin for EmbeddingBagMode
impl UnsafeUnpin for EmbeddingBagMode
impl UnwindSafe for EmbeddingBagMode
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