pub struct BertEmbeddings { /* private fields */ }Expand description
Construct the embeddings from word, position and token_type embeddings.
Implementations§
Source§impl BertEmbeddings
impl BertEmbeddings
Sourcepub fn new<'a>(
vs: impl Borrow<PathExt<'a>>,
config: &BertConfig,
) -> Result<Self, TransformerError>
pub fn new<'a>( vs: impl Borrow<PathExt<'a>>, config: &BertConfig, ) -> Result<Self, TransformerError>
Construct new Bert embeddings with the given variable store and Bert configuration.
pub fn forward( &self, input_ids: &Tensor, token_type_ids: Option<&Tensor>, position_ids: Option<&Tensor>, train: bool, ) -> Result<Tensor, TransformerError>
Trait Implementations§
Source§impl Debug for BertEmbeddings
impl Debug for BertEmbeddings
Auto Trait Implementations§
impl Freeze for BertEmbeddings
impl RefUnwindSafe for BertEmbeddings
impl Send for BertEmbeddings
impl !Sync for BertEmbeddings
impl Unpin for BertEmbeddings
impl UnwindSafe for BertEmbeddings
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> 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