From 49f264647b6073c304936a95fea1704a8c0965dc Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 23 May 2021 13:18:52 +0200 Subject: Add model skeleton --- model/attention.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 model/attention.py (limited to 'model/attention.py') diff --git a/model/attention.py b/model/attention.py new file mode 100644 index 0000000..d82ca17 --- /dev/null +++ b/model/attention.py @@ -0,0 +1,15 @@ +from torch import nn + +class Attention(nn.Module): + def __init__(self, hidden_dim, num_heads): + super(Attention, self).__init__() + # TODO: implement Attention + pass + + def forward(self, x): + # TODO: implement Attention; return both result of attention mechanism and + # attention weights (for visualization). + # x shape: (seqlen, batch, hiddendim) + result, att_weights = x, None # placeholder + pass + return result, att_weights -- cgit v1.2.3