lamp.nn.TransformerEncoder
See theTransformerEncoder companion object
case class TransformerEncoder(blocks: Seq[TransformerEncoderBlock]) extends GenericModule[(Variable, Option[STen]), Variable]
TransformerEncoder module
Does not include initial embedding or position encoding.
Input is (data, maxLength)
where data
is (batch, sequence, input dimension), double tensor maxLength
is a 1D or 2D long tensor used for attention masking.
Attention masking is implemented similarly to chapter 11.3.2.1 in d2l.ai v1.0.0-beta0. It supports unmasked attention, attention on variable length input, and left-to-right attention.
Output is (bach, sequence, output dimension)
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
Members list
In this article