Trait BertEmbedding

Source
pub trait BertEmbedding {
    // Required methods
    fn new<'p, P>(p: P, config: &BertConfig) -> Self
       where P: Borrow<Path<'p>>;
    fn forward_t(
        &self,
        input_ids: Option<&Tensor>,
        token_type_ids: Option<&Tensor>,
        position_ids: Option<&Tensor>,
        input_embeds: Option<&Tensor>,
        train: bool,
    ) -> Result<Tensor, RustBertError>;
}
Expand description

§BertEmbedding trait (for use in BertModel or RoBERTaModel)

Defines an interface for the embedding layers in BERT-based models

Required Methods§

Source

fn new<'p, P>(p: P, config: &BertConfig) -> Self
where P: Borrow<Path<'p>>,

Source

fn forward_t( &self, input_ids: Option<&Tensor>, token_type_ids: Option<&Tensor>, position_ids: Option<&Tensor>, input_embeds: Option<&Tensor>, train: bool, ) -> Result<Tensor, RustBertError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§