feedforward_encoder
allennlp.modules.seq2seq_encoders.feedforward_encoder
FeedForwardEncoder#
@Seq2SeqEncoder.register("feedforward")
class FeedForwardEncoder(Seq2SeqEncoder):
| def __init__(self, feedforward: FeedForward) -> None
This class applies the FeedForward
to each item in sequences.
Registered as a Seq2SeqEncoder
with name "feedforward".
get_input_dim#
class FeedForwardEncoder(Seq2SeqEncoder):
| ...
| @overrides
| def get_input_dim(self) -> int
get_output_dim#
class FeedForwardEncoder(Seq2SeqEncoder):
| ...
| @overrides
| def get_output_dim(self) -> int
is_bidirectional#
class FeedForwardEncoder(Seq2SeqEncoder):
| ...
| @overrides
| def is_bidirectional(self) -> bool
forward#
class FeedForwardEncoder(Seq2SeqEncoder):
| ...
| @overrides
| def forward(
| self,
| inputs: torch.Tensor,
| mask: torch.BoolTensor = None
| ) -> torch.Tensor
Parameters
- inputs :
torch.Tensor
A tensor of shape (batch_size, timesteps, input_dim) - mask :
torch.BoolTensor
, optional (default =None
)
A tensor of shape (batch_size, timesteps).
Returns
- A tensor of shape (batch_size, timesteps, output_dim).