Class BertEncoder

Inheritance Relationships

Base Type

Class Documentation

class BertEncoder : public marian::EncoderTransformer

BERT-specific modifications to EncoderTransformer Actually all that is needed is to intercept the creation of special embeddings, here sentence embeddings for sentence A and B.

@BUGBUG: transformer.h was meant to be compiled separately. I.e., one cannot derive from it. Is there a way to maybe instead include a reference in here, instead of deriving from it?

Public Functions

Expr addSentenceEmbeddings(Expr embeddings, Ptr<data::CorpusBatch> batch, bool learnedPosEmbeddings) const
virtual Expr addSpecialEmbeddings(Expr input, int start = 0, Ptr<data::CorpusBatch> batch = nullptr) const